Merge pull request #894 from Lucky-56/patch-3
Locking weeks + settings/score reset option
This commit is contained in:
commit
89c6b60350
@ -1,4 +1,4 @@
|
|||||||
Tutorial:gf:1
|
Tutorial:gf:0
|
||||||
Bopeebo:dad:1
|
Bopeebo:dad:1
|
||||||
Fresh:dad:1
|
Fresh:dad:1
|
||||||
Dad Battle:dad:1
|
Dad Battle:dad:1
|
||||||
|
@ -15,7 +15,9 @@ Scroll down to Line 26, or Search (Windows/Linux: `Ctrl+F`, Mac: `Cmd+F`) for "w
|
|||||||
---
|
---
|
||||||
|
|
||||||
```haxe
|
```haxe
|
||||||
var weekData:Array<Dynamic> = [
|
static function weekData():Array<Dynamic>
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
|
||||||
['Tutorial'],
|
['Tutorial'],
|
||||||
|
|
||||||
@ -31,7 +33,8 @@ var weekData:Array<Dynamic> = [
|
|||||||
|
|
||||||
['Senpai', 'Roses', 'Thorns']
|
['Senpai', 'Roses', 'Thorns']
|
||||||
|
|
||||||
];
|
];
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
@ -45,7 +48,9 @@ Example
|
|||||||
---
|
---
|
||||||
|
|
||||||
```haxe
|
```haxe
|
||||||
var weekData:Array<Dynamic> = [
|
static function weekData():Array<Dynamic>
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
|
||||||
['Tutorial'],
|
['Tutorial'],
|
||||||
|
|
||||||
@ -63,7 +68,8 @@ var weekData:Array<Dynamic> = [
|
|||||||
|
|
||||||
['Ugh', 'Guns', 'Stress']
|
['Ugh', 'Guns', 'Stress']
|
||||||
|
|
||||||
];
|
];
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
@ -64,6 +64,8 @@ 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]);
|
||||||
|
if(Std.parseInt(data[2]) <= FlxG.save.data.weekUnlocked - 1)
|
||||||
|
{
|
||||||
songs.push(meta);
|
songs.push(meta);
|
||||||
var format = StringTools.replace(meta.songName, " ", "-");
|
var format = StringTools.replace(meta.songName, " ", "-");
|
||||||
switch (format) {
|
switch (format) {
|
||||||
@ -77,7 +79,7 @@ class FreeplayState extends MusicBeatState
|
|||||||
FreeplayState.loadDiff(2,format,meta.songName,diffs);
|
FreeplayState.loadDiff(2,format,meta.songName,diffs);
|
||||||
FreeplayState.songData.set(meta.songName,diffs);
|
FreeplayState.songData.set(meta.songName,diffs);
|
||||||
trace('loaded diffs for ' + meta.songName);
|
trace('loaded diffs for ' + meta.songName);
|
||||||
//diffList += meta.songName + "\nEasy: " + DiffCalc.CalculateDiff(songData.get(meta.songName)[0]) + "\nNormal: " + DiffCalc.CalculateDiff(songData.get(meta.songName)[1]) + "\nHard: " + DiffCalc.CalculateDiff(songData.get(meta.songName)[2]) + "\n\n";
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//trace("\n" + diffList);
|
//trace("\n" + diffList);
|
||||||
|
@ -6,6 +6,9 @@ class KadeEngineData
|
|||||||
{
|
{
|
||||||
public static function initSave()
|
public static function initSave()
|
||||||
{
|
{
|
||||||
|
if (FlxG.save.data.weekUnlocked == null)
|
||||||
|
FlxG.save.data.weekUnlocked = 7;
|
||||||
|
|
||||||
if (FlxG.save.data.newInput == null)
|
if (FlxG.save.data.newInput == null)
|
||||||
FlxG.save.data.newInput = true;
|
FlxG.save.data.newInput = true;
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ class Note extends FlxSprite
|
|||||||
|
|
||||||
x -= width / 2;
|
x -= width / 2;
|
||||||
|
|
||||||
if (PlayState.curStage.startsWith('school'))
|
if (noteTypeCheck == 'pixel')
|
||||||
x += 30;
|
x += 30;
|
||||||
|
|
||||||
if (prevNote.isSustainNote)
|
if (prevNote.isSustainNote)
|
||||||
|
@ -698,3 +698,127 @@ class CamZoomOption extends Option
|
|||||||
return "Camera Zoom " + (!FlxG.save.data.camzoom ? "off" : "on");
|
return "Camera Zoom " + (!FlxG.save.data.camzoom ? "off" : "on");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class LockWeeksOption extends Option
|
||||||
|
{
|
||||||
|
var confirm:Bool = false;
|
||||||
|
|
||||||
|
public function new(desc:String)
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
description = desc;
|
||||||
|
}
|
||||||
|
public override function press():Bool
|
||||||
|
{
|
||||||
|
if(!confirm)
|
||||||
|
{
|
||||||
|
confirm = true;
|
||||||
|
display = updateDisplay();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
FlxG.save.data.weekUnlocked = 1;
|
||||||
|
StoryMenuState.weekUnlocked = [true, true];
|
||||||
|
trace('Weeks Locked');
|
||||||
|
display = updateDisplay();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private override function updateDisplay():String
|
||||||
|
{
|
||||||
|
return confirm ? "Confirm Story Reset" : "Reset Story Progress";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ResetScoreOption extends Option
|
||||||
|
{
|
||||||
|
var confirm:Bool = false;
|
||||||
|
|
||||||
|
public function new(desc:String)
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
description = desc;
|
||||||
|
}
|
||||||
|
public override function press():Bool
|
||||||
|
{
|
||||||
|
if(!confirm)
|
||||||
|
{
|
||||||
|
confirm = true;
|
||||||
|
display = updateDisplay();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
FlxG.save.data.songScores = null;
|
||||||
|
for(key in Highscore.songScores.keys())
|
||||||
|
{
|
||||||
|
Highscore.songScores[key] = 0;
|
||||||
|
}
|
||||||
|
FlxG.save.data.songCombos = null;
|
||||||
|
for(key in Highscore.songCombos.keys())
|
||||||
|
{
|
||||||
|
Highscore.songCombos[key] = '';
|
||||||
|
}
|
||||||
|
confirm = false;
|
||||||
|
trace('Highscores Wiped');
|
||||||
|
display = updateDisplay();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private override function updateDisplay():String
|
||||||
|
{
|
||||||
|
return confirm ? "Confirm Score Reset" : "Reset Score";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ResetSettings extends Option
|
||||||
|
{
|
||||||
|
var confirm:Bool = false;
|
||||||
|
|
||||||
|
public function new(desc:String)
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
description = desc;
|
||||||
|
}
|
||||||
|
public override function press():Bool
|
||||||
|
{
|
||||||
|
if(!confirm)
|
||||||
|
{
|
||||||
|
confirm = true;
|
||||||
|
display = updateDisplay();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
FlxG.save.data.weekUnlocked = null;
|
||||||
|
FlxG.save.data.newInput = null;
|
||||||
|
FlxG.save.data.downscroll = null;
|
||||||
|
FlxG.save.data.dfjk = null;
|
||||||
|
FlxG.save.data.accuracyDisplay = null;
|
||||||
|
FlxG.save.data.offset = null;
|
||||||
|
FlxG.save.data.songPosition = null;
|
||||||
|
FlxG.save.data.fps = null;
|
||||||
|
FlxG.save.data.changedHit = null;
|
||||||
|
FlxG.save.data.fpsRain = null;
|
||||||
|
FlxG.save.data.fpsCap = null;
|
||||||
|
FlxG.save.data.scrollSpeed = null;
|
||||||
|
FlxG.save.data.npsDisplay = null;
|
||||||
|
FlxG.save.data.frames = null;
|
||||||
|
FlxG.save.data.accuracyMod = null;
|
||||||
|
FlxG.save.data.watermark = null;
|
||||||
|
FlxG.save.data.ghost = null;
|
||||||
|
FlxG.save.data.distractions = null;
|
||||||
|
FlxG.save.data.flashing = null;
|
||||||
|
FlxG.save.data.resetButton = null;
|
||||||
|
FlxG.save.data.botplay = null;
|
||||||
|
FlxG.save.data.cpuStrums = null;
|
||||||
|
FlxG.save.data.strumline = null;
|
||||||
|
FlxG.save.data.customStrumLine = null;
|
||||||
|
FlxG.save.data.camzoom = null;
|
||||||
|
KadeEngineData.initSave();
|
||||||
|
confirm = false;
|
||||||
|
trace('All settings have been reset');
|
||||||
|
display = updateDisplay();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private override function updateDisplay():String
|
||||||
|
{
|
||||||
|
return confirm ? "Confirm Settings Reset" : "Reset Settings";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -61,7 +61,13 @@ class OptionsMenu extends MusicBeatState
|
|||||||
new ScoreScreen("Show the score screen after the end of a song"),
|
new ScoreScreen("Show the score screen after the end of a song"),
|
||||||
new ShowInput("Display every single input in the score screen."),
|
new ShowInput("Display every single input in the score screen."),
|
||||||
new Optimization("No backgrounds, no characters, centered notes, no player 2."),
|
new Optimization("No backgrounds, no characters, centered notes, no player 2."),
|
||||||
new BotPlay("Showcase your charts and mods with autoplay."),
|
new BotPlay("Showcase your charts and mods with autoplay.")
|
||||||
|
]),
|
||||||
|
|
||||||
|
new OptionCategory("Manage Save Data", [
|
||||||
|
new ResetScoreOption("Reset your score on all songs and weeks."),
|
||||||
|
new LockWeeksOption("Reset your storymode progress. (only Tutorial + Week 1 will be unlocked)"),
|
||||||
|
new ResetSettings("Reset ALL your settings.")
|
||||||
])
|
])
|
||||||
|
|
||||||
];
|
];
|
||||||
|
@ -2788,17 +2788,13 @@ class PlayState extends MusicBeatState
|
|||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
|
|
||||||
// if ()
|
|
||||||
StoryMenuState.weekUnlocked[Std.int(Math.min(storyWeek + 1, StoryMenuState.weekUnlocked.length - 1))] = true;
|
|
||||||
|
|
||||||
if (SONG.validScore)
|
if (SONG.validScore)
|
||||||
{
|
{
|
||||||
NGio.unlockMedal(60961);
|
NGio.unlockMedal(60961);
|
||||||
Highscore.saveWeekScore(storyWeek, campaignScore, storyDifficulty);
|
Highscore.saveWeekScore(storyWeek, campaignScore, storyDifficulty);
|
||||||
}
|
}
|
||||||
|
|
||||||
FlxG.save.data.weekUnlocked = StoryMenuState.weekUnlocked;
|
StoryMenuState.unlockNextWeek(storyWeek);
|
||||||
FlxG.save.flush();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -24,7 +24,9 @@ class StoryMenuState extends MusicBeatState
|
|||||||
{
|
{
|
||||||
var scoreText:FlxText;
|
var scoreText:FlxText;
|
||||||
|
|
||||||
var weekData:Array<Dynamic> = [
|
static function weekData():Array<Dynamic>
|
||||||
|
{
|
||||||
|
return [
|
||||||
['Tutorial'],
|
['Tutorial'],
|
||||||
['Bopeebo', 'Fresh', 'Dad Battle'],
|
['Bopeebo', 'Fresh', 'Dad Battle'],
|
||||||
['Spookeez', 'South', "Monster"],
|
['Spookeez', 'South', "Monster"],
|
||||||
@ -33,9 +35,10 @@ class StoryMenuState extends MusicBeatState
|
|||||||
['Cocoa', 'Eggnog', 'Winter Horrorland'],
|
['Cocoa', 'Eggnog', 'Winter Horrorland'],
|
||||||
['Senpai', 'Roses', 'Thorns']
|
['Senpai', 'Roses', 'Thorns']
|
||||||
];
|
];
|
||||||
|
}
|
||||||
var curDifficulty:Int = 1;
|
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> = [
|
var weekCharacters:Array<Dynamic> = [
|
||||||
['', 'bf', 'gf'],
|
['', 'bf', 'gf'],
|
||||||
@ -73,8 +76,21 @@ class StoryMenuState extends MusicBeatState
|
|||||||
var leftArrow:FlxSprite;
|
var leftArrow:FlxSprite;
|
||||||
var rightArrow: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()
|
override function create()
|
||||||
{
|
{
|
||||||
|
weekUnlocked = unlockWeeks();
|
||||||
|
|
||||||
#if windows
|
#if windows
|
||||||
// Updating Discord Rich Presence
|
// Updating Discord Rich Presence
|
||||||
DiscordClient.changePresence("In the Story Mode Menu", null);
|
DiscordClient.changePresence("In the Story Mode Menu", null);
|
||||||
@ -120,7 +136,7 @@ class StoryMenuState extends MusicBeatState
|
|||||||
|
|
||||||
trace("Line 70");
|
trace("Line 70");
|
||||||
|
|
||||||
for (i in 0...weekData.length)
|
for (i in 0...weekData().length)
|
||||||
{
|
{
|
||||||
var weekThing:MenuItem = new MenuItem(0, yellowBG.y + yellowBG.height + 10, i);
|
var weekThing:MenuItem = new MenuItem(0, yellowBG.y + yellowBG.height + 10, i);
|
||||||
weekThing.y += ((weekThing.height + 20) * i);
|
weekThing.y += ((weekThing.height + 20) * i);
|
||||||
@ -134,6 +150,7 @@ class StoryMenuState extends MusicBeatState
|
|||||||
// Needs an offset thingie
|
// Needs an offset thingie
|
||||||
if (!weekUnlocked[i])
|
if (!weekUnlocked[i])
|
||||||
{
|
{
|
||||||
|
trace('locking week ' + i);
|
||||||
var lock:FlxSprite = new FlxSprite(weekThing.width + 10 + weekThing.x);
|
var lock:FlxSprite = new FlxSprite(weekThing.width + 10 + weekThing.x);
|
||||||
lock.frames = ui_tex;
|
lock.frames = ui_tex;
|
||||||
lock.animation.addByPrefix('lock', 'lock');
|
lock.animation.addByPrefix('lock', 'lock');
|
||||||
@ -314,7 +331,7 @@ class StoryMenuState extends MusicBeatState
|
|||||||
stopspamming = true;
|
stopspamming = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayState.storyPlaylist = weekData[curWeek];
|
PlayState.storyPlaylist = weekData()[curWeek];
|
||||||
PlayState.isStoryMode = true;
|
PlayState.isStoryMode = true;
|
||||||
selectedWeek = true;
|
selectedWeek = true;
|
||||||
|
|
||||||
@ -388,10 +405,10 @@ class StoryMenuState extends MusicBeatState
|
|||||||
{
|
{
|
||||||
curWeek += change;
|
curWeek += change;
|
||||||
|
|
||||||
if (curWeek >= weekData.length)
|
if (curWeek >= weekData().length)
|
||||||
curWeek = 0;
|
curWeek = 0;
|
||||||
if (curWeek < 0)
|
if (curWeek < 0)
|
||||||
curWeek = weekData.length - 1;
|
curWeek = weekData().length - 1;
|
||||||
|
|
||||||
var bullShit:Int = 0;
|
var bullShit:Int = 0;
|
||||||
|
|
||||||
@ -417,7 +434,7 @@ class StoryMenuState extends MusicBeatState
|
|||||||
grpWeekCharacters.members[2].setCharacter(weekCharacters[curWeek][2]);
|
grpWeekCharacters.members[2].setCharacter(weekCharacters[curWeek][2]);
|
||||||
|
|
||||||
txtTracklist.text = "Tracks\n";
|
txtTracklist.text = "Tracks\n";
|
||||||
var stringThing:Array<String> = weekData[curWeek];
|
var stringThing:Array<String> = weekData()[curWeek];
|
||||||
|
|
||||||
for (i in stringThing)
|
for (i in stringThing)
|
||||||
txtTracklist.text += "\n" + i;
|
txtTracklist.text += "\n" + i;
|
||||||
@ -433,4 +450,16 @@ class StoryMenuState extends MusicBeatState
|
|||||||
intendedScore = Highscore.getWeekScore(curWeek, curDifficulty);
|
intendedScore = Highscore.getWeekScore(curWeek, curDifficulty);
|
||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function unlockNextWeek(week:Int):Void
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,20 +102,6 @@ class TitleState extends MusicBeatState
|
|||||||
|
|
||||||
Highscore.load();
|
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
|
#if FREEPLAY
|
||||||
FlxG.switchState(new FreeplayState());
|
FlxG.switchState(new FreeplayState());
|
||||||
#elseif CHARTING
|
#elseif CHARTING
|
||||||
|
Loading…
x
Reference in New Issue
Block a user