static private void ActuallyResetGame(PauseScreenController pauseScreen, Booth.QuickRestart parent, bool startNewGame) { if (!(pauseScreen is null)) { // Close the pause menu pauseScreen.InvokeMethod("OnDisable"); UnityEngine.Object.Destroy(pauseScreen.gameObject); } if (IsMultiplayerHost()) { RoR2.NetworkSession.instance.EndRun(); if (startNewGame) { parent.StartCoroutine(StartNewGameMultiplayer()); } } else { // This is probably deprecated after the Anniversary update if (!(Run.instance is null || Run.instance.gameObject is null)) { UnityEngine.Object.Destroy(Run.instance.gameObject);//CCRunEnd } if (startNewGame) { parent.StartCoroutine(StartNewGameSingleplayer()); } } }
void HandleResetKey() { if (Input.GetKey(ResetKeyCode)) { TimeSpentHoldingKey += Time.deltaTime; if (TimeSpentHoldingKey > ResetKeyThreshold && !ResetAlready) { /* * I would remember that the game has been reset and not allow * it to reset again until the key is released, except for some * reason, when resetting the game it thinks the key has been * released, so GetKeyUp gets called anyways. Oh well, I guess * we can just hold down the key and continuously reset. */ PauseScreenController PauseScreen = null; if (PauseScreenController.instancesList.Count > 0) { PauseScreen = PauseScreenController.instancesList[0]; } TimeSpentHoldingKey = 0f; ResetAlready = true; BoothUtil.ResetGame(PauseScreen, ConfigConfirmationDialog.Value, this, true); } } if (Input.GetKeyUp(ResetKeyCode)) { TimeSpentHoldingKey = 0f; ResetAlready = false; } }
static public void ResetGame(PauseScreenController pauseScreen, bool AskConfirmation, Booth.QuickRestart parent, bool startNewGame) { if (AskConfirmation) { if (SimpleDialogBox.instancesList.Count > 0) { // Don't create more than one window. return; } SimpleDialogBox confirmation = SimpleDialogBox.Create(); confirmation.headerToken = new SimpleDialogBox.TokenParamsPair("Are you sure?"); String description = "Are you sure you want to reset this run?"; if (pauseScreen is null) { description += " Use info screen button (usually tab/select) to move cursor."; } confirmation.descriptionToken = new SimpleDialogBox.TokenParamsPair(description); confirmation.AddActionButton(() => { ActuallyResetGame(pauseScreen, parent, startNewGame); }, "Yes"); confirmation.AddCancelButton("Cancel"); } else { // Avoid duplicate code but allow the dialog shenanigans ActuallyResetGame(pauseScreen, parent, startNewGame); } }
private void AssignReferences() { _GameScreen = FindObjectOfType <GameScreenController> (); _PauseScreen = FindObjectOfType <PauseScreenController> (); _GameSettingsScreen = FindObjectOfType <GameSettingScreenController> (); _LevelCompleteScreen = FindObjectOfType <LevelCompleteScreenController> (); }
public void Init() { kills = 0; wallsCreated = 0; wallsDestroyed = 0; roundTime = 0; resultsScreen = false; resultsController = GameObject.FindGameObjectWithTag("ResultsDisplay").GetComponent <ResultsScreenController>(); pauseController = GameObject.FindGameObjectWithTag("PauseScreen").GetComponent <PauseScreenController>(); readyText = GameObject.FindGameObjectWithTag("ReadyUpText"); }
// Use this for initialization void Start() { timerText.text = "00:00:00"; scoreText.text = "000,000,000"; throttleText.text = "0%"; lapText.text = "1/" + numberOfLaps.ToString(); startTimeOffset = 0.0f; currentLevelScore = 0; currentPlayerScoresEntryIndex = -1; throttlePopup = null; PauseScreenController[] pauseControllers = Resources.FindObjectsOfTypeAll <PauseScreenController>(); foreach (PauseScreenController current in pauseControllers) { if (current.gameObject.scene == UnityEngine.SceneManagement.SceneManager.GetActiveScene()) { thePauseScreenController = current; } } EndLevelMenuController[] endLevelMenuControllers = Resources.FindObjectsOfTypeAll <EndLevelMenuController>(); foreach (EndLevelMenuController current in endLevelMenuControllers) { if (current.gameObject.scene == UnityEngine.SceneManagement.SceneManager.GetActiveScene()) { theEndLevelMenuController = current; } } thePlayerPositionHistoryController = this.GetComponent <PlayerPositionHistoryControl>(); // Ensure the level failed UI element is hidden: levelFailedText.gameObject.SetActive(false); #if UNITY_IOS || UNITY_ANDROID || UNITY_WP8 || UNITY_IPHONE tutorialElement.gameObject.SetActive(true); // Display the tutorial popup on mobile only mainCanvasRectTransform = mainCanvas.GetComponent <RectTransform>(); #endif // Display the level start countdown: countdownTextPopup = null; StartCoroutine("UpdateCountdownText"); LoadScores(); // Load scores now, to avoid a hitch at the end of the race... IsWarmingUp = true; }
private IEnumerator CaptureScreen(PauseScreenController controller) { yield return(null); controller.GetComponentInChildren <TranslucentImage>().enabled = false; controller.mainPanel.gameObject.SetActive(false); // Wait for screen rendering to complete yield return(new WaitForEndOfFrame()); latestScreenshot = ScreenCapture.CaptureScreenshotAsTexture(); // Show UI after we're done controller.GetComponentInChildren <TranslucentImage>().enabled = true; controller.mainPanel.gameObject.SetActive(true); }
private void AssignReferences() { _GameScreen = FindObjectOfType <GameScreenController> (); _PauseScreen = FindObjectOfType <PauseScreenController> (); _GameOverScreen = FindObjectOfType <GameOverScreenController> (); }