fix error (getWeeks() is from patch-4)

This commit is contained in:
Lucky56 2021-06-18 21:40:50 +02:00
parent cccd2a4ddd
commit 6ebdcd4ff7
No known key found for this signature in database
GPG Key ID: 19E3875EAD1F8B8F
2 changed files with 24 additions and 8 deletions

View File

@ -2581,14 +2581,7 @@ class PlayState extends MusicBeatState
Highscore.saveWeekScore(storyWeek, campaignScore, storyDifficulty); Highscore.saveWeekScore(storyWeek, campaignScore, storyDifficulty);
} }
if(storyWeek < StoryMenuState.getWeeks().length - 1 && FlxG.save.data.weekUnlocked == storyWeek) StoryMenuState.unlockNextWeek(storyWeek);
{
StoryMenuState.weekUnlocked.push(true);
trace('Week ' + storyWeek + ' beat (Week ' + (storyWeek + 1) + ' unlocked)');
}
FlxG.save.data.weekUnlocked = StoryMenuState.weekUnlocked.length - 1;
FlxG.save.flush();
} }
else else
{ {

View File

@ -410,4 +410,27 @@ class StoryMenuState extends MusicBeatState
intendedScore = Highscore.getWeekScore(curWeek, curDifficulty); intendedScore = Highscore.getWeekScore(curWeek, curDifficulty);
#end #end
} }
public static function unlockNextWeek(week:Int):Void
{
// TODO: get the weekData from class (but making it static makes it weird)
var weekData:Array<Dynamic> = [
['Tutorial'],
['Bopeebo', 'Fresh', 'Dad Battle'],
['Spookeez', 'South', "Monster"],
['Pico', 'Philly Nice', "Blammed"],
['Satin Panties', "High", "Milf"],
['Cocoa', 'Eggnog', 'Winter Horrorland'],
['Senpai', 'Roses', 'Thorns']
];
if(week < weekData.length - 1 && FlxG.save.data.weekUnlocked == week)
{
weekUnlocked.push(true);
trace('Week ' + week + ' beat (Week ' + (week + 1) + ' unlocked)');
}
FlxG.save.data.weekUnlocked = weekUnlocked.length - 1;
FlxG.save.flush();
}
} }