diff --git a/source/funkin/play/ResultState.hx b/source/funkin/play/ResultState.hx index 3ae8ad138..1dfc09114 100644 --- a/source/funkin/play/ResultState.hx +++ b/source/funkin/play/ResultState.hx @@ -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"); diff --git a/source/funkin/ui/freeplay/FreeplayScore.hx b/source/funkin/ui/freeplay/FreeplayScore.hx index 413b182e0..da4c9f5d4 100644 --- a/source/funkin/ui/freeplay/FreeplayScore.hx +++ b/source/funkin/ui/freeplay/FreeplayScore.hx @@ -42,11 +42,11 @@ class FreeplayScore extends FlxTypedSpriteGroup 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)); } diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index 66c829e11..10a582728 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -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); diff --git a/source/funkin/util/StructureUtil.hx b/source/funkin/util/StructureUtil.hx index 351d0e0a8..92d4e61fb 100644 --- a/source/funkin/util/StructureUtil.hx +++ b/source/funkin/util/StructureUtil.hx @@ -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 + { + var result:haxe.ds.Map = []; + + 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 = Reflect.copy(a); diff --git a/source/funkin/util/tools/MapTools.hx b/source/funkin/util/tools/MapTools.hx index 1399fb791..029ea4978 100644 --- a/source/funkin/util/tools/MapTools.hx +++ b/source/funkin/util/tools/MapTools.hx @@ -33,6 +33,18 @@ class MapTools return map.copy(); } + public static function merge(a:Map, b:Map):Map + { + 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. */