Esempio n. 1
0
 public void Update()
 {
     if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.Escape))
     {
         if (CurrentListener != null)
         {
             if (CurrentListener != lastbackListener && CurrentListener.OnBack != null)
             {
                 CurrentListener.OnBack();
             }
         }
         else
         {
             if (uiStack.Count > 0)
             {
                 BackListener currentUI = uiStack.Peek();
                 if (currentUI != lastbackListener)
                 {
                     if (currentUI != null && currentUI.OnBack != null)
                     {
                         currentUI.OnBack();
                     }
                 }
             }
             else
             {
                 BackListener currentUI = uiStack.Peek();
                 if (currentUI != null && currentUI.OnQuit != null)
                 {
                     currentUI.OnQuit();
                 }
             }
         }
     }
 }
Esempio n. 2
0
 public void WindowClose(bool canBack, BackListener backListener)
 {
     if (canBack)
     {
         if (uiStack.Count > 0)
         {
             lastbackListener = uiStack.Pop();
         }
     }
     else
     {
         CurrentListener  = null;
         lastbackListener = null;
     }
 }
Esempio n. 3
0
        public void WindowOpen(bool isRoot, bool canBack, BackListener backListener)
        {
            if (isRoot)
            {
                uiStack.Clear();
            }

            if (canBack)
            {
                uiStack.Push(backListener);
            }
            else
            {
                CurrentListener = backListener;
            }
        }