示例#1
0
 private void OnDestroy()
 {
     _elements.PlayButton.onClick.RemoveListener(OnClickPlay);
     _elements.ToggleSoundButton.onClick.RemoveListener(OnClickToggleSound);
     MiniBus.UnsubscribeFromEvent(GameEvent.HighScore, OnUpdateHighScore);
     MiniBus.UnsubscribeFromEvent(GameEvent.GemCount, OnUpdateGemCount);
 }
示例#2
0
        public override void Initialize(MenuManager menuManager)
        {
            base.Initialize(menuManager);

            _elements.BackButton.onClick.AddListener(OnClickBack);
            _elements.RestartButton.onClick.AddListener(OnClickRestart);
            MiniBus.SubscribeToEvent(GameEvent.Score, OnUpdateScore);
        }
示例#3
0
        public override void Initialize(MenuManager menuManager)
        {
            base.Initialize(menuManager);

            MiniBus.SubscribeToEvent(GameEvent.Score, OnUpdateScore);
            MiniBus.SubscribeToEvent(GameEvent.HighScore, OnUpdateHighScore);
            MiniBus.SubscribeToEvent(GameEvent.GemCount, OnUpdateGemCount);
            _elements.HighScoreText.text = Services.GetScoreService().GetHighScore().ToString();
        }
示例#4
0
        public override void Initialize(MenuManager menuManager)
        {
            base.Initialize(menuManager);

            _elements.PlayButton.onClick.AddListener(OnClickPlay);
            _elements.ToggleSoundButton.onClick.AddListener(OnClickToggleSound);
            _elements.SoundImages[0].SetActive(Services.GetAudioService().IsMuted);
            _elements.SoundImages[1].SetActive(!Services.GetAudioService().IsMuted);
            _elements.HighScoreText.text = Services.GetScoreService().GetHighScore().ToString();
            _elements.GemCountText.text  = Services.GetScoreService().GetGemCount().ToString();

            MiniBus.SubscribeToEvent(GameEvent.HighScore, OnUpdateHighScore);
            MiniBus.SubscribeToEvent(GameEvent.GemCount, OnUpdateGemCount);
        }
示例#5
0
 private void UpdateUi()
 {
     MiniBus.PublishEvent(GameEvent.Score, new Dictionary <string, object>
     {
         { "score", _score }
     });
     MiniBus.PublishEvent(GameEvent.HighScore, new Dictionary <string, object>
     {
         { "high_score", _highScore }
     });
     MiniBus.PublishEvent(GameEvent.GemCount, new Dictionary <string, object>
     {
         { "gem_count", _gemCount }
     });
 }