protected override void MapButtons( )
 {
     foreach (Button btn in menuButtons)
     {
         if (btn.CompareTag(TagsUI.startNewGameBtn))               // btn - starts a new round
         {
             btn.onClick.RemoveAllListeners( );
             btn.onClick.AddListener(() => {
                 float loadTime                    = .6f;
                 IState nextState                  = new RoundLoadState(loadTime);
                 IStateTransition transition       = new MenuExitTransition(menuObject);
                 StateBeginExitEvent newRoundState = new StateBeginExitEvent(nextState, transition);
                 audioplayer.PlayOneShot(btnClick);
                 RaiseUIEvent(newRoundState);
             });
         }
         else if (btn.CompareTag(TagsUI.settingsMenuBtn))          // btn - toggle settings menu
         {
             btn.onClick.RemoveAllListeners( );
             btn.onClick.AddListener(() => {
                 audioplayer.PlayOneShot(btnClick);
                 Debug.Log("[MainMenu][OnToggleSettingsMenu] Settings menu not yet implemented ... ");
             });
         }
         else if (btn.CompareTag(TagsUI.exitApp))
         {
             btn.onClick.RemoveAllListeners( );
             btn.onClick.AddListener(() => {
                 audioplayer.PlayOneShot(btnClick);
                 Application.Quit( );
                 Debug.Log("[MainMenu][MapButtons] You're in the editor, you can't quit! Just toggle the play button !");
             });
         }
     }
 }
示例#2
0
    protected override void MapButtons( )
    {
        foreach (Button btn in menuButtons)
        {
            if (btn.CompareTag(TagsUI.startNewGameBtn))                   // btn - starts a new round
            {
                btn.onClick.RemoveAllListeners( );
                btn.onClick.AddListener(() => {
                    float fadeTime = 1.8f;
                    SFXMasterController.PlayNoMercyClip( );
                    IState nextState                  = new RoundLoadState(fadeTime);
                    IStateTransition transition       = new MenuExitTransition(menuObject);
                    StateBeginExitEvent newRoundState = new StateBeginExitEvent(nextState, transition);
                    audioplayer.PlayOneShot(btnClick);
                    musicplayer.MusicCheck(true);

                    RaiseUIEvent(newRoundState);
                });
            }
            else if (btn.CompareTag(TagsUI.returnToMainMenuBtn))          // btn - returns to main menu
            {
                btn.onClick.RemoveAllListeners( );
                btn.onClick.AddListener(() => {
                    IState nextState            = new MainMenuState();
                    IStateTransition transition = new LoadingTransition(menuObject);
                    StateBeginExitEvent returnToMainMenustate = new StateBeginExitEvent(nextState, transition);
                    audioplayer.PlayOneShot(btnClick);

                    RaiseUIEvent(returnToMainMenustate);
                });
            }
            else if (btn.CompareTag(TagsUI.settingsMenuBtn))              // btn - opens settings menu
            {
                btn.onClick.RemoveAllListeners( );
                btn.onClick.AddListener(() => {
                    audioplayer.PlayOneShot(btnClick);
                    Debug.Log("[EndOfRoundMenu][OnToggleSettingsMenu] Settings menu not yet implemented ... ");
                });
            }
        }
    }