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.ui.story.StoryMenuState;
|
||||||
import funkin.graphics.adobeanimate.FlxAtlasSprite;
|
import funkin.graphics.adobeanimate.FlxAtlasSprite;
|
||||||
import flixel.FlxSprite;
|
import flixel.FlxSprite;
|
||||||
|
import flixel.FlxState;
|
||||||
|
import flixel.FlxSubState;
|
||||||
import funkin.graphics.FunkinSprite;
|
import funkin.graphics.FunkinSprite;
|
||||||
import flixel.effects.FlxFlicker;
|
import flixel.effects.FlxFlicker;
|
||||||
import flixel.graphics.frames.FlxBitmapFont;
|
import flixel.graphics.frames.FlxBitmapFont;
|
||||||
|
@ -736,11 +738,13 @@ class ResultState extends MusicBeatSubState
|
||||||
// Default to main menu because that's better than `null`.
|
// Default to main menu because that's better than `null`.
|
||||||
var targetState:flixel.FlxState = new funkin.ui.mainmenu.MainMenuState();
|
var targetState:flixel.FlxState = new funkin.ui.mainmenu.MainMenuState();
|
||||||
var shouldTween = false;
|
var shouldTween = false;
|
||||||
|
var shouldUseSubstate = false;
|
||||||
|
|
||||||
if (params.storyMode)
|
if (params.storyMode)
|
||||||
{
|
{
|
||||||
if (PlayerRegistry.instance.hasNewCharacter())
|
if (PlayerRegistry.instance.hasNewCharacter())
|
||||||
{
|
{
|
||||||
|
// New character, display the notif.
|
||||||
targetState = new StoryMenuState(null);
|
targetState = new StoryMenuState(null);
|
||||||
|
|
||||||
var newCharacters = PlayerRegistry.instance.listNewCharacters();
|
var newCharacters = PlayerRegistry.instance.listNewCharacters();
|
||||||
|
@ -754,6 +758,9 @@ class ResultState extends MusicBeatSubState
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// No new characters.
|
||||||
|
shouldTween = false;
|
||||||
|
shouldUseSubstate = true;
|
||||||
targetState = new funkin.ui.transition.StickerSubState(null, (sticker) -> new StoryMenuState(sticker));
|
targetState = new funkin.ui.transition.StickerSubState(null, (sticker) -> new StoryMenuState(sticker));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -781,21 +788,9 @@ class ResultState extends MusicBeatSubState
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
trace('rank is lower...... and/or equal');
|
shouldTween = false;
|
||||||
|
shouldUseSubstate = true;
|
||||||
targetState = new funkin.ui.transition.StickerSubState(null, (sticker) -> FreeplayState.build(
|
targetState = new funkin.ui.transition.StickerSubState(null, (sticker) -> FreeplayState.build(null, sticker));
|
||||||
{
|
|
||||||
{
|
|
||||||
fromResults:
|
|
||||||
{
|
|
||||||
oldRank: null,
|
|
||||||
playRankAnim: false,
|
|
||||||
newRank: rank,
|
|
||||||
songId: params.songId,
|
|
||||||
difficultyId: params.difficultyId
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, sticker));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -805,13 +800,27 @@ class ResultState extends MusicBeatSubState
|
||||||
{
|
{
|
||||||
ease: FlxEase.expoOut,
|
ease: FlxEase.expoOut,
|
||||||
onComplete: function(_) {
|
onComplete: function(_) {
|
||||||
FlxG.switchState(targetState);
|
if (shouldUseSubstate && targetState is FlxSubState)
|
||||||
|
{
|
||||||
|
openSubState(cast targetState);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FlxG.switchState(targetState);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FlxG.switchState(targetState);
|
if (shouldUseSubstate && targetState is FlxSubState)
|
||||||
|
{
|
||||||
|
openSubState(cast targetState);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FlxG.switchState(targetState);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue