More results screen changes

This commit is contained in:
EliteMasterEric 2024-04-03 04:52:12 -04:00
parent f7141e7096
commit e9d8546737
5 changed files with 44 additions and 8 deletions

View file

@ -11,6 +11,7 @@ import flixel.math.FlxPoint;
import funkin.ui.MusicBeatSubState; import funkin.ui.MusicBeatSubState;
import flixel.math.FlxRect; import flixel.math.FlxRect;
import flixel.text.FlxBitmapText; import flixel.text.FlxBitmapText;
import funkin.ui.freeplay.FreeplayScore;
import flixel.tweens.FlxEase; import flixel.tweens.FlxEase;
import funkin.ui.freeplay.FreeplayState; import funkin.ui.freeplay.FreeplayState;
import flixel.tweens.FlxTween; import flixel.tweens.FlxTween;
@ -188,7 +189,7 @@ class ResultState extends MusicBeatSubState
scorePopin.visible = false; scorePopin.visible = false;
add(scorePopin); add(scorePopin);
var highscoreNew:FlxSprite = new FlxSprite(280, 580); var highscoreNew:FlxSprite = new FlxSprite(310, 570);
highscoreNew.frames = Paths.getSparrowAtlas("resultScreen/highscoreNew"); highscoreNew.frames = Paths.getSparrowAtlas("resultScreen/highscoreNew");
highscoreNew.animation.addByPrefix("new", "NEW HIGHSCORE", 24); highscoreNew.animation.addByPrefix("new", "NEW HIGHSCORE", 24);
highscoreNew.visible = false; highscoreNew.visible = false;
@ -228,9 +229,8 @@ class ResultState extends MusicBeatSubState
var tallyMissed:TallyCounter = new TallyCounter(260, (hStuf * 9) + extraYOffset, params.scoreData.tallies.missed, 0xFFC68AE6); var tallyMissed:TallyCounter = new TallyCounter(260, (hStuf * 9) + extraYOffset, params.scoreData.tallies.missed, 0xFFC68AE6);
ratingGrp.add(tallyMissed); ratingGrp.add(tallyMissed);
var score:TallyCounter = new TallyCounter(825, 630, params.scoreData.score, RIGHT); var score:FreeplayScore = new FreeplayScore(825, 630, 10, params.scoreData.score);
score.scale.set(2, 2); add(score);
ratingGrp.add(score);
for (ind => rating in ratingGrp.members) for (ind => rating in ratingGrp.members)
{ {
@ -249,7 +249,7 @@ class ResultState extends MusicBeatSubState
scorePopin.animation.play("score"); scorePopin.animation.play("score");
scorePopin.visible = true; scorePopin.visible = true;
if (params.isNewHighscore) if (params.isNewHighscore || true)
{ {
highscoreNew.visible = true; highscoreNew.visible = true;
highscoreNew.animation.play("new"); highscoreNew.animation.play("new");

View file

@ -42,11 +42,11 @@ class FreeplayScore extends FlxTypedSpriteGroup<ScoreNum>
return val; return val;
} }
public function new(x:Float, y:Float, scoreShit:Int = 100) public function new(x:Float, y:Float, digitCount:Int, scoreShit:Int = 100)
{ {
super(x, y); super(x, y);
for (i in 0...7) for (i in 0...digitCount)
{ {
add(new ScoreNum(x + (45 * i), y, 0)); add(new ScoreNum(x + (45 * i), y, 0));
} }

View file

@ -425,7 +425,7 @@ class FreeplayState extends MusicBeatSubState
tmr.time = FlxG.random.float(20, 60); tmr.time = FlxG.random.float(20, 60);
}, 0); }, 0);
fp = new FreeplayScore(460, 60, 100); fp = new FreeplayScore(460, 60, 7, 100);
fp.visible = false; fp.visible = false;
add(fp); add(fp);

View file

@ -1,5 +1,6 @@
package funkin.util; package funkin.util;
import funkin.util.tools.MapTools;
import haxe.DynamicAccess; import haxe.DynamicAccess;
/** /**
@ -26,6 +27,18 @@ class StructureUtil
return result; return result;
} }
public static function toMap(a:Dynamic):haxe.ds.Map<String, Dynamic>
{
var result:haxe.ds.Map<String, Dynamic> = [];
for (field in Reflect.fields(a))
{
result.set(field, Reflect.field(a, field));
}
return result;
}
/** /**
* Merge two structures, with the second overwriting the first. * Merge two structures, with the second overwriting the first.
* Performs a DEEP clone, where child structures are also merged recursively. * Performs a DEEP clone, where child structures are also merged recursively.
@ -38,6 +51,17 @@ class StructureUtil
if (a == null) return b; if (a == null) return b;
if (b == null) return null; if (b == null) return null;
if (!Reflect.isObject(a) || !Reflect.isObject(b)) return b; if (!Reflect.isObject(a) || !Reflect.isObject(b)) return b;
if (Std.isOfType(b, haxe.ds.StringMap))
{
if (Std.isOfType(a, haxe.ds.StringMap))
{
return MapTools.merge(a, b);
}
else
{
return StructureUtil.toMap(a).merge(b);
}
}
var result:DynamicAccess<Dynamic> = Reflect.copy(a); var result:DynamicAccess<Dynamic> = Reflect.copy(a);

View file

@ -33,6 +33,18 @@ class MapTools
return map.copy(); return map.copy();
} }
public static function merge<K, T>(a:Map<K, T>, b:Map<K, T>):Map<K, T>
{
var result = a.copy();
for (pair in b.keyValueIterator())
{
result.set(pair.key, pair.value);
}
return result;
}
/** /**
* Create a new array with clones of all elements of the given array, to prevent modifying the original. * Create a new array with clones of all elements of the given array, to prevent modifying the original.
*/ */