// Handle different conditions when the player joined quick match public override void OnJoinedRoom() { PhotonNetwork.playerName = GameObjectFinder.FindProfileHandler().UserName; if (PhotonNetwork.playerList.Length == 1) { if (LoadedFromFile && LoadFileExists()) { _status = "Save loaded, Waiting For other players to join in."; } else if (LoadedFromFile && !LoadFileExists()) { _status = "Save file not found, Please return to main menu."; PhotonNetwork.Disconnect(); } else { _status = "Waiting For other players to join in."; } StartCoroutine("CheckForPlayers"); } else { _countdownStarted = true; _status = "Other players found, game will start in: "; this.photonView.RPC("ResetCountDown", PhotonTargets.All); } }
public void Login(GameObject emailTextField) { string email = emailTextField.GetComponent <Text>().text; if (email == "") { AlertPage.SetActive(true); AlertPage.transform.GetChild(0).GetComponent <Text>().text = "Invalid Email Address"; } else { try { bool outcome = GlobalState.LoadProfileWithEmail(email); if (outcome == false) { Debug.LogWarning("login failed"); } else { GameObjectFinder.FindProfileHandler().LoggedIn(email); GoToMainMenu(); } } catch (ProfileMessagingException e) { DisplayError(e); } } }
// for load button public void LoadGame() { ProfileHandler ph = GameObjectFinder.FindProfileHandler(); ph.LoadedFromFile = true; StateController.SwitchToMatching(); }
// for multiPlayer button public void GoToQuickMatch() { ProfileHandler ph = GameObjectFinder.FindProfileHandler(); ph.LoadedFromFile = false; StateController.SwitchToMatching(); }
// Update the profile in profile handler public void UpdateProfile(bool win) { if (photonView.isMine) { ProfileHandler ph = GameObjectFinder.FindProfileHandler(); ph.UpdateProfile(this.NumKilled, this.NumDeath, win); } }
private void Start() { this._healthBarUI = this.GetComponent <HealthBarUI>(); CharId = photonView.viewID; // Find the user name from profile handler class if (photonView.isMine) { UserName = GameObjectFinder.FindProfileHandler().UserName; } }
public void RegisterSubmit() { string userName = RegisterUserNameField.text; string email = RegisterEmailField.text; try { int?uid = ProfileMessenger.CreateNewUser(userName, email); if (uid == null) { Debug.LogWarning("register failed"); } else { GlobalState.LoadProfileWithUid((int)uid); GameObjectFinder.FindProfileHandler().LoggedIn(email); GoToMainMenu(); } } catch (ProfileMessagingException e) { DisplayError(e); } }