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
|
||||
Fresh:dad:1
|
||||
Dad Battle:dad:1
|
||||
|
@ -15,8 +15,10 @@ Scroll down to Line 26, or Search (Windows/Linux: `Ctrl+F`, Mac: `Cmd+F`) for "w
|
||||
---
|
||||
|
||||
```haxe
|
||||
var weekData:Array<Dynamic> = [
|
||||
|
||||
static function weekData():Array<Dynamic>
|
||||
{
|
||||
return [
|
||||
|
||||
['Tutorial'],
|
||||
|
||||
['Bopeebo', 'Fresh', 'Dadbattle'],
|
||||
@ -30,8 +32,9 @@ var weekData:Array<Dynamic> = [
|
||||
['Cocoa', 'Eggnog', 'Winter-Horrorland'],
|
||||
|
||||
['Senpai', 'Roses', 'Thorns']
|
||||
|
||||
];
|
||||
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
@ -45,8 +48,10 @@ Example
|
||||
---
|
||||
|
||||
```haxe
|
||||
var weekData:Array<Dynamic> = [
|
||||
|
||||
static function weekData():Array<Dynamic>
|
||||
{
|
||||
return [
|
||||
|
||||
['Tutorial'],
|
||||
|
||||
['Bopeebo', 'Fresh', 'Dadbattle'],
|
||||
@ -58,12 +63,13 @@ var weekData:Array<Dynamic> = [
|
||||
['Satin-Panties', "High", "Milf"],
|
||||
|
||||
['Cocoa', 'Eggnog', 'Winter-Horrorland'],
|
||||
|
||||
|
||||
['Senpai', 'Roses', 'Thorns'],
|
||||
|
||||
['Ugh', 'Guns', 'Stress']
|
||||
|
||||
];
|
||||
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
@ -64,20 +64,22 @@ class FreeplayState extends MusicBeatState
|
||||
{
|
||||
var data:Array<String> = initSonglist[i].split(':');
|
||||
var meta = new SongMetadata(data[0], Std.parseInt(data[2]), data[1]);
|
||||
songs.push(meta);
|
||||
var format = StringTools.replace(meta.songName, " ", "-");
|
||||
switch (format) {
|
||||
case 'Dad-Battle': format = 'Dadbattle';
|
||||
case 'Philly-Nice': format = 'Philly';
|
||||
}
|
||||
if(Std.parseInt(data[2]) <= FlxG.save.data.weekUnlocked - 1)
|
||||
{
|
||||
songs.push(meta);
|
||||
var format = StringTools.replace(meta.songName, " ", "-");
|
||||
switch (format) {
|
||||
case 'Dad-Battle': format = 'Dadbattle';
|
||||
case 'Philly-Nice': format = 'Philly';
|
||||
}
|
||||
|
||||
var diffs = [];
|
||||
FreeplayState.loadDiff(0,format,meta.songName,diffs);
|
||||
FreeplayState.loadDiff(1,format,meta.songName,diffs);
|
||||
FreeplayState.loadDiff(2,format,meta.songName,diffs);
|
||||
FreeplayState.songData.set(meta.songName,diffs);
|
||||
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";
|
||||
var diffs = [];
|
||||
FreeplayState.loadDiff(0,format,meta.songName,diffs);
|
||||
FreeplayState.loadDiff(1,format,meta.songName,diffs);
|
||||
FreeplayState.loadDiff(2,format,meta.songName,diffs);
|
||||
FreeplayState.songData.set(meta.songName,diffs);
|
||||
trace('loaded diffs for ' + meta.songName);
|
||||
}
|
||||
}
|
||||
|
||||
//trace("\n" + diffList);
|
||||
|
@ -6,7 +6,10 @@ class KadeEngineData
|
||||
{
|
||||
public static function initSave()
|
||||
{
|
||||
if (FlxG.save.data.newInput == null)
|
||||
if (FlxG.save.data.weekUnlocked == null)
|
||||
FlxG.save.data.weekUnlocked = 7;
|
||||
|
||||
if (FlxG.save.data.newInput == null)
|
||||
FlxG.save.data.newInput = true;
|
||||
|
||||
if (FlxG.save.data.downscroll == null)
|
||||
|
@ -166,7 +166,7 @@ class Note extends FlxSprite
|
||||
|
||||
x -= width / 2;
|
||||
|
||||
if (PlayState.curStage.startsWith('school'))
|
||||
if (noteTypeCheck == 'pixel')
|
||||
x += 30;
|
||||
|
||||
if (prevNote.isSustainNote)
|
||||
|
@ -698,3 +698,127 @@ class CamZoomOption extends Option
|
||||
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 ShowInput("Display every single input in the score screen."),
|
||||
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
|
||||
|
||||
// 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;
|
||||
FlxG.save.flush();
|
||||
StoryMenuState.unlockNextWeek(storyWeek);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -24,18 +24,21 @@ class StoryMenuState extends MusicBeatState
|
||||
{
|
||||
var scoreText:FlxText;
|
||||
|
||||
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']
|
||||
];
|
||||
static function weekData():Array<Dynamic>
|
||||
{
|
||||
return [
|
||||
['Tutorial'],
|
||||
['Bopeebo', 'Fresh', 'Dad Battle'],
|
||||
['Spookeez', 'South', "Monster"],
|
||||
['Pico', 'Philly Nice', "Blammed"],
|
||||
['Satin Panties', "High", "Milf"],
|
||||
['Cocoa', 'Eggnog', 'Winter Horrorland'],
|
||||
['Senpai', 'Roses', 'Thorns']
|
||||
];
|
||||
}
|
||||
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'],
|
||||
@ -73,8 +76,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);
|
||||
@ -120,7 +136,7 @@ class StoryMenuState extends MusicBeatState
|
||||
|
||||
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);
|
||||
weekThing.y += ((weekThing.height + 20) * i);
|
||||
@ -134,6 +150,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');
|
||||
@ -314,7 +331,7 @@ class StoryMenuState extends MusicBeatState
|
||||
stopspamming = true;
|
||||
}
|
||||
|
||||
PlayState.storyPlaylist = weekData[curWeek];
|
||||
PlayState.storyPlaylist = weekData()[curWeek];
|
||||
PlayState.isStoryMode = true;
|
||||
selectedWeek = true;
|
||||
|
||||
@ -388,10 +405,10 @@ class StoryMenuState extends MusicBeatState
|
||||
{
|
||||
curWeek += change;
|
||||
|
||||
if (curWeek >= weekData.length)
|
||||
if (curWeek >= weekData().length)
|
||||
curWeek = 0;
|
||||
if (curWeek < 0)
|
||||
curWeek = weekData.length - 1;
|
||||
curWeek = weekData().length - 1;
|
||||
|
||||
var bullShit:Int = 0;
|
||||
|
||||
@ -417,7 +434,7 @@ class StoryMenuState extends MusicBeatState
|
||||
grpWeekCharacters.members[2].setCharacter(weekCharacters[curWeek][2]);
|
||||
|
||||
txtTracklist.text = "Tracks\n";
|
||||
var stringThing:Array<String> = weekData[curWeek];
|
||||
var stringThing:Array<String> = weekData()[curWeek];
|
||||
|
||||
for (i in stringThing)
|
||||
txtTracklist.text += "\n" + i;
|
||||
@ -433,4 +450,16 @@ class StoryMenuState extends MusicBeatState
|
||||
intendedScore = Highscore.getWeekScore(curWeek, curDifficulty);
|
||||
#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();
|
||||
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user