private void UpdateUiBasedOnVoiceState(Photon.Realtime.ClientState voiceClientState) { this.voiceState.text = string.Format("PhotonVoice: {0}", voiceClientState); if (voiceClientState == Photon.Realtime.ClientState.Joined) { voiceState.gameObject.SetActive(false); } }
// Update is called once per frame void Update() { Photon.Realtime.ClientState status = PhotonNetwork.NetworkClientState; if (status == Photon.Realtime.ClientState.Joined) { GetComponent <TMPro.TMP_Text>().text = "Waiting for players"; } else { GetComponent <TMPro.TMP_Text>().text = status.ToString(); } }
private void UpdateUiBasedOnVoiceState(Photon.Realtime.ClientState voiceClientState) { this.voiceState.text = string.Format("PhotonVoice: {0}", voiceClientState); switch (voiceClientState) { case Photon.Realtime.ClientState.Joined: this.voiceSwitch.interactable = true; this.inGameSettings.SetActive(true); this.voiceSwitchText.text = "Voice Disconnect"; this.InitToggles(this.inGameSettings.GetComponentsInChildren <Toggle>()); if (this.recorder != null) { this.calibrateButton.interactable = !this.recorder.VoiceDetectorCalibrating; this.calibrateText.text = this.recorder.VoiceDetectorCalibrating ? "Calibrating" : string.Format("Calibrate ({0}s)", this.calibrationMilliSeconds / 1000); } else { this.calibrateButton.interactable = false; this.calibrateText.text = "Unavailable"; } break; case Photon.Realtime.ClientState.PeerCreated: case Photon.Realtime.ClientState.Disconnected: if (PhotonNetwork.InRoom) { this.voiceSwitch.interactable = true; this.voiceSwitchText.text = "Voice Connect"; this.voiceDebugText.text = String.Empty; } else { this.voiceSwitch.interactable = false; this.voiceSwitchText.text = "Voice N/A"; this.voiceDebugText.text = String.Empty; } this.calibrateButton.interactable = false; this.voiceSwitchText.text = "Voice Connect"; this.calibrateText.text = "Unavailable"; this.inGameSettings.SetActive(false); break; default: this.voiceSwitch.interactable = false; this.voiceSwitchText.text = "Voice busy"; break; } }
private void PunClientStateChanged(Photon.Realtime.ClientState fromState, Photon.Realtime.ClientState toState) { switch (toState) { case Photon.Realtime.ClientState.PeerCreated: case Photon.Realtime.ClientState.Disconnected: break; case Photon.Realtime.ClientState.Joined: break; default: break; } this.UpdateUiBasedOnVoiceState(this.punVoiceNetwork.ClientState); }
private void Update() { if (lastState != PhotonNetwork.NetworkClientState) { lastState = PhotonNetwork.NetworkClientState; if (stateVariable != null) { if (stateVariable.variableType == VariableProperty.GetVarType.LocalVariable) { stateVariable.local.Set(lastState.ToString(), gameObject); } else { stateVariable.global.Set(lastState.ToString(), gameObject); } //variable.ToStringValue(gameObject) //Variable var = vars.Get(localVariableName); //if(var != null) var.Set(Variable.DataType.String, lastState.ToString()); } ExecuteTrigger(gameObject); } }
private void PunClientStateChanged(Photon.Realtime.ClientState fromState, Photon.Realtime.ClientState toState) { this.punState.text = string.Format("PUN: {0}", toState); switch (toState) { case Photon.Realtime.ClientState.PeerCreated: case Photon.Realtime.ClientState.Disconnected: this.punSwitch.interactable = true; this.punSwitchText.text = "PUN Connect"; break; case Photon.Realtime.ClientState.Joined: this.punSwitch.interactable = true; this.punSwitchText.text = "PUN Disconnect"; break; default: this.punSwitch.interactable = false; this.punSwitchText.text = "PUN busy"; break; } this.UpdateUiBasedOnVoiceState(this.punVoiceNetwork.ClientState); }
private void UpdateUiBasedOnVoiceState(Photon.Realtime.ClientState voiceClientState) { switch (voiceClientState) { case Photon.Realtime.ClientState.Joined: LevelUIManager.Instance.OpenChoseTeamMenu(); break; case Photon.Realtime.ClientState.PeerCreated: case Photon.Realtime.ClientState.Disconnected: if (PhotonNetwork.InRoom) { } else { } break; default: break; } }
private void VoiceClientStateChanged(Photon.Realtime.ClientState fromState, Photon.Realtime.ClientState toState) { this.UpdateUiBasedOnVoiceState(toState); }
/// <summary> /// Callback method. Called whenever the state of the voice client changes. This is used to set /// the `connectionStatus` status variable. /// </summary> /// <param name="fromState">Photon.Realtime.ClientState type, the state you were in</param> /// <param name="toState">Photon.Realtime.ClientState type, the state your now in</param> protected virtual void VoiceClientStateChanged(Photon.Realtime.ClientState fromState, Photon.Realtime.ClientState toState) { switch (toState) { case Photon.Realtime.ClientState.Authenticating: connectionStatus = "Authenticating with master server..."; break; case Photon.Realtime.ClientState.Authenticated: connectionStatus = "Successfully authenticated with master server."; break; case Photon.Realtime.ClientState.ConnectedToGameServer: connectionStatus = "Connected to game server."; break; case Photon.Realtime.ClientState.ConnectedToMasterServer: connectionStatus = "Connected to master server."; foreach (vThirdPersonController controller in FindObjectsOfType <vThirdPersonController>()) { if (controller.GetComponent <PhotonView>().IsMine) { if (controller) { SetSpeakerPrefab(controller.gameObject); } else if (GetComponent <Speaker>()) { SetSpeakerPrefab(gameObject); } break; } } OnConnectedToServer.Invoke(); break; case Photon.Realtime.ClientState.ConnectedToNameServer: connectionStatus = "Connected to name server."; break; case Photon.Realtime.ClientState.Disconnected: connectionStatus = "Disconnected."; connectedToRoom = false; OnDisconnect.Invoke(); break; case Photon.Realtime.ClientState.Disconnecting: connectionStatus = "Disconnecting..."; break; case Photon.Realtime.ClientState.DisconnectingFromGameServer: connectionStatus = "Disconnecting from game server..."; break; case Photon.Realtime.ClientState.DisconnectingFromMasterServer: connectionStatus = "Disconnecting from master server..."; break; case Photon.Realtime.ClientState.Joined: connectionStatus = "Successfully joined a room."; connectedToRoom = true; OnJoinRoom.Invoke(); break; case Photon.Realtime.ClientState.JoinedLobby: connectionStatus = "Succesffully joined the lobby."; break; case Photon.Realtime.ClientState.Joining: connectionStatus = "Joining room..."; break; case Photon.Realtime.ClientState.JoiningLobby: connectionStatus = "Joining lobby..."; break; case Photon.Realtime.ClientState.Leaving: connectionStatus = "Leaving room..."; connectedToRoom = false; break; case Photon.Realtime.ClientState.PeerCreated: connectionStatus = "Peer created."; break; } if (debugging == true) { Debug.Log(connectionStatus); } }