mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-11-15 11:22:55 +00:00
Fix a bug where StickerSubState was being loaded as a state and not a substate, breaking some transitions
This commit is contained in:
parent
0ec22bcc85
commit
a530d91a76
|
@ -4,6 +4,8 @@ import funkin.util.MathUtil;
|
|||
import funkin.ui.story.StoryMenuState;
|
||||
import funkin.graphics.adobeanimate.FlxAtlasSprite;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.FlxState;
|
||||
import flixel.FlxSubState;
|
||||
import funkin.graphics.FunkinSprite;
|
||||
import flixel.effects.FlxFlicker;
|
||||
import flixel.graphics.frames.FlxBitmapFont;
|
||||
|
@ -736,11 +738,13 @@ class ResultState extends MusicBeatSubState
|
|||
// Default to main menu because that's better than `null`.
|
||||
var targetState:flixel.FlxState = new funkin.ui.mainmenu.MainMenuState();
|
||||
var shouldTween = false;
|
||||
var shouldUseSubstate = false;
|
||||
|
||||
if (params.storyMode)
|
||||
{
|
||||
if (PlayerRegistry.instance.hasNewCharacter())
|
||||
{
|
||||
// New character, display the notif.
|
||||
targetState = new StoryMenuState(null);
|
||||
|
||||
var newCharacters = PlayerRegistry.instance.listNewCharacters();
|
||||
|
@ -754,6 +758,9 @@ class ResultState extends MusicBeatSubState
|
|||
}
|
||||
else
|
||||
{
|
||||
// No new characters.
|
||||
shouldTween = false;
|
||||
shouldUseSubstate = true;
|
||||
targetState = new funkin.ui.transition.StickerSubState(null, (sticker) -> new StoryMenuState(sticker));
|
||||
}
|
||||
}
|
||||
|
@ -781,21 +788,9 @@ class ResultState extends MusicBeatSubState
|
|||
}
|
||||
else
|
||||
{
|
||||
trace('rank is lower...... and/or equal');
|
||||
|
||||
targetState = new funkin.ui.transition.StickerSubState(null, (sticker) -> FreeplayState.build(
|
||||
{
|
||||
{
|
||||
fromResults:
|
||||
{
|
||||
oldRank: null,
|
||||
playRankAnim: false,
|
||||
newRank: rank,
|
||||
songId: params.songId,
|
||||
difficultyId: params.difficultyId
|
||||
}
|
||||
}
|
||||
}, sticker));
|
||||
shouldTween = false;
|
||||
shouldUseSubstate = true;
|
||||
targetState = new funkin.ui.transition.StickerSubState(null, (sticker) -> FreeplayState.build(null, sticker));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -805,15 +800,29 @@ class ResultState extends MusicBeatSubState
|
|||
{
|
||||
ease: FlxEase.expoOut,
|
||||
onComplete: function(_) {
|
||||
if (shouldUseSubstate && targetState is FlxSubState)
|
||||
{
|
||||
openSubState(cast targetState);
|
||||
}
|
||||
else
|
||||
{
|
||||
FlxG.switchState(targetState);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
if (shouldUseSubstate && targetState is FlxSubState)
|
||||
{
|
||||
openSubState(cast targetState);
|
||||
}
|
||||
else
|
||||
{
|
||||
FlxG.switchState(targetState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.update(elapsed);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue