mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-23 08:07:54 -05:00
Chart editor: Tweaked FlxCamera management when entering and exiting playtest mode to fix UI-related crashes.
This commit is contained in:
parent
d6bc8d88aa
commit
fe7ffecc0d
1 changed files with 17 additions and 7 deletions
|
@ -690,6 +690,11 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||||
*/
|
*/
|
||||||
var activeToolboxes:Map<String, CollapsibleDialog> = new Map<String, CollapsibleDialog>();
|
var activeToolboxes:Map<String, CollapsibleDialog> = new Map<String, CollapsibleDialog>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The camera component we're using for this state.
|
||||||
|
*/
|
||||||
|
var uiCamera:FlxCamera;
|
||||||
|
|
||||||
// Audio
|
// Audio
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2028,7 +2033,8 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||||
|
|
||||||
loadPreferences();
|
loadPreferences();
|
||||||
|
|
||||||
fixCamera();
|
uiCamera = new FlxCamera();
|
||||||
|
FlxG.cameras.reset(uiCamera);
|
||||||
|
|
||||||
buildDefaultSongData();
|
buildDefaultSongData();
|
||||||
|
|
||||||
|
@ -5287,7 +5293,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||||
Paths.setCurrentLevel('weekend1');
|
Paths.setCurrentLevel('weekend1');
|
||||||
}
|
}
|
||||||
|
|
||||||
subStateClosed.add(fixCamera);
|
subStateClosed.add(reviveUICamera);
|
||||||
subStateClosed.add(resetConductorAfterTest);
|
subStateClosed.add(resetConductorAfterTest);
|
||||||
|
|
||||||
FlxTransitionableState.skipNextTransIn = false;
|
FlxTransitionableState.skipNextTransIn = false;
|
||||||
|
@ -5312,6 +5318,11 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||||
}
|
}
|
||||||
if (audioVocalTrackGroup != null) targetState.vocals = audioVocalTrackGroup;
|
if (audioVocalTrackGroup != null) targetState.vocals = audioVocalTrackGroup;
|
||||||
|
|
||||||
|
// Kill and replace the UI camera so it doesn't get destroyed during the state transition.
|
||||||
|
uiCamera.kill();
|
||||||
|
FlxG.cameras.remove(uiCamera, false);
|
||||||
|
FlxG.cameras.reset(new FlxCamera());
|
||||||
|
|
||||||
this.persistentUpdate = false;
|
this.persistentUpdate = false;
|
||||||
this.persistentDraw = false;
|
this.persistentDraw = false;
|
||||||
stopWelcomeMusic();
|
stopWelcomeMusic();
|
||||||
|
@ -5401,13 +5412,12 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fix a camera issue caused when closing the PlayState used when testing.
|
* Revive the UI camera and re-establish it as the main camera so UI elements depending on it don't explode.
|
||||||
*/
|
*/
|
||||||
function fixCamera(_:FlxSubState = null):Void
|
function reviveUICamera(_:FlxSubState = null):Void
|
||||||
{
|
{
|
||||||
FlxG.cameras.reset(new FlxCamera());
|
uiCamera.revive();
|
||||||
FlxG.camera.focusOn(new FlxPoint(FlxG.width / 2, FlxG.height / 2));
|
FlxG.cameras.reset(uiCamera);
|
||||||
FlxG.camera.zoom = 1.0;
|
|
||||||
|
|
||||||
add(this.root);
|
add(this.root);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue