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!"); } }
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!"); } }
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!"); } }
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); } } }
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(); }
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)); }
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(); }