Exemplo n.º 1
0
    private void voltarMenuInicial()
    {
        var nextScene = ResourceLoader.Load <PackedScene>("res://scene/TelaInicial.tscn");

        //await Client.DisconnectAsync();

        var telaInicia = nextScene.Instance() as FrmInicial;

        telaInicia.Usuario = Usuario;

        GetNode("/root").AddChild(telaInicia);

        //await Client.DisconnectAsync();
        CurrentScene.Free();
        CurrentScene = telaInicia;
    }
Exemplo n.º 2
0
        public void DeferredGotoScene(string path)
        {
            // Immediately free the current scene, there is no risk here.
            CurrentScene.Free();

            // Load a new scene.
            var nextScene = (PackedScene)GD.Load(path);

            // Instance the new scene.
            CurrentScene = nextScene.Instance();

            // Add it to the active scene, as child of root.
            GetTree().GetRoot().AddChild(CurrentScene);

            // Optional, to make it compatible with the SceneTree.change_scene() API.
            GetTree().SetCurrentScene(CurrentScene);
        }