public void LeaveRoom() { this._pendingRoomJoinRequest = null; if (PhotonNetwork.IsConnected && PhotonNetwork.CurrentRoom != null) { PhotonNetwork.LeaveRoom(); } }
public override void OnCreateRoomFailed(short returnCode, string message) { if (this._pendingRoomJoinRequest != null) { DebugLog.LogColor("Create room failed . Failure reason: " + returnCode.ToString(), LogColor.blue); if (this._pendingRoomJoinRequest.failureCallback != null) { this._pendingRoomJoinRequest.failureCallback.Invoke(); } this._pendingRoomJoinRequest = null; } }
public override void OnJoinedRoom() { if (this._pendingRoomJoinRequest != null) { DebugLog.LogColor("Successfully joined room", LogColor.green); if (this._pendingRoomJoinRequest.successCallback != null) { this._pendingRoomJoinRequest.successCallback.Invoke(); } this._pendingRoomJoinRequest = null; } }
public override void OnDisconnected(DisconnectCause cause) { if (this._pendingRoomJoinRequest != null) { if (this._pendingRoomJoinRequest.failureCallback != null) { DebugLog.LogWarningColor("PhotonNetwork disconnected with pending room join request. Cause: " + cause.ToString(), LogColor.orange); this._pendingRoomJoinRequest.failureCallback.Invoke(); } this._pendingRoomJoinRequest = null; } else { DebugLog.LogColor("PhotonNetwork disconnected. Cause: " + cause.ToString(), LogColor.blue); } }
public void CreateOrJoinRandomRoom(System.Action successCallback, System.Action failureCallback) { if (this._pendingRoomJoinRequest != null) { DebugLog.LogWarningColor("Another room join request is already in progress. Ignoring.", LogColor.brown); return; } this._pendingRoomJoinRequest = new PendingRoomJoinRequest { successCallback = successCallback, failureCallback = failureCallback }; if (PhotonNetwork.IsConnected) { PhotonNetwork.JoinRandomRoom(); } else { this.CheckAndConnectToPhotonNetwork(); } }