IEnumerator DefferGameStart() { yield return(new WaitForEndOfFrame()); Debug.Log("Launch casino"); if (this.debugGame == CasinoGameType.None) { GUIController.Instance.ShowScreen <LobbyScreen>(); GUIController.Instance.ShowScreen <TopBarScreen>(); } else { currentGameType = debugGame; currentSimpleGameTag = debugSimpleGameTag; LobbyGamesConfig newMainGame = DataManager.Instance.CasinoConfig.FindGame(debugGame); DataManager.Instance.LoadGameTypeConfig(newMainGame); DataManager.Instance.LoadSimpleGameConfig(debugSimpleGameTag); IGame mainGameObject = FindObjectsOfType <MonoBehaviour>().OfType <IGame>().FirstOrDefault(); if (mainGameObject != null) { mainGameObject.StartGame(); } else { Debug.LogError("IGame object not found in scene! Game didn't launch.."); } } }
public LobbyGamesConfig FindGame(CasinoGameType gameType) { int foundIndex = Array.FindIndex(allGames, curGame => curGame.gameType == gameType); if (foundIndex != -1) { return(allGames[foundIndex]); } else { Debug.LogError("Game " + gameType + " not found in configs!"); return(null); } }
public void Init(bool isDebug, bool isFakeShop, CasinoGameType debugGame, string debugSimpleGameTag) { this.debugGame = debugGame; this.debugSimpleGameTag = debugSimpleGameTag; this.isDebug = isDebug; this.isFakeShop = isFakeShop; if (!Debug.isDebugBuild) { this.debugGame = CasinoGameType.None; this.debugSimpleGameTag = ""; this.isDebug = false; this.isFakeShop = false; } }
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); } } }
IEnumerator LoadGame(CasinoGameType gameType) { yield return(null); progressSlider.value = 0.0f; string sceneName = ""; if (gameType == CasinoGameType.None) { sceneName = MENU_SCENE_NAME; } else { sceneName = DataManager.Instance.CurrentSimpleGameConfig.sceneName; } if (string.IsNullOrEmpty(sceneName)) { Debug.LogError("Loading scene is empty! Stopped."); yield break; } asyncLoad = SceneManager.LoadSceneAsync(sceneName); yield return(asyncLoad.isDone); Debug.Log("LoadingScene: finish loading"); progressSlider.value = 1.0f; asyncLoad = null; if (sceneName == MENU_SCENE_NAME) { GameManager.Instance.RestoreMenu(); } else { GameManager.Instance.ActivateSimpleGameOnScene(); } }
void OnGameClick(CasinoGameType gameType) { GUIController.Instance.HideScreen <LobbyScreen>(); GameManager.Instance.ActivateMainGame(gameType); }
public void ClearCurrentMainGame() { Debug.Log("Exit from main game. Old game: " + currentGameType); currentGameType = CasinoGameType.None; currentSimpleGameTag = ""; }