mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-01-27 07:17:20 +00:00
quick and dirty new highscore check
This commit is contained in:
parent
84b5c9e0fd
commit
4eb1b5bb78
|
@ -10,7 +10,7 @@ class Highscore
|
|||
|
||||
public static var tallies:Tallies = new Tallies();
|
||||
|
||||
public static function saveScore(song:String, score:Int = 0, ?diff:Int = 0):Void
|
||||
public static function saveScore(song:String, score:Int = 0, ?diff:Int = 0):Bool
|
||||
{
|
||||
var formattedSong:String = formatSong(song, diff);
|
||||
|
||||
|
@ -21,10 +21,16 @@ class Highscore
|
|||
if (songScores.exists(formattedSong))
|
||||
{
|
||||
if (songScores.get(formattedSong) < score)
|
||||
{
|
||||
setScore(formattedSong, score);
|
||||
return true;
|
||||
// new highscore
|
||||
}
|
||||
}
|
||||
else
|
||||
setScore(formattedSong, score);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function saveWeekScore(week:Int = 1, score:Int = 0, ?diff:Int = 0):Void
|
||||
|
@ -114,7 +120,8 @@ abstract Tallies(RawTallies)
|
|||
good: 0,
|
||||
sick: 0,
|
||||
totalNotes: 0,
|
||||
maxCombo: 0
|
||||
maxCombo: 0,
|
||||
isNewHighscore: false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -133,6 +140,7 @@ typedef RawTallies =
|
|||
var good:Int;
|
||||
var sick:Int;
|
||||
var maxCombo:Int;
|
||||
var isNewHighscore:Bool;
|
||||
|
||||
/**
|
||||
* How many notes total that you hit. (NOT how many notes total in the song!)
|
||||
|
|
|
@ -1360,7 +1360,8 @@ class PlayState extends MusicBeatState implements IHook
|
|||
vocals.volume = 0;
|
||||
if (currentSong.validScore)
|
||||
{
|
||||
Highscore.saveScore(currentSong.song, songScore, storyDifficulty);
|
||||
// crackhead double thingie, sets whether was new highscore, AND saves the song!
|
||||
Highscore.tallies.isNewHighscore = Highscore.saveScore(currentSong.song, songScore, storyDifficulty);
|
||||
}
|
||||
|
||||
if (isStoryMode)
|
||||
|
|
|
@ -178,6 +178,9 @@ class ResultState extends MusicBeatSubstate
|
|||
});
|
||||
});
|
||||
|
||||
if (Highscore.tallies.isNewHighscore)
|
||||
trace("ITS A NEW HIGHSCORE!!!");
|
||||
|
||||
super.create();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue