fixed replay + updated replay to 1.1

replay 1.1 still has 1.0 support
This commit is contained in:
Lucky56 2021-06-11 13:19:29 +02:00
parent e664da2e36
commit c31f76e37a
No known key found for this signature in database
GPG Key ID: 19E3875EAD1F8B8F
2 changed files with 14 additions and 4 deletions

View File

@ -148,9 +148,19 @@ class LoadReplayState extends MusicBeatState
PlayState.loadRep = true;
var poop:String = Highscore.formatSong(PlayState.rep.replay.songName.toLowerCase(), PlayState.rep.replay.songDiff);
// adjusting the song name to be compatible
var songFormat = StringTools.replace(PlayState.rep.replay.songName, " ", "-");
switch (songFormat) {
case 'Dad-Battle': songFormat = 'Dadbattle';
case 'Philly-Nice': songFormat = 'Philly';
// Replay v1.0 support
case 'dad-battle': songFormat = 'Dadbattle';
case 'philly-nice': songFormat = 'Philly';
}
PlayState.SONG = Song.loadFromJson(poop, PlayState.rep.replay.songName.toLowerCase());
var poop:String = Highscore.formatSong(songFormat, PlayState.rep.replay.songDiff);
PlayState.SONG = Song.loadFromJson(poop, PlayState.rep.replay.songName);
PlayState.isStoryMode = false;
PlayState.storyDifficulty = PlayState.rep.replay.songDiff;
PlayState.storyWeek = getWeekNumbFromSong(PlayState.rep.replay.songName);

View File

@ -24,7 +24,7 @@ typedef ReplayJSON =
class Replay
{
public static var version:String = "1.0"; // replay file version
public static var version:String = "1.1"; // replay file version
public var path:String = "";
public var replay:ReplayJSON;
@ -56,7 +56,7 @@ class Replay
public function SaveReplay(notearray:Array<Float>)
{
var json = {
"songName": PlayState.SONG.song.toLowerCase(),
"songName": PlayState.SONG.song,
"songDiff": PlayState.storyDifficulty,
"noteSpeed": (FlxG.save.data.scrollSpeed > 1 ? FlxG.save.data.scrollSpeed : PlayState.SONG.speed),
"isDownscroll": FlxG.save.data.downscroll,