public void HandleReturnButtonClicked()
 {
     if (UseDirectReturn)
     {
         SceneManager.LoadScene(MetaState.Instance.NextScene);
     }
     else
     {
         SharedUtils.ChangeScene(MetaState.Instance.NextScene);
     }
 }
Example #2
0
 static void Reload()
 {
     if (GameState.Exists)
     {
         SharedUtils.ChangeScene(SceneManager.GetActiveScene().name);
     }
     else
     {
         SceneManager.LoadScene(SceneManager.GetActiveScene().name);
     }
 }
Example #3
0
        /// <summary>
        /// Sets parameters and loads a different scene
        /// </summary>
        public static void ChangeScene(string scene, string spawnPoint, Vector3 position, Quaternion rotation, bool skipLoading)
        {
            MetaState mgs = MetaState.Instance;

            if (spawnPoint != null)
            {
                mgs.PlayerIntent = new PlayerSpawnIntent(spawnPoint); //handle string.Empty as default spawn point
            }
            else
            {
                mgs.PlayerIntent = new PlayerSpawnIntent(position, rotation);
            }

            SharedUtils.ChangeScene(scene, skipLoading);
        }
Example #4
0
        public static void TestScreenFader()
        {
            AsyncUtils.RunWithExceptionHandling(async() =>
            {
                ScreenFader.FadeTo(Color.white, 5.0f, true, true, true);

                await Task.Delay(6000);
                AsyncUtils.ThrowIfEditorStopped();

                SharedUtils.ChangeScene("TestScene");

                await Task.Delay(5000);
                AsyncUtils.ThrowIfEditorStopped();

                ScreenFader.FadeFrom(null, 1.0f, false, true, true);

                await Task.Delay(5000);
                AsyncUtils.ThrowIfEditorStopped();

                ScreenFader.Crossfade(Color.blue, Color.red, 5.0f, false, false, false);

                await Task.Delay(3000);
                AsyncUtils.ThrowIfEditorStopped();

                ScreenFader.ClearFade();

                await Task.Delay(5000);
                AsyncUtils.ThrowIfEditorStopped();

                ScreenFader.Crossfade(Color.blue, Color.red, 5.0f, false, false, false);

                await Task.Delay(1000);
                AsyncUtils.ThrowIfEditorStopped();

                SharedUtils.ChangeScene("TestScene");

                await Task.Delay(5000);
                AsyncUtils.ThrowIfEditorStopped();

                ScreenFader.FadeTo(Color.black, 1.0f, true, false, true);

                await Task.Delay(1500);
                AsyncUtils.ThrowIfEditorStopped();

                SharedUtils.EndGame();
            });
        }
Example #5
0
 static void Reload()
 {
     SharedUtils.ChangeScene(SceneManager.GetActiveScene().name);
 }
Example #6
0
 static void Warp(string scene)
 {
     SharedUtils.ChangeScene(scene);
 }
Example #7
0
        private void GotoNext(string next)
        {
            var nextLoc = ParseLocation(next);


            if (string.IsNullOrEmpty(nextLoc.Key) || nextLoc.Key == "this" || nextLoc.Key == CurrentSceneName)
            {
                if (nextLoc.Value == "default")
                {
                    PresentNewFrame(CurrentScene.Default);
                }
                else
                {
                    PresentNewFrame(nextLoc.Value);
                }
            }
            else if (nextLoc.Key == "meta")
            {
                //probably the only one carried over from Garlic Gang or Katana
                if (nextLoc.Value == "return")
                {
                    CloseDialogue();
                }
            }
            else if (nextLoc.Key == "shop")
            {
                var container = GameState.Instance.ContainerState[nextLoc.Value];
                ContainerModal.PushModal(GameState.Instance.PlayerRpgState.Inventory, container, true, null);
                if (!CurrentFrameObject.Options.AllowReturnFromShop)
                {
                    CloseDialogue();
                }
            }
            else if (nextLoc.Key == "scene")
            {
                CloseDialogue();

                //this has never been tested and I would not expect it to work in practise

                var sceneController = BaseSceneController.Current;

                if (sceneController != null)
                {
                    //extract additional data if possible
                    string spawnPoint = string.Empty;
                    var    arr        = next.Split('.');
                    if (arr.Length >= 3)
                    {
                        spawnPoint = arr[2];
                    }

                    //clean exit
                    WorldUtils.ChangeScene(nextLoc.Value, spawnPoint, Vector3.zero, Vector3.zero);
                }
                else
                {
                    SharedUtils.ChangeScene(nextLoc.Value);
                }
            }
            else if (nextLoc.Key == "script")
            {
                CloseDialogue();

                Scripting.ScriptingModule.Call(nextLoc.Value, new Scripting.ScriptExecutionContext()
                {
                    Caller = this
                }, null);
            }
            else
            {
                LoadScene(nextLoc.Key); //this loads a dialogue scene, not a Unity scene (it's confusing right?)
                if (nextLoc.Value == "default")
                {
                    PresentNewFrame(CurrentScene.Default);
                }
                else
                {
                    PresentNewFrame(nextLoc.Value);
                }
            }
        }