IEnumerator LoadGameRoutine() { Debug.Log("First lets load wanted scene based on gamestate"); LoadSceneBasedOnState(); while (loadingScene) { yield return(new WaitForSeconds(0.1f)); } Debug.Log("Scene has been loaded set values"); GameDataGooglePlay gameData = Common.roundInformation.gameData; //FIrst load scene based on data RoundInformation ri = Common.roundInformation; PlayerInformation pi = Common.playerInformation; if (pi.isOnGame) { Common.infoGUI.setNewGuestion(ri.gameData.guestion); if (gameData.gameState == (int)GameStates.PickingPics) { if (pi.ready) { if (pi.myCloudImagePath.Length > 5) { Common.infoGUI.DisableReadyPressing(); Debug.Log("Loading image from cloud"); pi.LoadMyImageFromURL(); pi.SetReady(); Common.infoGUI.ChangeReadyButtonState(true); } else if (pi.myLocalImagePath.Length > 5) { Debug.Log("Loading image from local"); pi.LoadMyImageFromURL(pi.myLocalImagePath); pi.ready = false; } else { pi.ready = false; } } } if (gameData.gameState == (int)GameStates.PickingWinner) { Debug.Log("Creating picking winner scene"); Common.DebugPopUp("GameLoader loadinggameroutine gamestate is picking winner Gonna create elements and load all images"); Common.showWinnerMaster.CreateElements(Common.roundInformation.gameData.playerAmount); Common.showWinnerMaster.LoadAllImagesFromPlayerURLS(); } } else { //LOAD MENU } yield return(new WaitForEndOfFrame()); }
void LoadNewState(int gameState) { GameDataGooglePlay gameData = Common.roundInformation.gameData; //FIrst load scene based on data RoundInformation ri = Common.roundInformation; PlayerInformation pi = Common.playerInformation; if (gameData.AreWeOnPictureState()) { Debug.Log("Setting new guestion"); Common.infoGUI.setNewGuestion(ri.gameData.guestion); Debug.Log("new guestion has been set"); if (gameState == (int)GameStates.PickingPics) { Common.DebugPopUp("GameLoader loadingNewState routine", "Picking pics is the game state gonna check if we are ready and preload image if it exists"); if (pi.ready) { if (pi.myCloudImagePath.Length > 5) { Common.infoGUI.DisableReadyPressing(); Debug.Log("Loading image from cloud"); pi.LoadMyImageFromURL(); pi.SetReady(); Common.infoGUI.ChangeReadyButtonState(true); } else if (pi.myLocalImagePath.Length > 5) { Debug.Log("Loading image from local"); pi.LoadMyImageFromURL(pi.myLocalImagePath); pi.ready = false; } else { pi.ready = false; } } } if (gameData.gameState == (int)GameStates.PickingWinner) { // Common.showWinnerMaster.ClearPossiblePreviousElements(); Debug.Log("Creating picking winner scene"); Common.DebugPopUp("GameLoader loadinggameroutine gamestate is picking winner Gonna create elements and load all images"); Common.showWinnerMaster.CreateElements(Common.roundInformation.gameData.playerAmount); Debug.Log("Loading all images from playuer URL"); Common.showWinnerMaster.LoadAllImagesFromPlayerURLS(); } if (gameData.gameState == (int)GameStates.ShowingWinner) { Common.gameMaster.DetermineWinnerAndLoadTheSceneUI(); } } }