brought back the week locking

This commit is contained in:
Lucky56 2021-06-17 18:02:20 +02:00
parent 19134e6694
commit b6953ec111
No known key found for this signature in database
GPG Key ID: 19E3875EAD1F8B8F
6 changed files with 53 additions and 20 deletions

View File

@ -5,7 +5,10 @@ class KadeEngineData
{
public static function initSave()
{
if (FlxG.save.data.newInput == null)
if (FlxG.save.data.weekUnlocked == null)
FlxG.save.data.weekUnlocked = 6;
if (FlxG.save.data.newInput == null)
FlxG.save.data.newInput = true;
if (FlxG.save.data.downscroll == null)

View File

@ -634,3 +634,25 @@ class CamZoomOption extends Option
return "Camera Zoom " + (!FlxG.save.data.camzoom ? "off" : "on");
}
}
class LockWeeksOption extends Option
{
public function new(desc:String)
{
super();
description = desc;
}
public override function press():Bool
{
FlxG.save.data.weekUnlocked = 0;
StoryMenuState.weekUnlocked = [true];
trace('Weeks Locked');
display = updateDisplay();
return true;
}
private override function updateDisplay():String
{
return "Lock Weeks";
}
}

View File

@ -58,6 +58,11 @@ class OptionsMenu extends MusicBeatState
new FlashingLightsOption("Toggle flashing lights that can cause epileptic seizures and strain."),
new WatermarkOption("Enable and disable all watermarks from the engine."),
new BotPlay("Showcase your charts and mods with autoplay.")
]),
new OptionCategory("Saved Data", [
new LockWeeksOption("Lock all weeks. (exept Tutorial of course)")
// TODO reset score
])
];

View File

@ -2576,16 +2576,19 @@ class PlayState extends MusicBeatState
}
#end
// if ()
StoryMenuState.weekUnlocked[Std.int(Math.min(storyWeek + 1, StoryMenuState.weekUnlocked.length - 1))] = true;
if (SONG.validScore)
{
NGio.unlockMedal(60961);
Highscore.saveWeekScore(storyWeek, campaignScore, storyDifficulty);
}
FlxG.save.data.weekUnlocked = StoryMenuState.weekUnlocked;
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();
}
else

View File

@ -34,7 +34,7 @@ class StoryMenuState extends MusicBeatState
];
var curDifficulty:Int = 1;
public static var weekUnlocked:Array<Bool> = [true, true, true, true, true, true, true];
public static var weekUnlocked:Array<Bool> = [];
var weekCharacters:Array<Dynamic> = [
['', 'bf', 'gf'],
@ -72,8 +72,21 @@ class StoryMenuState extends MusicBeatState
var leftArrow:FlxSprite;
var rightArrow:FlxSprite;
function unlockWeeks():Array<Bool>
{
var weeks:Array<Bool> = [true];
for(i in 0...FlxG.save.data.weekUnlocked)
{
weeks.push(true);
}
return weeks;
}
override function create()
{
weekUnlocked = unlockWeeks();
#if windows
// Updating Discord Rich Presence
DiscordClient.changePresence("In the Story Mode Menu", null);
@ -133,6 +146,7 @@ class StoryMenuState extends MusicBeatState
// Needs an offset thingie
if (!weekUnlocked[i])
{
trace('locking week ' + i);
var lock:FlxSprite = new FlxSprite(weekThing.width + 10 + weekThing.x);
lock.frames = ui_tex;
lock.animation.addByPrefix('lock', 'lock');

View File

@ -94,20 +94,6 @@ class TitleState extends MusicBeatState
Highscore.load();
if (FlxG.save.data.weekUnlocked != null)
{
// FIX LATER!!!
// WEEK UNLOCK PROGRESSION!!
// StoryMenuState.weekUnlocked = FlxG.save.data.weekUnlocked;
if (StoryMenuState.weekUnlocked.length < 4)
StoryMenuState.weekUnlocked.insert(0, true);
// QUICK PATCH OOPS!
if (!StoryMenuState.weekUnlocked[0])
StoryMenuState.weekUnlocked[0] = true;
}
#if FREEPLAY
FlxG.switchState(new FreeplayState());
#elseif CHARTING