예제 #1
0
        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());
                }
            }
        }
예제 #2
0
 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;
     }
 }
예제 #3
0
 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);
     }
 }
예제 #4
0
 private void AssignReferences()
 {
     _GameScreen          = FindObjectOfType <GameScreenController> ();
     _PauseScreen         = FindObjectOfType <PauseScreenController> ();
     _GameSettingsScreen  = FindObjectOfType <GameSettingScreenController> ();
     _LevelCompleteScreen = FindObjectOfType <LevelCompleteScreenController> ();
 }
예제 #5
0
    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");
    }
예제 #6
0
    // 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;
    }
예제 #7
0
        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);
        }
예제 #8
0
 private void AssignReferences()
 {
     _GameScreen     = FindObjectOfType <GameScreenController> ();
     _PauseScreen    = FindObjectOfType <PauseScreenController> ();
     _GameOverScreen = FindObjectOfType <GameOverScreenController> ();
 }