Exemple #1
0
        public void PushScreen <T>(bool isPopup) where T : GUIScreen
        {
            GUIScreen foundScreen = FoundScreen <T>();

            if (foundScreen != null)
            {
                PushScreen(foundScreen, isPopup);
            }
            else
            {
                Debug.LogWarning("Screen " + typeof(T) + " not found!");
            }
        }
Exemple #2
0
        public void ShowScreen <T>(bool hideAll = false) where T : GUIScreen
        {
            GUIScreen foundScreen = FoundScreen <T>();

            if (foundScreen != null)
            {
                ShowScreen(foundScreen, hideAll);
            }
            else
            {
                Debug.LogWarning("Screen " + typeof(T) + " not found!");
            }
        }
Exemple #3
0
        public void HideScreen <T>() where T : GUIScreen
        {
            GUIScreen foundScreen = FoundScreen <T>();

            if (foundScreen != null)
            {
                foundScreen.Hide();
                SortByLayer();
            }
            else
            {
                Debug.LogWarning("Screen " + typeof(T) + " not found!");
            }
        }
Exemple #4
0
        public void ShowScreen(GUIScreen screen, bool hideAll = false)
        {
            if (hideAll)
            {
                foreach (var curScreen in screens)
                {
                    if (curScreen.GetType() != screen.GetType())
                    {
                        curScreen.Hide();
                    }
                }
                screenStack.Clear();
            }

            screen.Show();
            SortByLayer();
        }
        public void ActivateMainGame(CasinoGameType gameType)
        {
            LobbyGamesConfig newMainGame = DataManager.Instance.CasinoConfig.FindGame(gameType);

            if (newMainGame != null)
            {
                currentGameType = gameType;
                Debug.Log("Activate main game: " + currentGameType);

                DataManager.Instance.LoadGameTypeConfig(newMainGame);

                GUIScreen gameLobbyScreen = GUIController.Instance.FoundScreen(newMainGame.gameLobby.GetType());
                if (gameLobbyScreen != null)
                {
                    GUIController.Instance.ShowScreen(gameLobbyScreen);
                }
            }
        }
Exemple #6
0
        public void PopScreen()
        {
            if (screenStack.Count == 0)
            {
                return;
            }

            GUIScreen curScreen = screenStack.Pop();

            curScreen.Hide();

            if (screenStack.Count > 0)
            {
                GUIScreen newScreen = screenStack.Peek();
                newScreen.Show();
                //newScreen.transform.SetAsLastSibling();
            }

            SortByLayer();
        }
Exemple #7
0
        void Start()
        {
            Debug.Log("GuiController start");
            foreach (var curPrefab in screenPrefabs)
            {
                // Debug.Log("Screen " + curPrefab.name + " instantiated");
                GameObject curScreen = Instantiate(curPrefab);
                if (screensRoot != null)
                {
                    curScreen.transform.SetParent(screensRoot.transform, false);
                }
                else
                {
                    curScreen.transform.SetParent(this.gameObject.transform, false);
                }

                GUIScreen guiScreen = curScreen.GetComponent <GUIScreen>();
                screens.Add(guiScreen);
            }

            //GUIScreen showedScreen = null;
            List <Button> buttons = new List <Button>();

            foreach (GUIScreen screen in screens)
            {
                foreach (Button btn in screen.GetComponentsInChildren <Button>(true).ToList().Where(x => !screen.IgnoreForPlayClickSoundButtons.Contains(x)))
                {
                    buttons.Add(btn);
                }
            }

            foreach (var curScreen in screens)
            {
                //if (curScreen.gameObject.activeSelf && showedScreen == null)
                //    showedScreen = curScreen;
                //else
                curScreen.gameObject.SetActive(false);
            }

            buttons.ForEach(x => x.onClick.AddListener(OnButtonClick));
        }
Exemple #8
0
        public void PushScreen(GUIScreen screen, bool isPopup)
        {
            if (!isPopup)
            {
                foreach (var curScreen in screenStack)
                {
                    Debug.Log(curScreen.gameObject);
                    curScreen.Hide();
                }
            }

            //screen.transform.SetAsLastSibling();
            screen.Show();
            screenStack.Push(screen);

            int i = 0;

            foreach (var curScreen in screenStack)
            {
                curScreen.OffsetZ = i++;
            }

            SortByLayer();
        }