2022-09-20 02:16:12 -04:00
|
|
|
package funkin.play;
|
|
|
|
|
2024-04-01 21:59:53 -04:00
|
|
|
import funkin.util.MathUtil;
|
2023-06-15 00:30:20 -04:00
|
|
|
import funkin.ui.story.StoryMenuState;
|
2023-04-16 15:33:20 -04:00
|
|
|
import funkin.graphics.adobeanimate.FlxAtlasSprite;
|
2022-09-20 02:16:12 -04:00
|
|
|
import flixel.FlxSprite;
|
2024-02-22 18:55:24 -05:00
|
|
|
import funkin.graphics.FunkinSprite;
|
2024-05-31 20:17:11 -04:00
|
|
|
import flixel.effects.FlxFlicker;
|
2022-12-02 21:37:07 -05:00
|
|
|
import flixel.graphics.frames.FlxBitmapFont;
|
2022-09-22 16:21:31 -04:00
|
|
|
import flixel.group.FlxGroup.FlxTypedGroup;
|
2022-12-02 21:37:07 -05:00
|
|
|
import flixel.math.FlxPoint;
|
2023-11-07 04:04:22 -05:00
|
|
|
import funkin.ui.MusicBeatSubState;
|
2022-12-07 02:29:48 -05:00
|
|
|
import flixel.math.FlxRect;
|
2022-12-02 21:37:07 -05:00
|
|
|
import flixel.text.FlxBitmapText;
|
2024-04-03 04:52:12 -04:00
|
|
|
import funkin.ui.freeplay.FreeplayScore;
|
2024-05-10 22:09:09 -04:00
|
|
|
import flixel.text.FlxText;
|
2024-07-03 22:50:39 -04:00
|
|
|
import funkin.data.freeplay.player.PlayerRegistry;
|
|
|
|
import funkin.data.freeplay.player.PlayerData;
|
|
|
|
import funkin.ui.freeplay.charselect.PlayableCharacter;
|
2024-05-10 22:09:09 -04:00
|
|
|
import flixel.util.FlxColor;
|
2022-09-21 18:00:43 -04:00
|
|
|
import flixel.tweens.FlxEase;
|
2024-05-31 01:42:41 -04:00
|
|
|
import funkin.graphics.FunkinCamera;
|
2023-11-07 04:04:22 -05:00
|
|
|
import funkin.ui.freeplay.FreeplayState;
|
2022-09-21 18:00:43 -04:00
|
|
|
import flixel.tweens.FlxTween;
|
2024-05-31 01:42:41 -04:00
|
|
|
import flixel.addons.display.FlxBackdrop;
|
2024-03-23 23:38:07 -04:00
|
|
|
import funkin.audio.FunkinSound;
|
2022-09-21 18:00:43 -04:00
|
|
|
import flixel.util.FlxGradient;
|
|
|
|
import flixel.util.FlxTimer;
|
2024-04-01 21:59:53 -04:00
|
|
|
import funkin.save.Save;
|
2024-05-30 05:25:51 -04:00
|
|
|
import funkin.play.scoring.Scoring;
|
2024-04-01 21:59:53 -04:00
|
|
|
import funkin.save.Save.SaveScoreData;
|
2023-11-07 04:04:22 -05:00
|
|
|
import funkin.graphics.shaders.LeftMaskShader;
|
|
|
|
import funkin.play.components.TallyCounter;
|
2024-05-17 20:26:34 -04:00
|
|
|
import funkin.play.components.ClearPercentCounter;
|
2022-09-20 02:16:12 -04:00
|
|
|
|
2024-03-04 19:03:43 -05:00
|
|
|
/**
|
|
|
|
* The state for the results screen after a song or week is finished.
|
|
|
|
*/
|
2024-05-09 22:37:21 -04:00
|
|
|
@:nullSafety
|
2023-06-01 18:52:58 -04:00
|
|
|
class ResultState extends MusicBeatSubState
|
2022-09-20 02:16:12 -04:00
|
|
|
{
|
2023-10-11 17:33:55 -04:00
|
|
|
final params:ResultsStateParams;
|
|
|
|
|
2024-05-30 05:25:51 -04:00
|
|
|
final rank:ScoringRank;
|
2024-05-10 22:09:09 -04:00
|
|
|
final songName:FlxBitmapText;
|
|
|
|
final difficulty:FlxSprite;
|
2024-05-22 01:07:20 -04:00
|
|
|
final clearPercentSmall:ClearPercentCounter;
|
2023-01-22 22:25:45 -05:00
|
|
|
|
2024-05-10 22:09:09 -04:00
|
|
|
final maskShaderSongName:LeftMaskShader = new LeftMaskShader();
|
|
|
|
final maskShaderDifficulty:LeftMaskShader = new LeftMaskShader();
|
|
|
|
|
|
|
|
final resultsAnim:FunkinSprite;
|
|
|
|
final ratingsPopin:FunkinSprite;
|
|
|
|
final scorePopin:FunkinSprite;
|
|
|
|
|
|
|
|
final bgFlash:FlxSprite;
|
|
|
|
|
|
|
|
final highscoreNew:FlxSprite;
|
|
|
|
final score:ResultScore;
|
|
|
|
|
2024-07-03 22:50:39 -04:00
|
|
|
var characterAtlasAnimations:Array<
|
|
|
|
{
|
|
|
|
sprite:FlxAtlasSprite,
|
|
|
|
delay:Float
|
|
|
|
}> = [];
|
|
|
|
var characterSparrowAnimations:Array<
|
|
|
|
{
|
|
|
|
sprite:FunkinSprite,
|
|
|
|
delay:Float
|
|
|
|
}> = [];
|
2023-01-22 22:25:45 -05:00
|
|
|
|
2024-05-31 05:39:53 -04:00
|
|
|
var rankBg:FunkinSprite;
|
2024-05-31 01:42:41 -04:00
|
|
|
final cameraBG:FunkinCamera;
|
|
|
|
final cameraScroll:FunkinCamera;
|
|
|
|
final cameraEverything:FunkinCamera;
|
2024-05-31 05:39:53 -04:00
|
|
|
|
2023-10-11 17:33:55 -04:00
|
|
|
public function new(params:ResultsStateParams)
|
|
|
|
{
|
|
|
|
super();
|
|
|
|
|
|
|
|
this.params = params;
|
2024-05-09 22:37:21 -04:00
|
|
|
|
2024-05-30 05:25:51 -04:00
|
|
|
rank = Scoring.calculateRank(params.scoreData) ?? SHIT;
|
2024-05-10 22:09:09 -04:00
|
|
|
|
2024-05-31 01:42:41 -04:00
|
|
|
cameraBG = new FunkinCamera('resultsBG', 0, 0, FlxG.width, FlxG.height);
|
|
|
|
cameraScroll = new FunkinCamera('resultsScroll', 0, 0, FlxG.width, FlxG.height);
|
|
|
|
cameraEverything = new FunkinCamera('resultsEverything', 0, 0, FlxG.width, FlxG.height);
|
|
|
|
|
2024-05-10 22:09:09 -04:00
|
|
|
// We build a lot of this stuff in the constructor, then place it in create().
|
|
|
|
// This prevents having to do `null` checks everywhere.
|
2024-05-09 22:37:21 -04:00
|
|
|
|
|
|
|
var fontLetters:String = "AaBbCcDdEeFfGgHhiIJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz:1234567890";
|
|
|
|
songName = new FlxBitmapText(FlxBitmapFont.fromMonospace(Paths.image("resultScreen/tardlingSpritesheet"), fontLetters, FlxPoint.get(49, 62)));
|
|
|
|
songName.text = params.title;
|
|
|
|
songName.letterSpacing = -15;
|
|
|
|
songName.angle = -4.4;
|
|
|
|
songName.zIndex = 1000;
|
|
|
|
|
|
|
|
difficulty = new FlxSprite(555);
|
|
|
|
difficulty.zIndex = 1000;
|
2024-05-10 22:09:09 -04:00
|
|
|
|
2024-05-22 01:07:20 -04:00
|
|
|
clearPercentSmall = new ClearPercentCounter(FlxG.width / 2 + 300, FlxG.height / 2 - 100, 100, true);
|
|
|
|
clearPercentSmall.zIndex = 1000;
|
|
|
|
clearPercentSmall.visible = false;
|
|
|
|
|
2024-05-31 20:17:11 -04:00
|
|
|
bgFlash = FlxGradient.createGradientFlxSprite(FlxG.width, FlxG.height, [0xFFFFF1A6, 0xFFFFF1BE], 90);
|
2024-05-10 22:09:09 -04:00
|
|
|
|
|
|
|
resultsAnim = FunkinSprite.createSparrow(-200, -10, "resultScreen/results");
|
|
|
|
|
2024-05-31 20:17:11 -04:00
|
|
|
ratingsPopin = FunkinSprite.createSparrow(-135, 135, "resultScreen/ratingsPopin");
|
2024-05-10 22:09:09 -04:00
|
|
|
|
2024-05-31 20:17:11 -04:00
|
|
|
scorePopin = FunkinSprite.createSparrow(-180, 515, "resultScreen/scorePopin");
|
2024-05-10 22:09:09 -04:00
|
|
|
|
2024-05-31 20:17:11 -04:00
|
|
|
highscoreNew = new FlxSprite(44, 557);
|
2024-05-10 22:09:09 -04:00
|
|
|
|
|
|
|
score = new ResultScore(35, 305, 10, params.scoreData.score);
|
2024-05-31 05:39:53 -04:00
|
|
|
|
|
|
|
rankBg = new FunkinSprite(0, 0);
|
2023-10-11 17:33:55 -04:00
|
|
|
}
|
|
|
|
|
2023-04-21 17:39:27 -04:00
|
|
|
override function create():Void
|
2023-01-22 22:25:45 -05:00
|
|
|
{
|
2024-05-30 05:25:51 -04:00
|
|
|
if (FlxG.sound.music != null) FlxG.sound.music.stop();
|
|
|
|
|
2024-05-31 01:42:41 -04:00
|
|
|
// We need multiple cameras so we can put one at an angle.
|
|
|
|
cameraScroll.angle = -3.8;
|
|
|
|
|
|
|
|
cameraBG.bgColor = FlxColor.MAGENTA;
|
|
|
|
cameraScroll.bgColor = FlxColor.TRANSPARENT;
|
|
|
|
cameraEverything.bgColor = FlxColor.TRANSPARENT;
|
|
|
|
|
|
|
|
FlxG.cameras.add(cameraBG, false);
|
|
|
|
FlxG.cameras.add(cameraScroll, false);
|
|
|
|
FlxG.cameras.add(cameraEverything, false);
|
|
|
|
|
|
|
|
FlxG.cameras.setDefaultDrawTarget(cameraEverything, true);
|
2024-06-02 00:15:10 -04:00
|
|
|
this.camera = cameraEverything;
|
2024-05-31 01:42:41 -04:00
|
|
|
|
2024-04-22 23:04:57 -04:00
|
|
|
// Reset the camera zoom on the results screen.
|
|
|
|
FlxG.camera.zoom = 1.0;
|
|
|
|
|
2023-01-22 22:25:45 -05:00
|
|
|
var bg:FlxSprite = FlxGradient.createGradientFlxSprite(FlxG.width, FlxG.height, [0xFFFECC5C, 0xFFFDC05C], 90);
|
|
|
|
bg.scrollFactor.set();
|
2024-05-09 22:37:21 -04:00
|
|
|
bg.zIndex = 10;
|
2024-05-31 01:42:41 -04:00
|
|
|
bg.cameras = [cameraBG];
|
2023-01-22 22:25:45 -05:00
|
|
|
add(bg);
|
|
|
|
|
2023-04-17 11:02:45 -04:00
|
|
|
bgFlash.scrollFactor.set();
|
|
|
|
bgFlash.visible = false;
|
2024-05-10 22:09:09 -04:00
|
|
|
bgFlash.zIndex = 20;
|
2024-06-03 18:18:33 -04:00
|
|
|
// bgFlash.cameras = [cameraBG];
|
2023-04-17 11:02:45 -04:00
|
|
|
add(bgFlash);
|
|
|
|
|
2024-05-09 22:37:21 -04:00
|
|
|
// The sound system which falls into place behind the score text. Plays every time!
|
2024-02-22 18:55:24 -05:00
|
|
|
var soundSystem:FlxSprite = FunkinSprite.createSparrow(-15, -180, 'resultScreen/soundSystem');
|
2023-01-22 22:25:45 -05:00
|
|
|
soundSystem.animation.addByPrefix("idle", "sound system", 24, false);
|
|
|
|
soundSystem.visible = false;
|
2024-06-03 18:18:33 -04:00
|
|
|
new FlxTimer().start(8 / 24, _ -> {
|
2023-01-22 22:25:45 -05:00
|
|
|
soundSystem.animation.play("idle");
|
|
|
|
soundSystem.visible = true;
|
|
|
|
});
|
2024-05-09 22:37:21 -04:00
|
|
|
soundSystem.zIndex = 1100;
|
2023-01-22 22:25:45 -05:00
|
|
|
add(soundSystem);
|
|
|
|
|
2024-07-03 22:50:39 -04:00
|
|
|
// Fetch playable character data. Default to BF on the results screen if we can't find it.
|
|
|
|
var playerCharacterId:Null<String> = PlayerRegistry.instance.getCharacterOwnerId(params.characterId);
|
|
|
|
var playerCharacter:Null<PlayableCharacter> = PlayerRegistry.instance.fetchEntry(playerCharacterId ?? 'bf');
|
2024-05-31 20:17:11 -04:00
|
|
|
|
2024-07-03 22:50:39 -04:00
|
|
|
trace('Got playable character: ${playerCharacter?.getName()}');
|
|
|
|
// Query JSON data based on the rank, then use that to build the animation(s) the player sees.
|
|
|
|
var playerAnimationDatas:Array<PlayerResultsAnimationData> = playerCharacter != null ? playerCharacter.getResultsAnimationDatas(rank) : [];
|
2024-05-09 22:37:21 -04:00
|
|
|
|
2024-07-03 22:50:39 -04:00
|
|
|
for (animData in playerAnimationDatas)
|
|
|
|
{
|
|
|
|
if (animData == null) continue;
|
|
|
|
|
|
|
|
var animPath:String = Paths.stripLibrary(animData.assetPath);
|
|
|
|
var animLibrary:String = Paths.getLibrary(animData.assetPath);
|
|
|
|
var offsets = animData.offsets ?? [0, 0];
|
|
|
|
switch (animData.renderType)
|
|
|
|
{
|
|
|
|
case 'animateatlas':
|
|
|
|
var animation:FlxAtlasSprite = new FlxAtlasSprite(offsets[0], offsets[1], Paths.animateAtlas(animPath, animLibrary));
|
|
|
|
animation.zIndex = animData.zIndex ?? 500;
|
2024-05-09 22:37:21 -04:00
|
|
|
|
2024-07-03 22:50:39 -04:00
|
|
|
animation.scale.set(animData.scale ?? 1.0, animData.scale ?? 1.0);
|
2024-05-09 22:37:21 -04:00
|
|
|
|
2024-07-03 22:50:39 -04:00
|
|
|
if (animData.loopFrameLabel != null)
|
2024-05-10 22:09:09 -04:00
|
|
|
{
|
2024-07-03 22:50:39 -04:00
|
|
|
animation.anim.onComplete = () -> {
|
|
|
|
if (animation != null)
|
|
|
|
{
|
|
|
|
animation.playAnimation(animData.loopFrameLabel ?? ''); // unpauses this anim, since it's on PlayOnce!
|
|
|
|
}
|
|
|
|
}
|
2024-05-10 22:09:09 -04:00
|
|
|
}
|
2024-07-03 22:50:39 -04:00
|
|
|
else if (animData.loopFrame != null)
|
2024-05-31 20:17:11 -04:00
|
|
|
{
|
2024-07-03 22:50:39 -04:00
|
|
|
animation.anim.onComplete = () -> {
|
|
|
|
if (animation != null)
|
|
|
|
{
|
|
|
|
animation.anim.curFrame = animData.loopFrame ?? 0;
|
|
|
|
animation.anim.play(); // unpauses this anim, since it's on PlayOnce!
|
|
|
|
}
|
|
|
|
}
|
2024-05-31 20:17:11 -04:00
|
|
|
}
|
2024-05-24 00:06:26 -04:00
|
|
|
|
2024-07-03 22:50:39 -04:00
|
|
|
// Hide until ready to play.
|
|
|
|
animation.visible = false;
|
|
|
|
// Queue to play.
|
|
|
|
characterAtlasAnimations.push(
|
|
|
|
{
|
|
|
|
sprite: animation,
|
|
|
|
delay: animData.delay ?? 0.0
|
|
|
|
});
|
|
|
|
// Add to the scene.
|
|
|
|
add(animation);
|
|
|
|
case 'sparrow':
|
|
|
|
var animation:FunkinSprite = FunkinSprite.createSparrow(offsets[0], offsets[1], animPath);
|
|
|
|
animation.animation.addByPrefix('idle', '', 24, false, false, false);
|
2024-05-31 20:17:11 -04:00
|
|
|
|
2024-07-03 22:50:39 -04:00
|
|
|
if (animData.loopFrame != null)
|
2024-05-10 22:09:09 -04:00
|
|
|
{
|
2024-07-03 22:50:39 -04:00
|
|
|
animation.animation.finishCallback = (_name:String) -> {
|
|
|
|
if (animation != null)
|
|
|
|
{
|
|
|
|
animation.animation.play('idle', true, false, animData.loopFrame ?? 0);
|
|
|
|
}
|
|
|
|
}
|
2024-05-10 22:09:09 -04:00
|
|
|
}
|
2024-07-03 22:50:39 -04:00
|
|
|
|
|
|
|
// Hide until ready to play.
|
|
|
|
animation.visible = false;
|
|
|
|
// Queue to play.
|
|
|
|
characterSparrowAnimations.push(
|
|
|
|
{
|
|
|
|
sprite: animation,
|
|
|
|
delay: animData.delay ?? 0.0
|
|
|
|
});
|
|
|
|
// Add to the scene.
|
|
|
|
add(animation);
|
|
|
|
}
|
2024-05-09 22:37:21 -04:00
|
|
|
}
|
2023-01-22 22:25:45 -05:00
|
|
|
|
2024-06-03 18:18:33 -04:00
|
|
|
var diffSpr:String = 'diff_${params?.difficultyId ?? 'Normal'}';
|
2023-01-22 22:25:45 -05:00
|
|
|
difficulty.loadGraphic(Paths.image("resultScreen/" + diffSpr));
|
|
|
|
add(difficulty);
|
|
|
|
|
|
|
|
add(songName);
|
|
|
|
|
2024-04-24 23:50:11 -04:00
|
|
|
var angleRad = songName.angle * Math.PI / 180;
|
|
|
|
speedOfTween.x = -1.0 * Math.cos(angleRad);
|
|
|
|
speedOfTween.y = -1.0 * Math.sin(angleRad);
|
|
|
|
|
2024-05-22 01:07:20 -04:00
|
|
|
timerThenSongName(1.0, false);
|
2023-01-22 22:25:45 -05:00
|
|
|
|
|
|
|
songName.shader = maskShaderSongName;
|
|
|
|
difficulty.shader = maskShaderDifficulty;
|
|
|
|
|
|
|
|
// maskShaderSongName.swagMaskX = difficulty.x - 15;
|
|
|
|
maskShaderDifficulty.swagMaskX = difficulty.x - 15;
|
|
|
|
|
|
|
|
var blackTopBar:FlxSprite = new FlxSprite().loadGraphic(Paths.image("resultScreen/topBarBlack"));
|
|
|
|
blackTopBar.y = -blackTopBar.height;
|
2024-06-03 18:18:33 -04:00
|
|
|
FlxTween.tween(blackTopBar, {y: 0}, 7 / 24, {ease: FlxEase.quartOut, startDelay: 3 / 24});
|
2024-05-09 22:37:21 -04:00
|
|
|
blackTopBar.zIndex = 1010;
|
2023-01-22 22:25:45 -05:00
|
|
|
add(blackTopBar);
|
|
|
|
|
2024-03-25 21:09:14 -04:00
|
|
|
resultsAnim.animation.addByPrefix("result", "results instance 1", 24, false);
|
2024-05-17 20:26:34 -04:00
|
|
|
resultsAnim.visible = false;
|
2024-05-09 22:37:21 -04:00
|
|
|
resultsAnim.zIndex = 1200;
|
2023-01-22 22:25:45 -05:00
|
|
|
add(resultsAnim);
|
2024-06-03 18:18:33 -04:00
|
|
|
new FlxTimer().start(6 / 24, _ -> {
|
2024-05-17 20:26:34 -04:00
|
|
|
resultsAnim.visible = true;
|
|
|
|
resultsAnim.animation.play("result");
|
|
|
|
});
|
2023-01-22 22:25:45 -05:00
|
|
|
|
|
|
|
ratingsPopin.animation.addByPrefix("idle", "Categories", 24, false);
|
|
|
|
ratingsPopin.visible = false;
|
2024-05-09 22:37:21 -04:00
|
|
|
ratingsPopin.zIndex = 1200;
|
2023-01-22 22:25:45 -05:00
|
|
|
add(ratingsPopin);
|
2024-06-03 18:18:33 -04:00
|
|
|
new FlxTimer().start(21 / 24, _ -> {
|
2024-05-17 20:26:34 -04:00
|
|
|
ratingsPopin.visible = true;
|
|
|
|
ratingsPopin.animation.play("idle");
|
|
|
|
});
|
2023-01-22 22:25:45 -05:00
|
|
|
|
|
|
|
scorePopin.animation.addByPrefix("score", "tally score", 24, false);
|
|
|
|
scorePopin.visible = false;
|
2024-05-09 22:37:21 -04:00
|
|
|
scorePopin.zIndex = 1200;
|
2023-01-22 22:25:45 -05:00
|
|
|
add(scorePopin);
|
2024-06-03 18:18:33 -04:00
|
|
|
new FlxTimer().start(36 / 24, _ -> {
|
2024-05-17 20:26:34 -04:00
|
|
|
scorePopin.visible = true;
|
|
|
|
scorePopin.animation.play("score");
|
2024-06-03 18:18:33 -04:00
|
|
|
scorePopin.animation.finishCallback = anim -> {};
|
2024-05-17 20:26:34 -04:00
|
|
|
});
|
2023-01-22 22:25:45 -05:00
|
|
|
|
2024-06-03 18:18:33 -04:00
|
|
|
new FlxTimer().start(37 / 24, _ -> {
|
2024-05-31 20:17:11 -04:00
|
|
|
score.visible = true;
|
|
|
|
score.animateNumbers();
|
|
|
|
startRankTallySequence();
|
|
|
|
});
|
|
|
|
|
|
|
|
new FlxTimer().start(rank.getBFDelay(), _ -> {
|
|
|
|
afterRankTallySequence();
|
|
|
|
});
|
|
|
|
|
|
|
|
new FlxTimer().start(rank.getFlashDelay(), _ -> {
|
|
|
|
displayRankText();
|
|
|
|
});
|
|
|
|
|
2023-01-22 22:25:45 -05:00
|
|
|
highscoreNew.frames = Paths.getSparrowAtlas("resultScreen/highscoreNew");
|
2024-05-31 20:17:11 -04:00
|
|
|
highscoreNew.animation.addByPrefix("new", "highscoreAnim0", 24, false);
|
2023-01-22 22:25:45 -05:00
|
|
|
highscoreNew.visible = false;
|
2024-06-03 18:18:33 -04:00
|
|
|
// highscoreNew.setGraphicSize(Std.int(highscoreNew.width * 0.8));
|
2023-01-22 22:25:45 -05:00
|
|
|
highscoreNew.updateHitbox();
|
2024-05-09 22:37:21 -04:00
|
|
|
highscoreNew.zIndex = 1200;
|
2023-01-22 22:25:45 -05:00
|
|
|
add(highscoreNew);
|
|
|
|
|
2024-05-31 20:17:11 -04:00
|
|
|
new FlxTimer().start(rank.getHighscoreDelay(), _ -> {
|
2024-06-03 18:18:33 -04:00
|
|
|
if (params.isNewHighscore ?? false)
|
|
|
|
{
|
|
|
|
highscoreNew.visible = true;
|
|
|
|
highscoreNew.animation.play("new");
|
|
|
|
highscoreNew.animation.finishCallback = _ -> highscoreNew.animation.play("new", true, false, 16);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
highscoreNew.visible = false;
|
|
|
|
}
|
2024-05-31 20:17:11 -04:00
|
|
|
});
|
|
|
|
|
2023-01-22 22:25:45 -05:00
|
|
|
var hStuf:Int = 50;
|
|
|
|
|
|
|
|
var ratingGrp:FlxTypedGroup<TallyCounter> = new FlxTypedGroup<TallyCounter>();
|
2024-05-09 22:37:21 -04:00
|
|
|
ratingGrp.zIndex = 1200;
|
2023-01-22 22:25:45 -05:00
|
|
|
add(ratingGrp);
|
|
|
|
|
2024-03-04 20:47:23 -05:00
|
|
|
/**
|
|
|
|
* NOTE: We display how many notes were HIT, not how many notes there were in total.
|
|
|
|
*
|
|
|
|
*/
|
2024-04-01 21:59:53 -04:00
|
|
|
var totalHit:TallyCounter = new TallyCounter(375, hStuf * 3, params.scoreData.tallies.totalNotesHit);
|
2023-01-22 22:25:45 -05:00
|
|
|
ratingGrp.add(totalHit);
|
|
|
|
|
2024-04-01 21:59:53 -04:00
|
|
|
var maxCombo:TallyCounter = new TallyCounter(375, hStuf * 4, params.scoreData.tallies.maxCombo);
|
2023-01-22 22:25:45 -05:00
|
|
|
ratingGrp.add(maxCombo);
|
|
|
|
|
|
|
|
hStuf += 2;
|
2024-05-31 20:17:11 -04:00
|
|
|
var extraYOffset:Float = 7;
|
|
|
|
|
|
|
|
hStuf += 2;
|
|
|
|
|
2024-04-01 21:59:53 -04:00
|
|
|
var tallySick:TallyCounter = new TallyCounter(230, (hStuf * 5) + extraYOffset, params.scoreData.tallies.sick, 0xFF89E59E);
|
2023-01-22 22:25:45 -05:00
|
|
|
ratingGrp.add(tallySick);
|
|
|
|
|
2024-04-01 21:59:53 -04:00
|
|
|
var tallyGood:TallyCounter = new TallyCounter(210, (hStuf * 6) + extraYOffset, params.scoreData.tallies.good, 0xFF89C9E5);
|
2023-01-22 22:25:45 -05:00
|
|
|
ratingGrp.add(tallyGood);
|
|
|
|
|
2024-04-01 21:59:53 -04:00
|
|
|
var tallyBad:TallyCounter = new TallyCounter(190, (hStuf * 7) + extraYOffset, params.scoreData.tallies.bad, 0xFFE6CF8A);
|
2023-01-22 22:25:45 -05:00
|
|
|
ratingGrp.add(tallyBad);
|
|
|
|
|
2024-04-01 21:59:53 -04:00
|
|
|
var tallyShit:TallyCounter = new TallyCounter(220, (hStuf * 8) + extraYOffset, params.scoreData.tallies.shit, 0xFFE68C8A);
|
2023-01-22 22:25:45 -05:00
|
|
|
ratingGrp.add(tallyShit);
|
|
|
|
|
2024-04-01 21:59:53 -04:00
|
|
|
var tallyMissed:TallyCounter = new TallyCounter(260, (hStuf * 9) + extraYOffset, params.scoreData.tallies.missed, 0xFFC68AE6);
|
2023-01-22 22:25:45 -05:00
|
|
|
ratingGrp.add(tallyMissed);
|
|
|
|
|
2024-04-03 06:24:20 -04:00
|
|
|
score.visible = false;
|
2024-05-09 22:37:21 -04:00
|
|
|
score.zIndex = 1200;
|
2024-04-03 04:52:12 -04:00
|
|
|
add(score);
|
2024-04-01 21:59:53 -04:00
|
|
|
|
2023-01-22 22:25:45 -05:00
|
|
|
for (ind => rating in ratingGrp.members)
|
|
|
|
{
|
|
|
|
rating.visible = false;
|
2024-05-17 20:26:34 -04:00
|
|
|
new FlxTimer().start((0.3 * ind) + 1.20, _ -> {
|
2023-01-22 22:25:45 -05:00
|
|
|
rating.visible = true;
|
|
|
|
FlxTween.tween(rating, {curNumber: rating.neededNumber}, 0.5, {ease: FlxEase.quartOut});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2024-06-03 18:18:33 -04:00
|
|
|
// if (params.isNewHighscore ?? false)
|
|
|
|
// {
|
|
|
|
// highscoreNew.visible = true;
|
|
|
|
// highscoreNew.animation.play("new");
|
|
|
|
// //FlxTween.tween(highscoreNew, {y: highscoreNew.y + 10}, 0.8, {ease: FlxEase.quartOut});
|
|
|
|
// }
|
|
|
|
// else
|
|
|
|
// {
|
|
|
|
// highscoreNew.visible = false;
|
|
|
|
// }
|
2024-05-10 22:09:09 -04:00
|
|
|
|
2024-05-30 05:25:51 -04:00
|
|
|
new FlxTimer().start(rank.getMusicDelay(), _ -> {
|
|
|
|
if (rank.hasMusicIntro())
|
|
|
|
{
|
|
|
|
// Play the intro music.
|
|
|
|
var introMusic:String = Paths.music(rank.getMusicPath() + '/' + rank.getMusicPath() + '-intro');
|
|
|
|
FunkinSound.load(introMusic, 1.0, false, true, true, () -> {
|
|
|
|
FunkinSound.playMusic(rank.getMusicPath(),
|
|
|
|
{
|
|
|
|
startingVolume: 1.0,
|
|
|
|
overrideExisting: true,
|
|
|
|
restartTrack: true,
|
|
|
|
loop: rank.shouldMusicLoop()
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FunkinSound.playMusic(rank.getMusicPath(),
|
|
|
|
{
|
|
|
|
startingVolume: 1.0,
|
|
|
|
overrideExisting: true,
|
|
|
|
restartTrack: true,
|
|
|
|
loop: rank.shouldMusicLoop()
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2024-05-31 05:39:53 -04:00
|
|
|
rankBg.makeSolidColor(FlxG.width, FlxG.height, 0xFF000000);
|
|
|
|
rankBg.zIndex = 99999;
|
|
|
|
add(rankBg);
|
|
|
|
|
2024-06-01 19:25:52 -04:00
|
|
|
rankBg.alpha = 0;
|
2024-05-31 05:39:53 -04:00
|
|
|
|
2024-05-10 22:09:09 -04:00
|
|
|
refresh();
|
|
|
|
|
|
|
|
super.create();
|
|
|
|
}
|
|
|
|
|
|
|
|
var rankTallyTimer:Null<FlxTimer> = null;
|
|
|
|
var clearPercentTarget:Int = 100;
|
|
|
|
var clearPercentLerp:Int = 0;
|
|
|
|
|
|
|
|
function startRankTallySequence():Void
|
|
|
|
{
|
2024-05-31 20:17:11 -04:00
|
|
|
bgFlash.visible = true;
|
2024-06-03 18:18:33 -04:00
|
|
|
FlxTween.tween(bgFlash, {alpha: 0}, 5 / 24);
|
2024-06-16 18:34:10 -04:00
|
|
|
// NOTE: Only divide if totalNotes > 0 to prevent divide-by-zero errors.
|
|
|
|
var clearPercentFloat = params.scoreData.tallies.totalNotes == 0 ? 0.0 : (params.scoreData.tallies.sick +
|
|
|
|
params.scoreData.tallies.good) / params.scoreData.tallies.totalNotes * 100;
|
2024-05-22 01:07:20 -04:00
|
|
|
clearPercentTarget = Math.floor(clearPercentFloat);
|
|
|
|
// Prevent off-by-one errors.
|
2024-05-10 22:09:09 -04:00
|
|
|
|
2024-05-17 20:26:34 -04:00
|
|
|
clearPercentLerp = Std.int(Math.max(0, clearPercentTarget - 36));
|
2024-05-10 22:09:09 -04:00
|
|
|
|
2024-05-22 01:07:20 -04:00
|
|
|
trace('Clear percent target: ' + clearPercentFloat + ', round: ' + clearPercentTarget);
|
|
|
|
|
2024-05-31 20:17:11 -04:00
|
|
|
var clearPercentCounter:ClearPercentCounter = new ClearPercentCounter(FlxG.width / 2 + 190, FlxG.height / 2 - 70, clearPercentLerp);
|
2024-06-03 18:18:33 -04:00
|
|
|
FlxTween.tween(clearPercentCounter, {curNumber: clearPercentTarget}, 58 / 24,
|
2024-05-10 22:09:09 -04:00
|
|
|
{
|
2024-05-17 20:26:34 -04:00
|
|
|
ease: FlxEase.quartOut,
|
|
|
|
onUpdate: _ -> {
|
|
|
|
// Only play the tick sound if the number increased.
|
|
|
|
if (clearPercentLerp != clearPercentCounter.curNumber)
|
|
|
|
{
|
|
|
|
clearPercentLerp = clearPercentCounter.curNumber;
|
|
|
|
FunkinSound.playOnce(Paths.sound('scrollMenu'));
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onComplete: _ -> {
|
|
|
|
// Play confirm sound.
|
|
|
|
FunkinSound.playOnce(Paths.sound('confirmMenu'));
|
2024-05-10 22:09:09 -04:00
|
|
|
|
2024-05-22 01:07:20 -04:00
|
|
|
// Just to be sure that the lerp didn't mess things up.
|
|
|
|
clearPercentCounter.curNumber = clearPercentTarget;
|
|
|
|
|
|
|
|
clearPercentCounter.flash(true);
|
|
|
|
new FlxTimer().start(0.4, _ -> {
|
|
|
|
clearPercentCounter.flash(false);
|
|
|
|
});
|
|
|
|
|
2024-06-03 18:18:33 -04:00
|
|
|
// displayRankText();
|
2024-05-10 22:09:09 -04:00
|
|
|
|
2024-05-30 05:25:51 -04:00
|
|
|
// previously 2.0 seconds
|
|
|
|
new FlxTimer().start(0.25, _ -> {
|
2024-05-22 01:07:20 -04:00
|
|
|
FlxTween.tween(clearPercentCounter, {alpha: 0}, 0.5,
|
|
|
|
{
|
|
|
|
startDelay: 0.5,
|
|
|
|
ease: FlxEase.quartOut,
|
|
|
|
onComplete: _ -> {
|
|
|
|
remove(clearPercentCounter);
|
|
|
|
}
|
|
|
|
});
|
2024-05-10 22:09:09 -04:00
|
|
|
|
2024-06-03 18:18:33 -04:00
|
|
|
// afterRankTallySequence();
|
2024-05-17 20:26:34 -04:00
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
clearPercentCounter.zIndex = 450;
|
|
|
|
add(clearPercentCounter);
|
2024-05-10 22:09:09 -04:00
|
|
|
|
|
|
|
if (ratingsPopin == null)
|
|
|
|
{
|
|
|
|
trace("Could not build ratingsPopin!");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2024-05-17 20:26:34 -04:00
|
|
|
// ratingsPopin.animation.play("idle");
|
|
|
|
// ratingsPopin.visible = true;
|
2023-01-22 22:25:45 -05:00
|
|
|
|
2023-04-16 15:33:20 -04:00
|
|
|
ratingsPopin.animation.finishCallback = anim -> {
|
2024-05-17 20:26:34 -04:00
|
|
|
// scorePopin.animation.play("score");
|
|
|
|
|
|
|
|
// scorePopin.visible = true;
|
2023-01-22 22:25:45 -05:00
|
|
|
|
2024-05-17 20:26:34 -04:00
|
|
|
if (params.isNewHighscore ?? false)
|
2024-04-01 21:59:53 -04:00
|
|
|
{
|
|
|
|
highscoreNew.visible = true;
|
|
|
|
highscoreNew.animation.play("new");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
highscoreNew.visible = false;
|
|
|
|
}
|
2023-01-22 22:25:45 -05:00
|
|
|
};
|
2024-05-10 22:09:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
refresh();
|
|
|
|
}
|
2023-01-22 22:25:45 -05:00
|
|
|
|
2024-05-17 20:26:34 -04:00
|
|
|
function displayRankText():Void
|
|
|
|
{
|
2024-05-31 20:17:11 -04:00
|
|
|
bgFlash.visible = true;
|
|
|
|
bgFlash.alpha = 1;
|
2024-06-03 18:18:33 -04:00
|
|
|
FlxTween.tween(bgFlash, {alpha: 0}, 14 / 24);
|
2024-05-31 20:17:11 -04:00
|
|
|
|
2024-05-31 01:42:41 -04:00
|
|
|
var rankTextVert:FlxBackdrop = new FlxBackdrop(Paths.image(rank.getVerTextAsset()), Y, 0, 30);
|
2024-05-31 20:17:11 -04:00
|
|
|
rankTextVert.x = FlxG.width - 44;
|
2024-05-31 01:42:41 -04:00
|
|
|
rankTextVert.y = 100;
|
|
|
|
rankTextVert.zIndex = 990;
|
2024-05-17 20:26:34 -04:00
|
|
|
add(rankTextVert);
|
|
|
|
|
2024-06-03 18:18:33 -04:00
|
|
|
FlxFlicker.flicker(rankTextVert, 2 / 24 * 3, 2 / 24, true);
|
2024-05-31 20:17:11 -04:00
|
|
|
|
2024-05-31 01:42:41 -04:00
|
|
|
// Scrolling.
|
2024-06-03 18:18:33 -04:00
|
|
|
new FlxTimer().start(30 / 24, _ -> {
|
|
|
|
rankTextVert.velocity.y = -80;
|
2024-05-31 20:17:11 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
for (i in 0...12)
|
2024-05-17 20:26:34 -04:00
|
|
|
{
|
2024-05-31 01:42:41 -04:00
|
|
|
var rankTextBack:FlxBackdrop = new FlxBackdrop(Paths.image(rank.getHorTextAsset()), X, 10, 0);
|
|
|
|
rankTextBack.x = FlxG.width / 2 - 320;
|
2024-05-31 20:17:11 -04:00
|
|
|
rankTextBack.y = 50 + (135 * i / 2) + 10;
|
2024-05-31 01:42:41 -04:00
|
|
|
// rankTextBack.angle = -3.8;
|
2024-05-17 20:26:34 -04:00
|
|
|
rankTextBack.zIndex = 100;
|
2024-05-31 01:42:41 -04:00
|
|
|
rankTextBack.cameras = [cameraScroll];
|
2024-05-17 20:26:34 -04:00
|
|
|
add(rankTextBack);
|
2024-05-31 01:42:41 -04:00
|
|
|
|
|
|
|
// Scrolling.
|
2024-05-31 20:17:11 -04:00
|
|
|
rankTextBack.velocity.x = (i % 2 == 0) ? -7.0 : 7.0;
|
2024-05-17 20:26:34 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
refresh();
|
|
|
|
}
|
|
|
|
|
2024-05-10 22:09:09 -04:00
|
|
|
function afterRankTallySequence():Void
|
|
|
|
{
|
2024-05-22 01:07:20 -04:00
|
|
|
showSmallClearPercent();
|
|
|
|
|
2024-07-03 22:50:39 -04:00
|
|
|
for (atlas in characterAtlasAnimations)
|
2024-05-10 22:09:09 -04:00
|
|
|
{
|
2024-07-03 22:50:39 -04:00
|
|
|
new FlxTimer().start(atlas.delay, _ -> {
|
|
|
|
if (atlas.sprite == null) return;
|
|
|
|
atlas.sprite.visible = true;
|
|
|
|
atlas.sprite.playAnimation('');
|
|
|
|
});
|
|
|
|
}
|
2024-05-31 20:17:11 -04:00
|
|
|
|
2024-07-03 22:50:39 -04:00
|
|
|
for (sprite in characterSparrowAnimations)
|
|
|
|
{
|
|
|
|
new FlxTimer().start(sprite.delay, _ -> {
|
|
|
|
if (sprite.sprite == null) return;
|
|
|
|
sprite.sprite.visible = true;
|
|
|
|
sprite.sprite.animation.play('idle', true);
|
|
|
|
});
|
2024-05-10 22:09:09 -04:00
|
|
|
}
|
2023-01-22 22:25:45 -05:00
|
|
|
}
|
|
|
|
|
2024-05-22 01:07:20 -04:00
|
|
|
function timerThenSongName(timerLength:Float = 3.0, autoScroll:Bool = true):Void
|
2023-01-22 22:25:45 -05:00
|
|
|
{
|
|
|
|
movingSongStuff = false;
|
|
|
|
|
|
|
|
difficulty.x = 555;
|
|
|
|
|
2024-03-04 19:03:43 -05:00
|
|
|
var diffYTween:Float = 122;
|
2023-01-22 22:25:45 -05:00
|
|
|
|
|
|
|
difficulty.y = -difficulty.height;
|
2024-04-25 01:53:13 -04:00
|
|
|
FlxTween.tween(difficulty, {y: diffYTween}, 0.5, {ease: FlxEase.expoOut, startDelay: 0.8});
|
2023-01-22 22:25:45 -05:00
|
|
|
|
2024-05-22 01:07:20 -04:00
|
|
|
if (clearPercentSmall != null)
|
|
|
|
{
|
|
|
|
clearPercentSmall.x = (difficulty.x + difficulty.width) + 60;
|
|
|
|
clearPercentSmall.y = -clearPercentSmall.height;
|
2024-06-05 14:47:29 -04:00
|
|
|
FlxTween.tween(clearPercentSmall, {y: 122 - 5}, 0.5, {ease: FlxEase.expoOut, startDelay: 0.85});
|
2024-05-22 01:07:20 -04:00
|
|
|
}
|
|
|
|
|
2024-04-25 01:53:13 -04:00
|
|
|
songName.y = -songName.height;
|
2024-04-30 13:34:34 -04:00
|
|
|
var fuckedupnumber = (10) * (songName.text.length / 15);
|
2024-05-22 01:07:20 -04:00
|
|
|
FlxTween.tween(songName, {y: diffYTween - 25 - fuckedupnumber}, 0.5, {ease: FlxEase.expoOut, startDelay: 0.9});
|
2024-06-05 14:47:29 -04:00
|
|
|
songName.x = clearPercentSmall.x + 94;
|
2022-12-07 02:29:48 -05:00
|
|
|
|
2024-05-17 20:26:34 -04:00
|
|
|
new FlxTimer().start(timerLength, _ -> {
|
2024-04-25 01:53:13 -04:00
|
|
|
var tempSpeed = FlxPoint.get(speedOfTween.x, speedOfTween.y);
|
|
|
|
|
|
|
|
speedOfTween.set(0, 0);
|
|
|
|
FlxTween.tween(speedOfTween, {x: tempSpeed.x, y: tempSpeed.y}, 0.7, {ease: FlxEase.quadIn});
|
|
|
|
|
2024-05-22 01:07:20 -04:00
|
|
|
movingSongStuff = (autoScroll);
|
2023-01-22 22:25:45 -05:00
|
|
|
});
|
|
|
|
}
|
2022-12-02 21:37:07 -05:00
|
|
|
|
2024-05-22 01:07:20 -04:00
|
|
|
function showSmallClearPercent():Void
|
|
|
|
{
|
|
|
|
if (clearPercentSmall != null)
|
|
|
|
{
|
|
|
|
add(clearPercentSmall);
|
|
|
|
clearPercentSmall.visible = true;
|
|
|
|
clearPercentSmall.flash(true);
|
|
|
|
new FlxTimer().start(0.4, _ -> {
|
|
|
|
clearPercentSmall.flash(false);
|
|
|
|
});
|
|
|
|
|
|
|
|
clearPercentSmall.curNumber = clearPercentTarget;
|
|
|
|
clearPercentSmall.zIndex = 1000;
|
|
|
|
refresh();
|
|
|
|
}
|
|
|
|
|
2024-05-31 20:17:11 -04:00
|
|
|
new FlxTimer().start(2.5, _ -> {
|
|
|
|
movingSongStuff = true;
|
|
|
|
});
|
2024-05-22 01:07:20 -04:00
|
|
|
}
|
|
|
|
|
2023-01-22 22:25:45 -05:00
|
|
|
var movingSongStuff:Bool = false;
|
2024-04-24 23:50:11 -04:00
|
|
|
var speedOfTween:FlxPoint = FlxPoint.get(-1, 1);
|
2022-12-02 21:37:07 -05:00
|
|
|
|
2023-01-22 22:25:45 -05:00
|
|
|
override function draw():Void
|
|
|
|
{
|
|
|
|
super.draw();
|
2022-09-20 02:16:12 -04:00
|
|
|
|
2024-05-22 01:07:20 -04:00
|
|
|
songName.clipRect = FlxRect.get(Math.max(0, 520 - songName.x), 0, FlxG.width, songName.height);
|
|
|
|
|
2024-05-10 22:09:09 -04:00
|
|
|
// PROBABLY SHOULD FIX MEMORY FREE OR WHATEVER THE PUT() FUNCTION DOES !!!! FEELS LIKE IT STUTTERS!!!
|
2023-01-22 22:25:45 -05:00
|
|
|
|
|
|
|
// if (songName != null && songName.frame != null)
|
|
|
|
// maskShaderSongName.frameUV = songName.frame.uv;
|
|
|
|
}
|
|
|
|
|
2024-03-04 19:03:43 -05:00
|
|
|
override function update(elapsed:Float):Void
|
2023-01-22 22:25:45 -05:00
|
|
|
{
|
2024-05-31 20:17:11 -04:00
|
|
|
// if(FlxG.keys.justPressed.R){
|
|
|
|
// FlxG.switchState(() -> new funkin.play.ResultState(
|
|
|
|
// {
|
|
|
|
// storyMode: false,
|
|
|
|
// title: "Cum Song Erect by Kawai Sprite",
|
|
|
|
// songId: "cum",
|
|
|
|
// difficultyId: "nightmare",
|
|
|
|
// isNewHighscore: true,
|
|
|
|
// scoreData:
|
|
|
|
// {
|
|
|
|
// score: 1_234_567,
|
|
|
|
// tallies:
|
|
|
|
// {
|
|
|
|
// sick: 200,
|
|
|
|
// good: 0,
|
|
|
|
// bad: 0,
|
|
|
|
// shit: 0,
|
|
|
|
// missed: 0,
|
|
|
|
// combo: 0,
|
|
|
|
// maxCombo: 69,
|
|
|
|
// totalNotesHit: 200,
|
|
|
|
// totalNotes: 200 // 0,
|
|
|
|
// }
|
|
|
|
// },
|
|
|
|
// }));
|
|
|
|
// }
|
|
|
|
|
2023-01-22 22:25:45 -05:00
|
|
|
// maskShaderSongName.swagSprX = songName.x;
|
|
|
|
maskShaderDifficulty.swagSprX = difficulty.x;
|
|
|
|
|
|
|
|
if (movingSongStuff)
|
|
|
|
{
|
|
|
|
songName.x += speedOfTween.x;
|
|
|
|
difficulty.x += speedOfTween.x;
|
2024-05-22 01:07:20 -04:00
|
|
|
clearPercentSmall.x += speedOfTween.x;
|
2023-01-22 22:25:45 -05:00
|
|
|
songName.y += speedOfTween.y;
|
|
|
|
difficulty.y += speedOfTween.y;
|
2024-05-22 01:07:20 -04:00
|
|
|
clearPercentSmall.y += speedOfTween.y;
|
2023-01-22 22:25:45 -05:00
|
|
|
|
|
|
|
if (songName.x + songName.width < 100)
|
|
|
|
{
|
|
|
|
timerThenSongName();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (FlxG.keys.justPressed.RIGHT) speedOfTween.x += 0.1;
|
|
|
|
|
|
|
|
if (FlxG.keys.justPressed.LEFT)
|
|
|
|
{
|
|
|
|
speedOfTween.x -= 0.1;
|
|
|
|
}
|
|
|
|
|
2023-06-15 00:30:20 -04:00
|
|
|
if (controls.PAUSE)
|
|
|
|
{
|
2024-05-30 05:25:51 -04:00
|
|
|
if (FlxG.sound.music != null)
|
|
|
|
{
|
|
|
|
FlxTween.tween(FlxG.sound.music, {volume: 0}, 0.8);
|
|
|
|
FlxTween.tween(FlxG.sound.music, {pitch: 3}, 0.1,
|
|
|
|
{
|
|
|
|
onComplete: _ -> {
|
|
|
|
FlxTween.tween(FlxG.sound.music, {pitch: 0.5}, 0.4);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2023-10-11 17:33:55 -04:00
|
|
|
if (params.storyMode)
|
2023-06-15 00:30:20 -04:00
|
|
|
{
|
2024-02-13 01:38:11 -05:00
|
|
|
openSubState(new funkin.ui.transition.StickerSubState(null, (sticker) -> new StoryMenuState(sticker)));
|
2023-06-15 00:30:20 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2024-05-31 05:39:53 -04:00
|
|
|
var rigged:Bool = true;
|
2024-06-01 19:25:52 -04:00
|
|
|
if (rank > Scoring.calculateRank(params?.prevScoreData)) // if (rigged)
|
2024-05-31 05:39:53 -04:00
|
|
|
{
|
|
|
|
trace('THE RANK IS Higher.....');
|
|
|
|
|
|
|
|
FlxTween.tween(rankBg, {alpha: 1}, 0.5,
|
2024-05-30 05:25:51 -04:00
|
|
|
{
|
2024-05-31 05:39:53 -04:00
|
|
|
ease: FlxEase.expoOut,
|
|
|
|
onComplete: function(_) {
|
|
|
|
FlxG.switchState(FreeplayState.build(
|
|
|
|
{
|
|
|
|
{
|
|
|
|
fromResults:
|
|
|
|
{
|
|
|
|
oldRank: Scoring.calculateRank(params?.prevScoreData),
|
|
|
|
newRank: rank,
|
|
|
|
songId: params.songId,
|
2024-06-01 19:25:52 -04:00
|
|
|
difficultyId: params.difficultyId,
|
|
|
|
playRankAnim: true
|
2024-05-31 05:39:53 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
trace('rank is lower...... and/or equal');
|
|
|
|
openSubState(new funkin.ui.transition.StickerSubState(null, (sticker) -> FreeplayState.build(
|
|
|
|
{
|
|
|
|
{
|
|
|
|
fromResults:
|
|
|
|
{
|
|
|
|
oldRank: null,
|
2024-06-01 19:25:52 -04:00
|
|
|
playRankAnim: false,
|
2024-05-31 05:39:53 -04:00
|
|
|
newRank: rank,
|
|
|
|
songId: params.songId,
|
|
|
|
difficultyId: params.difficultyId
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, sticker)));
|
|
|
|
}
|
2023-06-15 00:30:20 -04:00
|
|
|
}
|
|
|
|
}
|
2023-01-22 22:25:45 -05:00
|
|
|
|
|
|
|
super.update(elapsed);
|
|
|
|
}
|
2022-09-20 13:18:40 -04:00
|
|
|
}
|
2023-10-11 17:33:55 -04:00
|
|
|
|
|
|
|
typedef ResultsStateParams =
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* True if results are for a level, false if results are for a single song.
|
|
|
|
*/
|
|
|
|
var storyMode:Bool;
|
|
|
|
|
|
|
|
/**
|
2024-07-03 22:50:39 -04:00
|
|
|
* A readable title for the song we just played.
|
2023-10-11 17:33:55 -04:00
|
|
|
* Either "Song Name by Artist Name" or "Week Name"
|
|
|
|
*/
|
|
|
|
var title:String;
|
|
|
|
|
2024-07-03 22:50:39 -04:00
|
|
|
/**
|
|
|
|
* The internal song ID for the song we just played.
|
|
|
|
*/
|
2024-05-30 05:25:51 -04:00
|
|
|
var songId:String;
|
|
|
|
|
2024-07-03 22:50:39 -04:00
|
|
|
/**
|
|
|
|
* The character ID for the song we just played.
|
|
|
|
*/
|
|
|
|
var characterId:String;
|
|
|
|
|
2024-04-01 21:59:53 -04:00
|
|
|
/**
|
|
|
|
* Whether the displayed score is a new highscore
|
|
|
|
*/
|
2024-05-17 20:26:34 -04:00
|
|
|
var ?isNewHighscore:Bool;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The difficulty ID of the song/week we just played.
|
|
|
|
* @default Normal
|
|
|
|
*/
|
|
|
|
var ?difficultyId:String;
|
2024-04-01 21:59:53 -04:00
|
|
|
|
2023-10-11 17:33:55 -04:00
|
|
|
/**
|
|
|
|
* The score, accuracy, and judgements.
|
|
|
|
*/
|
2024-04-01 21:59:53 -04:00
|
|
|
var scoreData:SaveScoreData;
|
2024-05-17 20:26:34 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The previous score data, used for rank comparision.
|
|
|
|
*/
|
|
|
|
var ?prevScoreData:SaveScoreData;
|
2023-10-11 17:33:55 -04:00
|
|
|
};
|