From 6ebdcd4ff78c43f71e4734a57c78c42833c484dd Mon Sep 17 00:00:00 2001 From: Lucky56 <55949451+Lucky-56@users.noreply.github.com> Date: Fri, 18 Jun 2021 21:40:50 +0200 Subject: [PATCH] fix error (getWeeks() is from patch-4) --- source/PlayState.hx | 9 +-------- source/StoryMenuState.hx | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/source/PlayState.hx b/source/PlayState.hx index 434f293..1228ba8 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -2581,14 +2581,7 @@ class PlayState extends MusicBeatState Highscore.saveWeekScore(storyWeek, campaignScore, storyDifficulty); } - if(storyWeek < StoryMenuState.getWeeks().length - 1 && FlxG.save.data.weekUnlocked == storyWeek) - { - StoryMenuState.weekUnlocked.push(true); - trace('Week ' + storyWeek + ' beat (Week ' + (storyWeek + 1) + ' unlocked)'); - } - - FlxG.save.data.weekUnlocked = StoryMenuState.weekUnlocked.length - 1; - FlxG.save.flush(); + StoryMenuState.unlockNextWeek(storyWeek); } else { diff --git a/source/StoryMenuState.hx b/source/StoryMenuState.hx index 74afeea..5d5b20f 100644 --- a/source/StoryMenuState.hx +++ b/source/StoryMenuState.hx @@ -410,4 +410,27 @@ class StoryMenuState extends MusicBeatState intendedScore = Highscore.getWeekScore(curWeek, curDifficulty); #end } + + public static function unlockNextWeek(week:Int):Void + { + // TODO: get the weekData from class (but making it static makes it weird) + var weekData:Array = [ + ['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(); + } }