예제 #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
파일: EndGameMenu.cs 프로젝트: zehreken/vd
        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
파일: ScoreService.cs 프로젝트: zehreken/vd
 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 }
     });
 }