예제 #1
0
 private void AddPreviousScreen(UI_Screen screen)
 {
     if (previousS.Count < 5)
     {
         previousS.Add(screen);
     }
     else
     {
         previousS.RemoveAt(0);
         previousS.Add(screen);
     }
 }
예제 #2
0
        public void SwitchScreen(UI_Screen screen)
        {
            if (screen)
            {
                if (currentScreen)
                {
                    currentScreen.CloseScreen();
                    currentScreen.gameObject.SetActive(false);
                    AddPreviousScreen(currentScreen);
                }

                currentScreen = screen;
                currentScreen.gameObject.SetActive(true);
                currentScreen.StartScreen();

                if (onSwitchedScreen != null)
                {
                    onSwitchedScreen.Invoke();
                }
            }
        }