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

View file

@ -42,11 +42,11 @@ class FreeplayScore extends FlxTypedSpriteGroup<ScoreNum>
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);
for (i in 0...7)
for (i in 0...digitCount)
{
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);
}, 0);
fp = new FreeplayScore(460, 60, 100);
fp = new FreeplayScore(460, 60, 7, 100);
fp.visible = false;
add(fp);

View file

@ -1,5 +1,6 @@
package funkin.util;
import funkin.util.tools.MapTools;
import haxe.DynamicAccess;
/**
@ -26,6 +27,18 @@ class StructureUtil
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.
* Performs a DEEP clone, where child structures are also merged recursively.
@ -38,6 +51,17 @@ class StructureUtil
if (a == null) return b;
if (b == null) return null;
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);

View file

@ -33,6 +33,18 @@ class MapTools
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.
*/