Merge remote-tracking branch 'upstream/master' into patch-2
This commit is contained in:
commit
a73eff96ac
@ -26,9 +26,11 @@ class FreeplayState extends MusicBeatState
|
|||||||
var curDifficulty:Int = 1;
|
var curDifficulty:Int = 1;
|
||||||
|
|
||||||
var scoreText:FlxText;
|
var scoreText:FlxText;
|
||||||
|
var comboText:FlxText;
|
||||||
var diffText:FlxText;
|
var diffText:FlxText;
|
||||||
var lerpScore:Int = 0;
|
var lerpScore:Int = 0;
|
||||||
var intendedScore:Int = 0;
|
var intendedScore:Int = 0;
|
||||||
|
var combo:String = '';
|
||||||
|
|
||||||
private var grpSongs:FlxTypedGroup<Alphabet>;
|
private var grpSongs:FlxTypedGroup<Alphabet>;
|
||||||
private var curPlaying:Bool = false;
|
private var curPlaying:Bool = false;
|
||||||
@ -106,6 +108,10 @@ class FreeplayState extends MusicBeatState
|
|||||||
diffText.font = scoreText.font;
|
diffText.font = scoreText.font;
|
||||||
add(diffText);
|
add(diffText);
|
||||||
|
|
||||||
|
comboText = new FlxText(diffText.x + 100, diffText.y, 0, "", 24);
|
||||||
|
comboText.font = diffText.font;
|
||||||
|
add(comboText);
|
||||||
|
|
||||||
add(scoreText);
|
add(scoreText);
|
||||||
|
|
||||||
changeSelection();
|
changeSelection();
|
||||||
@ -176,6 +182,7 @@ class FreeplayState extends MusicBeatState
|
|||||||
lerpScore = intendedScore;
|
lerpScore = intendedScore;
|
||||||
|
|
||||||
scoreText.text = "PERSONAL BEST:" + lerpScore;
|
scoreText.text = "PERSONAL BEST:" + lerpScore;
|
||||||
|
comboText.text = combo + '\n';
|
||||||
|
|
||||||
var upP = controls.UP_P;
|
var upP = controls.UP_P;
|
||||||
var downP = controls.DOWN_P;
|
var downP = controls.DOWN_P;
|
||||||
@ -242,6 +249,7 @@ class FreeplayState extends MusicBeatState
|
|||||||
|
|
||||||
#if !switch
|
#if !switch
|
||||||
intendedScore = Highscore.getScore(songHighscore, curDifficulty);
|
intendedScore = Highscore.getScore(songHighscore, curDifficulty);
|
||||||
|
combo = Highscore.getCombo(songHighscore, curDifficulty);
|
||||||
#end
|
#end
|
||||||
|
|
||||||
diffText.text = CoolUtil.difficultyFromInt(curDifficulty).toUpperCase();
|
diffText.text = CoolUtil.difficultyFromInt(curDifficulty).toUpperCase();
|
||||||
@ -275,6 +283,7 @@ class FreeplayState extends MusicBeatState
|
|||||||
|
|
||||||
#if !switch
|
#if !switch
|
||||||
intendedScore = Highscore.getScore(songHighscore, curDifficulty);
|
intendedScore = Highscore.getScore(songHighscore, curDifficulty);
|
||||||
|
combo = Highscore.getCombo(songHighscore, curDifficulty);
|
||||||
// lerpScore = 0;
|
// lerpScore = 0;
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
@ -2,12 +2,15 @@ package;
|
|||||||
|
|
||||||
import flixel.FlxG;
|
import flixel.FlxG;
|
||||||
|
|
||||||
|
using StringTools;
|
||||||
class Highscore
|
class Highscore
|
||||||
{
|
{
|
||||||
#if (haxe >= "4.0.0")
|
#if (haxe >= "4.0.0")
|
||||||
public static var songScores:Map<String, Int> = new Map();
|
public static var songScores:Map<String, Int> = new Map();
|
||||||
|
public static var songCombos:Map<String, String> = new Map();
|
||||||
#else
|
#else
|
||||||
public static var songScores:Map<String, Int> = new Map<String, Int>();
|
public static var songScores:Map<String, Int> = new Map<String, Int>();
|
||||||
|
public static var songCombos:Map<String, Int> = new Map<String, String>();
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
|
||||||
@ -32,6 +35,23 @@ class Highscore
|
|||||||
}else trace('BotPlay detected. Score saving is disabled.');
|
}else trace('BotPlay detected. Score saving is disabled.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function saveCombo(song:String, combo:String, ?diff:Int = 0):Void
|
||||||
|
{
|
||||||
|
var daSong:String = formatSong(song, diff);
|
||||||
|
var finalCombo:String = combo.split(')')[0].replace('(', '');
|
||||||
|
|
||||||
|
if(!FlxG.save.data.botplay)
|
||||||
|
{
|
||||||
|
if (songCombos.exists(daSong))
|
||||||
|
{
|
||||||
|
if (getComboInt(songCombos.get(daSong)) < getComboInt(finalCombo))
|
||||||
|
setCombo(daSong, finalCombo);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
setCombo(daSong, finalCombo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static function saveWeekScore(week:Int = 1, score:Int = 0, ?diff:Int = 0):Void
|
public static function saveWeekScore(week:Int = 1, score:Int = 0, ?diff:Int = 0):Void
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -64,6 +84,14 @@ class Highscore
|
|||||||
FlxG.save.flush();
|
FlxG.save.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static function setCombo(song:String, combo:String):Void
|
||||||
|
{
|
||||||
|
// Reminder that I don't need to format this song, it should come formatted!
|
||||||
|
songCombos.set(song, combo);
|
||||||
|
FlxG.save.data.songCombos = songCombos;
|
||||||
|
FlxG.save.flush();
|
||||||
|
}
|
||||||
|
|
||||||
public static function formatSong(song:String, diff:Int):String
|
public static function formatSong(song:String, diff:Int):String
|
||||||
{
|
{
|
||||||
var daSong:String = song;
|
var daSong:String = song;
|
||||||
@ -76,6 +104,23 @@ class Highscore
|
|||||||
return daSong;
|
return daSong;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static function getComboInt(combo:String):Int
|
||||||
|
{
|
||||||
|
switch(combo)
|
||||||
|
{
|
||||||
|
case 'SDCB':
|
||||||
|
return 1;
|
||||||
|
case 'FC':
|
||||||
|
return 2;
|
||||||
|
case 'GFC':
|
||||||
|
return 3;
|
||||||
|
case 'MFC':
|
||||||
|
return 4;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static function getScore(song:String, diff:Int):Int
|
public static function getScore(song:String, diff:Int):Int
|
||||||
{
|
{
|
||||||
if (!songScores.exists(formatSong(song, diff)))
|
if (!songScores.exists(formatSong(song, diff)))
|
||||||
@ -84,6 +129,14 @@ class Highscore
|
|||||||
return songScores.get(formatSong(song, diff));
|
return songScores.get(formatSong(song, diff));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getCombo(song:String, diff:Int):String
|
||||||
|
{
|
||||||
|
if (!songCombos.exists(formatSong(song, diff)))
|
||||||
|
setCombo(formatSong(song, diff), '');
|
||||||
|
|
||||||
|
return songCombos.get(formatSong(song, diff));
|
||||||
|
}
|
||||||
|
|
||||||
public static function getWeekScore(week:Int, diff:Int):Int
|
public static function getWeekScore(week:Int, diff:Int):Int
|
||||||
{
|
{
|
||||||
if (!songScores.exists(formatSong('week' + week, diff)))
|
if (!songScores.exists(formatSong('week' + week, diff)))
|
||||||
@ -98,5 +151,9 @@ class Highscore
|
|||||||
{
|
{
|
||||||
songScores = FlxG.save.data.songScores;
|
songScores = FlxG.save.data.songScores;
|
||||||
}
|
}
|
||||||
|
if (FlxG.save.data.songCombos != null)
|
||||||
|
{
|
||||||
|
songCombos = FlxG.save.data.songCombos;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -129,14 +129,17 @@ class OptionsMenu extends MusicBeatState
|
|||||||
isCat = false;
|
isCat = false;
|
||||||
grpControls.clear();
|
grpControls.clear();
|
||||||
for (i in 0...options.length)
|
for (i in 0...options.length)
|
||||||
{
|
{
|
||||||
var controlLabel:Alphabet = new Alphabet(0, (70 * i) + 30, options[i].getName(), true, false);
|
var controlLabel:Alphabet = new Alphabet(0, (70 * i) + 30, options[i].getName(), true, false);
|
||||||
controlLabel.isMenuItem = true;
|
controlLabel.isMenuItem = true;
|
||||||
controlLabel.targetY = i;
|
controlLabel.targetY = i;
|
||||||
grpControls.add(controlLabel);
|
grpControls.add(controlLabel);
|
||||||
// DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !!
|
// DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !!
|
||||||
}
|
}
|
||||||
|
|
||||||
curSelected = 0;
|
curSelected = 0;
|
||||||
|
|
||||||
|
changeSelection(curSelected);
|
||||||
}
|
}
|
||||||
if (controls.UP_P)
|
if (controls.UP_P)
|
||||||
changeSelection(-1);
|
changeSelection(-1);
|
||||||
@ -145,7 +148,6 @@ class OptionsMenu extends MusicBeatState
|
|||||||
|
|
||||||
if (isCat)
|
if (isCat)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (currentSelectedCat.getOptions()[curSelected].getAccept())
|
if (currentSelectedCat.getOptions()[curSelected].getAccept())
|
||||||
{
|
{
|
||||||
if (FlxG.keys.pressed.SHIFT)
|
if (FlxG.keys.pressed.SHIFT)
|
||||||
@ -165,7 +167,6 @@ class OptionsMenu extends MusicBeatState
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
if (FlxG.keys.pressed.SHIFT)
|
if (FlxG.keys.pressed.SHIFT)
|
||||||
{
|
{
|
||||||
if (FlxG.keys.justPressed.RIGHT)
|
if (FlxG.keys.justPressed.RIGHT)
|
||||||
@ -178,7 +179,7 @@ class OptionsMenu extends MusicBeatState
|
|||||||
else if (FlxG.keys.pressed.LEFT)
|
else if (FlxG.keys.pressed.LEFT)
|
||||||
FlxG.save.data.offset -= 0.1;
|
FlxG.save.data.offset -= 0.1;
|
||||||
|
|
||||||
|
versionShit.text = "Offset (Left, Right, Shift for slow): " + HelperFunctions.truncateFloat(FlxG.save.data.offset,2) + " - Description - " + currentDescription;
|
||||||
}
|
}
|
||||||
if (currentSelectedCat.getOptions()[curSelected].getAccept())
|
if (currentSelectedCat.getOptions()[curSelected].getAccept())
|
||||||
versionShit.text = currentSelectedCat.getOptions()[curSelected].getValue() + " - Description - " + currentDescription;
|
versionShit.text = currentSelectedCat.getOptions()[curSelected].getValue() + " - Description - " + currentDescription;
|
||||||
@ -188,16 +189,18 @@ class OptionsMenu extends MusicBeatState
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (FlxG.keys.pressed.SHIFT)
|
if (FlxG.keys.pressed.SHIFT)
|
||||||
{
|
{
|
||||||
if (FlxG.keys.justPressed.RIGHT)
|
if (FlxG.keys.justPressed.RIGHT)
|
||||||
FlxG.save.data.offset += 0.1;
|
|
||||||
else if (FlxG.keys.justPressed.LEFT)
|
|
||||||
FlxG.save.data.offset -= 0.1;
|
|
||||||
}
|
|
||||||
else if (FlxG.keys.pressed.RIGHT)
|
|
||||||
FlxG.save.data.offset += 0.1;
|
FlxG.save.data.offset += 0.1;
|
||||||
else if (FlxG.keys.pressed.LEFT)
|
else if (FlxG.keys.justPressed.LEFT)
|
||||||
FlxG.save.data.offset -= 0.1;
|
FlxG.save.data.offset -= 0.1;
|
||||||
|
}
|
||||||
|
else if (FlxG.keys.pressed.RIGHT)
|
||||||
|
FlxG.save.data.offset += 0.1;
|
||||||
|
else if (FlxG.keys.pressed.LEFT)
|
||||||
|
FlxG.save.data.offset -= 0.1;
|
||||||
|
|
||||||
|
versionShit.text = "Offset (Left, Right, Shift for slow): " + HelperFunctions.truncateFloat(FlxG.save.data.offset,2) + " - Description - " + currentDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -230,6 +233,8 @@ class OptionsMenu extends MusicBeatState
|
|||||||
}
|
}
|
||||||
curSelected = 0;
|
curSelected = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
changeSelection(curSelected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FlxG.save.flush();
|
FlxG.save.flush();
|
||||||
|
@ -1862,9 +1862,7 @@ class PlayState extends MusicBeatState
|
|||||||
|
|
||||||
super.update(elapsed);
|
super.update(elapsed);
|
||||||
|
|
||||||
scoreTxt.text = Ratings.CalculateRanking(songScore,songScoreDef,nps,maxNPS,accuracy);
|
scoreTxt.text = Ratings.CalculateRanking(songScore,songScoreDef,nps,maxNPS,accuracy);
|
||||||
if (!FlxG.save.data.accuracyDisplay)
|
|
||||||
scoreTxt.text = "Score: " + songScore;
|
|
||||||
|
|
||||||
if (FlxG.keys.justPressed.ENTER && startedCountdown && canPause)
|
if (FlxG.keys.justPressed.ENTER && startedCountdown && canPause)
|
||||||
{
|
{
|
||||||
@ -2533,6 +2531,7 @@ class PlayState extends MusicBeatState
|
|||||||
|
|
||||||
#if !switch
|
#if !switch
|
||||||
Highscore.saveScore(songHighscore, Math.round(songScore), storyDifficulty);
|
Highscore.saveScore(songHighscore, Math.round(songScore), storyDifficulty);
|
||||||
|
Highscore.saveCombo(songHighscore, Ratings.GenerateLetterRank(accuracy), storyDifficulty);
|
||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,11 +131,13 @@ class Ratings
|
|||||||
|
|
||||||
public static function CalculateRanking(score:Int,scoreDef:Int,nps:Int,maxNPS:Int,accuracy:Float):String
|
public static function CalculateRanking(score:Int,scoreDef:Int,nps:Int,maxNPS:Int,accuracy:Float):String
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
(FlxG.save.data.npsDisplay ? "NPS: " + nps + " (Max " + maxNPS + ")" + (!FlxG.save.data.botplay ? " | " : "") : "") + (!FlxG.save.data.botplay ? // NPS Toggle
|
(FlxG.save.data.npsDisplay ? // NPS Toggle
|
||||||
"Score:" + (Conductor.safeFrames != 10 ? score + " (" + scoreDef + ")" : "" + score) + // Score
|
"NPS: " + nps + " (Max " + maxNPS + ")" + (!FlxG.save.data.botplay ? " | " : "") : "") + // NPS
|
||||||
" | Combo Breaks:" + PlayState.misses + // Misses/Combo Breaks
|
(!FlxG.save.data.botplay ? "Score:" + (Conductor.safeFrames != 10 ? score + " (" + scoreDef + ")" : "" + score) + // Score
|
||||||
" | Accuracy:" + (FlxG.save.data.botplay ? "N/A" : HelperFunctions.truncateFloat(accuracy, 2) + " %") + // Accuracy
|
(FlxG.save.data.accuracyDisplay ? // Accuracy Toggle
|
||||||
" | " + GenerateLetterRank(accuracy) : ""); // Letter Rank
|
" | Combo Breaks:" + PlayState.misses + // Misses/Combo Breaks
|
||||||
|
" | Accuracy:" + (FlxG.save.data.botplay ? "N/A" : HelperFunctions.truncateFloat(accuracy, 2) + " %") + // Accuracy
|
||||||
|
" | " + GenerateLetterRank(accuracy) : "") : ""); // Letter Rank
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user