package funkin.play.components; import flixel.FlxSprite; import flixel.group.FlxGroup.FlxTypedGroup; import flixel.tweens.FlxTween; import flixel.util.FlxDirection; import funkin.graphics.FunkinSprite; import funkin.play.PlayState; import funkin.util.TimerUtil; import funkin.util.EaseUtil; import openfl.utils.Assets; import funkin.data.notestyle.NoteStyleRegistry; import funkin.play.notes.notestyle.NoteStyle; @:nullSafety class PopUpStuff extends FlxTypedGroup { /** * The current note style to use. This determines which graphics to display. * For example, Week 6 uses the `pixel` note style, and mods can create their own. */ var noteStyle:NoteStyle; override public function new(noteStyle:NoteStyle) { super(); this.noteStyle = noteStyle; } public function displayRating(daRating:Null) { if (daRating == null) daRating = "good"; var rating:Null = noteStyle.buildJudgementSprite(daRating); if (rating == null) return; rating.zIndex = 1000; rating.x = (FlxG.width * 0.474); rating.x -= rating.width / 2; rating.y = (FlxG.camera.height * 0.45 - 60); rating.y -= rating.height / 2; var offsets = noteStyle.getJudgementSpriteOffsets(daRating); rating.x += offsets[0]; rating.y += offsets[1]; rating.acceleration.y = 550; rating.velocity.y -= FlxG.random.int(140, 175); rating.velocity.x -= FlxG.random.int(0, 10); add(rating); var fadeEase = noteStyle.isJudgementSpritePixel(daRating) ? EaseUtil.stepped(2) : null; FlxTween.tween(rating, {alpha: 0}, 0.2, { onComplete: function(tween:FlxTween) { remove(rating, true); rating.destroy(); }, startDelay: Conductor.instance.beatLengthMs * 0.001, ease: fadeEase }); } public function displayCombo(combo:Int = 0):Void { var seperatedScore:Array = []; var tempCombo:Int = combo; while (tempCombo != 0) { seperatedScore.push(tempCombo % 10); tempCombo = Std.int(tempCombo / 10); } while (seperatedScore.length < 3) seperatedScore.push(0); // seperatedScore.reverse(); var daLoop:Int = 1; for (digit in seperatedScore) { var numScore:Null = noteStyle.buildComboNumSprite(digit); if (numScore == null) continue; numScore.x = (FlxG.width * 0.507) - (36 * daLoop) - 65; trace('numScore($daLoop) = ${numScore.x}'); numScore.y = (FlxG.camera.height * 0.44); var offsets = noteStyle.getComboNumSpriteOffsets(digit); numScore.x += offsets[0]; numScore.y += offsets[1]; numScore.acceleration.y = FlxG.random.int(250, 300); numScore.velocity.y -= FlxG.random.int(130, 150); numScore.velocity.x = FlxG.random.float(-5, 5); add(numScore); var fadeEase = noteStyle.isComboNumSpritePixel(digit) ? EaseUtil.stepped(2) : null; FlxTween.tween(numScore, {alpha: 0}, 0.2, { onComplete: function(tween:FlxTween) { remove(numScore, true); numScore.destroy(); }, startDelay: Conductor.instance.beatLengthMs * 0.002, ease: fadeEase }); daLoop++; } } }