Пример #1
0
 public void ToggleWarning()
 {
     if (canvas.activeSelf)
     {
         canvas.SetActive(false);
         warning = Warning.CreateWarning("Are you sure you want to reset your highscores?");
         var yesBtn = Warning.GetYesBtn(warning);
         var noBtn  = Warning.GetNoBtn(warning);
         noBtn.onClick.AddListener(() => ToggleWarning());
         yesBtn.onClick.AddListener(() => ResetScores());
     }
     else
     {
         canvas.SetActive(true);
         Menu.SwitchFocus(resetBtn);
     }
 }
Пример #2
0
    void CreateRestartWarning()
    {
        if (gameOver)
        {
            RestartGame();
            return;
        }

        currWarning = Warning.CreateWarning("Are you sure you want to restart the game?");

        var warning = currWarning.transform;

        // obtaining button component
        var yesBtn = Warning.GetYesBtn(currWarning);
        var noBtn  = Warning.GetNoBtn(currWarning);

        // adding button events
        yesBtn.onClick.AddListener(() => RestartGame());
        noBtn.onClick.AddListener(() => ResumeGame());
    }
Пример #3
0
    public void CreateReturnWarning()
    {
        if (gameOver)
        {
            menu.ChangeScene("Main Menu");
            return;
        }

        currWarning = Warning.CreateWarning("Are you sure you want to return to main menu?");

        var warning = currWarning.transform;

        // obtaining button component
        var yesBtn = Warning.GetYesBtn(currWarning);
        var noBtn  = Warning.GetNoBtn(currWarning);

        // adding button events
        yesBtn.onClick.AddListener(() => menu.ChangeScene("Main Menu"));
        noBtn.onClick.AddListener(() => ToggleWarning(false));
    }