Exemple #1
0
 private void OnSettingsClick()
 {
     SettingsClickedEvent?.Invoke();
 }
    protected override void OnInitialize()
    {
        GameObjectUtilities.FindGameObject(_panelRoute + "/MenuPanel/SettingsButton").GetComponent <Button>().onClick.AddListener(() => SettingsClickedEvent?.Invoke());
        GameObjectUtilities.FindGameObject(_panelRoute + "/MenuPanel/LeaderboardButton").GetComponent <Button>().onClick.AddListener(() =>
        {
            SUGARManager.Leaderboard.Display("smi_stars", LeaderboardFilterType.Near);
            SendTrackerEvent("ViewLeaderboard");
        });
        GameObjectUtilities.FindGameObject(_panelRoute + "/MenuPanel/AchievementButton").GetComponent <Button>().onClick.AddListener(() =>
        {
            SUGARManager.Evaluation.DisplayAchievementList();
            SendTrackerEvent("ViewAchievements");
        });
        _panel        = GameObjectUtilities.FindGameObject(_panelRoute);
        _background   = GameObjectUtilities.FindGameObject("BackgroundContainer/MenuBackgroundImage");
        _playButton   = GameObjectUtilities.FindGameObject(_panelRoute + "/MenuPanel/PlayButton").GetComponent <Button>();
        _menuPanel    = GameObjectUtilities.FindGameObject(_panelRoute + "/MenuPanel");
        _quitPanel    = GameObjectUtilities.FindGameObject(_panelRoute + "/QuitPanel");
        _messagePanel = GameObjectUtilities.FindGameObject(_panelRoute + "/MessagePanel");

        _messagePanel.SetActive(false);
        _playButton.onClick.AddListener(() => PlayClickedEvent?.Invoke());
        _quitPanel.transform.FindButton("YesButton").onClick.AddListener(Application.Quit);
        _quitPanel.transform.FindButton("NoButton").onClick.AddListener(() => OnQuitAttempt(true));
    }