Example #1
0
 //功能暂时屏蔽
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         if (scene.Count > 0)
         {
             //如果在游戏界面,并且打开了胜利界面,直接进到下一关的游戏
             if (SceneManager.GetActiveScene().buildIndex == Const.SCENE_MAINGAME && DialogController.instance.IsDialogShowing(DialogType.Win))
             {
                 WinDialog.instance.NextClick(false);
             }
             //先判断弹窗是否是打开的是的话,就关闭弹窗
             else if (DialogController.instance.IsDialogShowing())
             {
                 DialogController.instance.CloseCurrentDialog();
             }
             //如果在游戏界面,没有任何弹窗弹出的情况下,弹出暂停。
             else if (showPauseIndex.Contains(SceneManager.GetActiveScene().buildIndex))
             {
                 DialogController.instance.ShowDialog(DialogType.Pause);
                 PauseDialog pause = DialogController.instance.current.GetComponent <PauseDialog> ();
                 if (pause != null)
                 {
                     if (SceneManager.GetActiveScene().buildIndex == Const.SCENE_MAINGAME)
                     {
                         pause.SetMenuIndex(Const.SCENE_MAP);
                     }
                     else
                     {
                         pause.SetMenuIndex(Const.SCENE_DAILY);
                     }
                 }
             }
             else
             {
                 BackLastScene();
             }
         }
         else
         {
             Application.Quit();
         }
     }
 }
Example #2
0
    public override void OnButtonClick()
    {
        base.OnButtonClick();
        DialogController.instance.ShowDialog(DialogType.Pause, DialogShow.DONT_SHOW_IF_OTHERS_SHOWING);
        PauseDialog pause = DialogController.instance.current.GetComponent <PauseDialog> ();

        if (pause != null)
        {
            pause.SetMenuIndex(menuIndex);
        }
    }