/// <summary> /// Control checking, and way more. /// </summary> void Update() { #if UNITY_STANDALONE_WIN if (fullscreenSwitch == 1) { StartCoroutine(RepositionWindow()); } if (fullscreenSwitch > 0) { fullscreenSwitch--; } #endif stopScreenShake = false; if (isInFight || UnitaleUtil.IsOverworld) { frame++; } string sceneName = SceneManager.GetActiveScene().name; if (sceneName == "ModSelect") { lastSceneUnitale = true; } else { lastSceneUnitale = false; } // Activate Debugger if (UserDebugger.instance && Input.GetKeyDown(KeyCode.F9)) { if (UserDebugger.instance.gameObject.activeSelf) { GameObject.Find("Text").transform.SetParent(UserDebugger.instance.gameObject.transform); } UserDebugger.instance.gameObject.SetActive(!UserDebugger.instance.gameObject.activeSelf); Camera.main.GetComponent <FPSDisplay>().enabled = UserDebugger.instance.gameObject.activeSelf; // Activate Hitbox Debugger } else if (isInFight && Input.GetKeyDown(KeyCode.H) && sceneName != "Error" && UserDebugger.instance.gameObject.activeSelf) { GameObject.Find("Main Camera").GetComponent <ProjectileHitboxRenderer>().enabled = !GameObject.Find("Main Camera").GetComponent <ProjectileHitboxRenderer>().enabled; } // Exit a battle or the Error scene else if (Input.GetKeyDown(KeyCode.Escape) && (canTransOW.Contains(sceneName) || isInFight)) { if (isInFight && LuaEnemyEncounter.script.GetVar("unescape").Boolean&& sceneName != "Error") { return; } if (sceneName == "Error" && !modDev) { UnitaleUtil.ExitOverworld(); SceneManager.LoadScene("Disclaimer"); GameObject.Destroy(GameObject.Find("SpritePivot")); return; } if (GameOverBehavior.gameOverContainer) { if (GameOverBehavior.gameOverContainer.activeInHierarchy) { GameObject.FindObjectOfType <GameOverBehavior>().EndGameOver(); } else { UIController.EndBattle(); } } else { UIController.EndBattle(); } //StaticInits.Reset(); //Open the Menu in the Overworld } else if (input.Menu == UndertaleInput.ButtonState.PRESSED && !nonOWScenes.Contains(sceneName) && !isInFight && !isInShop && (!GameOverBehavior.gameOverContainerOw || !GameOverBehavior.gameOverContainerOw.activeInHierarchy)) { if (!PlayerOverworld.instance.PlayerNoMove && EventManager.instance.script == null && !PlayerOverworld.instance.menuRunning[2] && !PlayerOverworld.instance.menuRunning[4] && (GameObject.Find("FadingBlack") == null || GameObject.Find("FadingBlack").GetComponent <Fading>().alpha <= 0)) { StartCoroutine(PlayerOverworld.LaunchMenu()); } //Wipe save and close CYF in the Error scene if save failed to load } else if (sceneName == "Error" && allowWipeSave && Input.GetKeyDown(KeyCode.R)) { System.IO.File.Delete(Application.persistentDataPath + "/save.gd"); Application.Quit(); } if (isInFight) { switch (fleeIndex) { case 0: if (Input.GetKeyDown(KeyCode.F)) { fleeIndex++; } break; case 1: if (Input.GetKeyDown(KeyCode.L)) { fleeIndex++; } else if (Input.anyKeyDown) { fleeIndex = 0; } break; case 2: if (Input.GetKeyDown(KeyCode.E)) { fleeIndex++; } else if (Input.anyKeyDown) { fleeIndex = 0; } break; case 3: if (Input.GetKeyDown(KeyCode.E)) { fleeIndex++; } else if (Input.anyKeyDown) { fleeIndex = 0; } break; case 4: if (Input.GetKeyDown(KeyCode.S)) { fleeIndex = -1; UIController.instance.SuperFlee(); } else if (Input.anyKeyDown) { fleeIndex = 0; } break; } } if (ScreenResolution.hasInitialized) { if (Input.GetKeyDown(KeyCode.F4) || // F4 (Input.GetKeyDown(KeyCode.Return) && (Input.GetKey(KeyCode.LeftAlt) || // LAlt + Enter Input.GetKey(KeyCode.RightAlt)))) // RAlt + Enter { ScreenResolution.SetFullScreen(!Screen.fullScreen); if (!Screen.fullScreen) { StartCoroutine(UpdateMonitorSize()); } } } }
/// <summary> /// Control checking, and way more. /// </summary> void Update() { if (fullscreenSwitch != 0) { StartCoroutine(ChangeAspectRatio()); #if UNITY_STANDALONE_WIN if (!Screen.fullScreen && fullscreenSwitch == 1) { StartCoroutine(RepositionWindow()); } #endif fullscreenSwitch--; } stopScreenShake = false; if (isInFight) { frame++; } if (SceneManager.GetActiveScene().name == "ModSelect") { lastSceneUnitale = true; } else { lastSceneUnitale = false; } if (UserDebugger.instance && Input.GetKeyDown(KeyCode.F9)) { if (UserDebugger.instance.gameObject.activeSelf) { GameObject.Find("Text").transform.SetParent(UserDebugger.instance.gameObject.transform); } UserDebugger.instance.gameObject.SetActive(!UserDebugger.instance.gameObject.activeSelf); Camera.main.GetComponent <FPSDisplay>().enabled = !Camera.main.GetComponent <FPSDisplay>().enabled; } else if (isInFight && Input.GetKeyDown(KeyCode.H) && SceneManager.GetActiveScene().name != "Error" && UserDebugger.instance.gameObject.activeSelf) { GameObject.Find("Main Camera").GetComponent <ProjectileHitboxRenderer>().enabled = !GameObject.Find("Main Camera").GetComponent <ProjectileHitboxRenderer>().enabled; } else if (Input.GetKeyDown(KeyCode.Escape) && (canTransOW.Contains(SceneManager.GetActiveScene().name) || isInFight)) { if (isInFight && LuaEnemyEncounter.script.GetVar("unescape").Boolean&& SceneManager.GetActiveScene().name != "Error") { return; } if (SceneManager.GetActiveScene().name == "Error" && !modDev) { return; } if (GameOverBehavior.gameOverContainer) { if (GameOverBehavior.gameOverContainer.activeInHierarchy) { GameObject.FindObjectOfType <GameOverBehavior>().EndGameOver(); } else { UIController.EndBattle(); } } else { UIController.EndBattle(); } //StaticInits.Reset(); } else if (input.Menu == UndertaleInput.ButtonState.PRESSED && !nonOWScenes.Contains(SceneManager.GetActiveScene().name) && !isInFight) { if (!PlayerOverworld.instance.PlayerNoMove && EventManager.instance.script == null && !PlayerOverworld.instance.menuRunning[2] && !PlayerOverworld.instance.menuRunning[4] && EventManager.instance.script == null && GameObject.Find("FadingBlack").GetComponent <Fading>().alpha <= 0) { StartCoroutine(PlayerOverworld.LaunchMenu()); } } //else if (Input.GetKeyDown(KeyCode.L)) // MyFirstComponentClass.SpriteAnalyser(); if (isInFight) { switch (fleeIndex) { case 0: if (Input.GetKeyDown(KeyCode.F)) { fleeIndex++; } break; case 1: if (Input.GetKeyDown(KeyCode.L)) { fleeIndex++; } else if (Input.anyKeyDown) { fleeIndex = 0; } break; case 2: if (Input.GetKeyDown(KeyCode.E)) { fleeIndex++; } else if (Input.anyKeyDown) { fleeIndex = 0; } break; case 3: if (Input.GetKeyDown(KeyCode.E)) { fleeIndex++; } else if (Input.anyKeyDown) { fleeIndex = 0; } break; case 4: if (Input.GetKeyDown(KeyCode.S)) { fleeIndex = -1; UIController.instance.SuperFlee(); } else if (Input.anyKeyDown) { fleeIndex = 0; } break; } } if (Input.GetKeyDown(KeyCode.F4) || // F4 (Input.GetKeyDown(KeyCode.Return) && (Input.GetKey(KeyCode.LeftAlt) || // LAlt + Enter Input.GetKey(KeyCode.RightAlt)))) // RAlt + Enter { SetFullScreen(!Screen.fullScreen); } }
/// <summary> /// Run once per frame. /// </summary> private void Update() { // Update Discord RPC DiscordControls.Update(); #if UNITY_STANDALONE_WIN // Reposition the window to the middle of the screen after exiting fullscreen if (fullscreenSwitch == 1) { StartCoroutine(RepositionWindow()); } if (fullscreenSwitch > 0) { fullscreenSwitch--; } #endif // Frame counter used for logging purposes if (isInFight || UnitaleUtil.IsOverworld) { frame++; } string sceneName = SceneManager.GetActiveScene().name; // Activate Debugger if (UserDebugger.instance && Input.GetKeyDown(KeyCode.F9) && UserDebugger.instance.canShow) { UserDebugger.instance.gameObject.SetActive(!UserDebugger.instance.gameObject.activeSelf); Camera.main.GetComponent <FPSDisplay>().enabled = UserDebugger.instance.gameObject.activeSelf; } // Activate Hitbox Debugger else if (isInFight && Input.GetKeyDown(KeyCode.H) && sceneName != "Error" && UserDebugger.instance.gameObject.activeSelf) { gameObject.GetComponent <ProjectileHitboxRenderer>().enabled = !gameObject.GetComponent <ProjectileHitboxRenderer>().enabled; } // Exit a battle or the Error scene else if (Input.GetKeyDown(KeyCode.Escape) && (canTransOW.Contains(sceneName) || isInFight)) { if (isInFight && EnemyEncounter.script.GetVar("unescape").Boolean&& sceneName != "Error") { return; } // The Error scene can only be exited if we entered the mod through the mod selection screen if (sceneName == "Error" && !modDev) { UnitaleUtil.ExitOverworld(); SceneManager.LoadScene("Disclaimer"); DiscordControls.StartTitle(); Destroy(GameObject.Find("SpritePivot")); return; } if (GameOverBehavior.gameOverContainer) { if (GameOverBehavior.gameOverContainer.activeInHierarchy) { FindObjectOfType <GameOverBehavior>().EndGameOver(); } else { UIController.EndBattle(); } } else { UIController.EndBattle(); } } // Open the Menu in the Overworld else if (input.Menu == UndertaleInput.ButtonState.PRESSED && !nonOWScenes.Contains(sceneName) && !isInFight && !isInShop && (!GameOverBehavior.gameOverContainerOw || !GameOverBehavior.gameOverContainerOw.activeInHierarchy)) { if (!PlayerOverworld.instance.PlayerNoMove && EventManager.instance.script == null && !PlayerOverworld.instance.menuRunning[2] && !PlayerOverworld.instance.menuRunning[4] && (GameObject.Find("FadingBlack") == null || GameObject.Find("FadingBlack").GetComponent <Fading>().alpha <= 0)) { StartCoroutine(PlayerOverworld.LaunchMenu()); } } // Wipe save and close CYF in the Error scene if save failed to load else if (sceneName == "Error" && allowWipeSave && Input.GetKeyDown(KeyCode.R)) { System.IO.File.Delete(Application.persistentDataPath + "/save.gd"); Application.Quit(); } // Enter fullscreen using given shortcuts if (!ScreenResolution.hasInitialized) { return; } if (!Input.GetKeyDown(KeyCode.F4) && (!Input.GetKeyDown(KeyCode.Return) || !Input.GetKey(KeyCode.LeftAlt) && !Input.GetKey(KeyCode.RightAlt))) { return; // RAlt + Enter } ScreenResolution.SetFullScreen(!Screen.fullScreen); if (!Screen.fullScreen) { StartCoroutine(UpdateMonitorSize()); } }
/// <summary> /// Control checking, and way more. /// </summary> void Update() { frame++; if (SceneManager.GetActiveScene().name == "EncounterSelect") { lastSceneUnitale = true; } else { lastSceneUnitale = false; } if (UserDebugger.instance && Input.GetKeyDown(KeyCode.F9)) { if (UserDebugger.instance.gameObject.activeSelf) { GameObject.Find("Text").transform.SetParent(UserDebugger.instance.gameObject.transform); } UserDebugger.instance.gameObject.SetActive(!UserDebugger.instance.gameObject.activeSelf); Camera.main.GetComponent <FPSDisplay>().enabled = !Camera.main.GetComponent <FPSDisplay>().enabled; } else if (isInFight && Input.GetKeyDown(KeyCode.H)) { GameObject.Find("Main Camera").GetComponent <ProjectileHitboxRenderer>().enabled = !GameObject.Find("Main Camera").GetComponent <ProjectileHitboxRenderer>().enabled; } else if (Input.GetKeyDown(KeyCode.Escape) && (canTransOW.Contains(SceneManager.GetActiveScene().name) || isInFight)) { if (isInFight && LuaEnemyEncounter.script.GetVar("unescape").Boolean) { return; } if (SceneManager.GetActiveScene().name == "Error" && !modDev) { return; } UIController.EndBattle(GameOverBehavior.gameOverContainer ? !GameOverBehavior.gameOverContainer.activeInHierarchy : true); if (GameOverBehavior.gameOverContainer) { if (GameOverBehavior.gameOverContainer.gameObject.activeInHierarchy) { Destroy(GameObject.FindObjectOfType <GameOverBehavior>().gameObject); if (UnitaleUtil.IsOverworld) { GameObject.Destroy(GameOverBehavior.gameOverContainer); } if (!modDev) { SaveLoad.Load(); SceneManager.LoadScene("TransitionOverworld"); } else { SceneManager.LoadScene("ModSelect"); } } } //StaticInits.Reset(); } else if (input.Menu == UndertaleInput.ButtonState.PRESSED && !nonOWScenes.Contains(SceneManager.GetActiveScene().name) && !isInFight) { if (!PlayerOverworld.instance.PlayerNoMove && EventManager.instance.script == null && !PlayerOverworld.instance.menuRunning[2] && !PlayerOverworld.instance.menuRunning[4] && EventManager.instance.script == null) { StartCoroutine(PlayerOverworld.LaunchMenu()); } } if (Input.GetKeyDown(KeyCode.F4)) { Screen.fullScreen = !Screen.fullScreen; } //else if (Input.GetKeyDown(KeyCode.L)) // MyFirstComponentClass.SpriteAnalyser(); if (isInFight) { switch (fleeIndex) { case 0: if (Input.GetKeyDown(KeyCode.F)) { fleeIndex++; } break; case 1: if (Input.GetKeyDown(KeyCode.L)) { fleeIndex++; } else if (Input.anyKeyDown) { fleeIndex = 0; } break; case 2: if (Input.GetKeyDown(KeyCode.E)) { fleeIndex++; } else if (Input.anyKeyDown) { fleeIndex = 0; } break; case 3: if (Input.GetKeyDown(KeyCode.E)) { fleeIndex++; } else if (Input.anyKeyDown) { fleeIndex = 0; } break; case 4: if (Input.GetKeyDown(KeyCode.S)) { fleeIndex = -1; UIController.instance.SuperFlee(); } else if (Input.anyKeyDown) { fleeIndex = 0; } break; } } if (Screen.currentResolution.height != 480 || Screen.currentResolution.width != 640) { Screen.SetResolution(640, 480, false, 0); } stopScreenShake = false; }