baby proofed the fucking freeplay state
This commit is contained in:
parent
d8f679a659
commit
0d35cdfbfe
@ -1,4 +1,5 @@
|
|||||||
package;
|
package;
|
||||||
|
import lime.app.Application;
|
||||||
import openfl.utils.Future;
|
import openfl.utils.Future;
|
||||||
import openfl.media.Sound;
|
import openfl.media.Sound;
|
||||||
import flixel.system.FlxSound;
|
import flixel.system.FlxSound;
|
||||||
@ -77,7 +78,6 @@ class FreeplayState extends MusicBeatState
|
|||||||
{
|
{
|
||||||
var data:Array<String> = initSonglist[i].split(':');
|
var data:Array<String> = initSonglist[i].split(':');
|
||||||
var meta = new SongMetadata(data[0], Std.parseInt(data[2]), data[1]);
|
var meta = new SongMetadata(data[0], Std.parseInt(data[2]), data[1]);
|
||||||
songs.push(meta);
|
|
||||||
var format = StringTools.replace(meta.songName, " ", "-");
|
var format = StringTools.replace(meta.songName, " ", "-");
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case 'Dad-Battle': format = 'Dadbattle';
|
case 'Dad-Battle': format = 'Dadbattle';
|
||||||
@ -85,11 +85,37 @@ class FreeplayState extends MusicBeatState
|
|||||||
}
|
}
|
||||||
|
|
||||||
var diffs = [];
|
var diffs = [];
|
||||||
FreeplayState.loadDiff(0,format,meta.songName,diffs);
|
|
||||||
FreeplayState.loadDiff(1,format,meta.songName,diffs);
|
|
||||||
FreeplayState.loadDiff(2,format,meta.songName,diffs);
|
var diffsThatExist = [];
|
||||||
|
|
||||||
|
if (FileSystem.exists('assets/data/${format}/${format}-hard.json'))
|
||||||
|
diffsThatExist.push("Hard");
|
||||||
|
if (FileSystem.exists('assets/data/${format}/${format}-easy.json'))
|
||||||
|
diffsThatExist.push("Easy");
|
||||||
|
if (FileSystem.exists('assets/data/${format}/${format}.json'))
|
||||||
|
diffsThatExist.push("Normal");
|
||||||
|
|
||||||
|
if (diffsThatExist.length == 0)
|
||||||
|
{
|
||||||
|
Application.current.window.alert("No difficulties found for chart, skipping.",meta.songName + " Chart");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (diffsThatExist.contains("Easy"))
|
||||||
|
FreeplayState.loadDiff(0,format,meta.songName,diffs);
|
||||||
|
if (diffsThatExist.contains("Normal"))
|
||||||
|
FreeplayState.loadDiff(1,format,meta.songName,diffs);
|
||||||
|
if (diffsThatExist.contains("Hard"))
|
||||||
|
FreeplayState.loadDiff(2,format,meta.songName,diffs);
|
||||||
|
|
||||||
|
meta.diffs = diffsThatExist;
|
||||||
|
|
||||||
|
if (diffsThatExist.length != 3)
|
||||||
|
trace("I ONLY FOUND " + diffsThatExist);
|
||||||
|
|
||||||
FreeplayState.songData.set(meta.songName,diffs);
|
FreeplayState.songData.set(meta.songName,diffs);
|
||||||
trace('loaded diffs for ' + meta.songName);
|
trace('loaded diffs for ' + meta.songName);
|
||||||
|
songs.push(meta);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -376,6 +402,9 @@ class FreeplayState extends MusicBeatState
|
|||||||
|
|
||||||
function changeDiff(change:Int = 0)
|
function changeDiff(change:Int = 0)
|
||||||
{
|
{
|
||||||
|
if (!songs[curSelected].diffs.contains(CoolUtil.difficultyFromInt(curDifficulty + change)))
|
||||||
|
return;
|
||||||
|
|
||||||
curDifficulty += change;
|
curDifficulty += change;
|
||||||
|
|
||||||
if (curDifficulty < 0)
|
if (curDifficulty < 0)
|
||||||
@ -417,6 +446,19 @@ class FreeplayState extends MusicBeatState
|
|||||||
if (curSelected >= songs.length)
|
if (curSelected >= songs.length)
|
||||||
curSelected = 0;
|
curSelected = 0;
|
||||||
|
|
||||||
|
if (songs[curSelected].diffs.length != 3)
|
||||||
|
{
|
||||||
|
switch(songs[curSelected].diffs[0])
|
||||||
|
{
|
||||||
|
case "Easy":
|
||||||
|
curDifficulty = 0;
|
||||||
|
case "Normal":
|
||||||
|
curDifficulty = 1;
|
||||||
|
case "Hard":
|
||||||
|
curDifficulty = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// selector.y = (70 * curSelected) + 30;
|
// selector.y = (70 * curSelected) + 30;
|
||||||
|
|
||||||
// adjusting the highscore song name to be compatible (changeSelection)
|
// adjusting the highscore song name to be compatible (changeSelection)
|
||||||
@ -501,6 +543,8 @@ class SongMetadata
|
|||||||
#end
|
#end
|
||||||
public var songCharacter:String = "";
|
public var songCharacter:String = "";
|
||||||
|
|
||||||
|
public var diffs = [];
|
||||||
|
|
||||||
#if sys
|
#if sys
|
||||||
public function new(song:String, week:Int, songCharacter:String, ?sm:SMFile = null, ?path:String = "")
|
public function new(song:String, week:Int, songCharacter:String, ?sm:SMFile = null, ?path:String = "")
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user