private void OnLevelWasLoaded(int level) { if (level == MAINMENU_SCENE_NUMBER) { // Skip login from other scenes if already logged in if (IsLogedIn) { GameObject.Find("Canvas").transform.FindChild("Login").gameObject.SetActive(false); GameObject.Find("Canvas").transform.FindChild("MainMenu").gameObject.SetActive(true); } // Update the profile to the server if not updated yet if (IsLogedIn && !AlreadyUpdated) { Profile oldProfile = ProfileMessenger.GetProfileByEmail(UserName); oldProfile.numGamesPlayed += 1; oldProfile.numDeath += Death; oldProfile.numPlayerKilled += Kill; if (Won) { oldProfile.numGamesWon++; } else { oldProfile.numGamesLost++; } ResetStats(); ProfileMessenger.SubmitNewProfile(oldProfile); } } // Inform RandomMatchMaker if the player has chosen to load from save file if (level == MATCHING_SCENE_NUMBER) { RandomMatchmaker rm = GameObjectFinder.FindRandomMatchMaker(); rm.LoadedFromFile = LoadedFromFile; } if (level == RESULT_SCENE_NUMBER) { // Display stats in result scene ResultPageController rpc = GameObjectFinder.FindResultPageController(); rpc.IsWinner = Won; rpc.UserName = UserName; rpc.Kill = Kill; rpc.Death = Death; } }
public static bool LoadProfileWithEmail(string email) { GlobalState.Instance._profile = ProfileMessenger.GetProfileByEmail(email); return(true); }