mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 08:55:35 +00:00
Use proper scene load function in all cases
This commit is contained in:
parent
7acc344986
commit
c5ed30f458
5 changed files with 12 additions and 5 deletions
|
|
@ -27,7 +27,7 @@ public partial class GlobalState : Node
|
|||
// The solution is to defer the load to a later time, when
|
||||
// we can be sure that no code from the current scene is running:
|
||||
|
||||
CallDeferred(MethodName.DeferredGotoScene, path);
|
||||
CallDeferred(MethodName.DeferredGotoScene, path, new MapStartDataResource());
|
||||
}
|
||||
|
||||
public void GoToScene(string path, MapStartDataResource startData)
|
||||
|
|
@ -53,6 +53,9 @@ public partial class GlobalState : Node
|
|||
// Optionally, to make it compatible with the SceneTree.change_scene_to_file() API.
|
||||
GetTree().CurrentScene = CurrentScene;
|
||||
|
||||
// // Update current scene here too
|
||||
// CurrentScene = GetTree().Root.GetChild(-1);
|
||||
|
||||
if (startData is not null)
|
||||
{
|
||||
// Call deferred if it gives issues
|
||||
|
|
|
|||
|
|
@ -29,7 +29,8 @@ public partial class IntroManager : Node
|
|||
|
||||
private void DialogueEndAction()
|
||||
{
|
||||
GetTree().ChangeSceneToFile(NextMap);
|
||||
GlobalState.Instance.GotoScene(NextMap);
|
||||
//GetTree().ChangeSceneToFile(NextMap);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -31,7 +31,8 @@ public partial class MainMenu : Control
|
|||
private void _on_start_button_pressed()
|
||||
{
|
||||
if (GameScene != null) {
|
||||
GetTree().ChangeSceneToFile(GameScene);
|
||||
GlobalState.Instance.GotoScene(GameScene);
|
||||
//GetTree().ChangeSceneToFile(GameScene);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -82,7 +82,8 @@ public partial class IntroScenePlayer : CanvasLayer
|
|||
|
||||
private void Finished()
|
||||
{
|
||||
GetTree().ChangeSceneToFile(NextSceneName);
|
||||
GlobalState.Instance.GotoScene(NextSceneName);
|
||||
//GetTree().ChangeSceneToFile(NextSceneName);
|
||||
}
|
||||
|
||||
private async Task Transition()
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ public partial class PauseMenu : Control
|
|||
|
||||
private void QuitButtonOnPressed()
|
||||
{
|
||||
GetTree().ChangeSceneToFile(MainMenuScene);
|
||||
GlobalState.Instance.GotoScene(MainMenuScene);
|
||||
//GetTree().ChangeSceneToFile(MainMenuScene);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue