Ejemplo n.º 1
0
 public void LeaveRoom()
 {
     this._pendingRoomJoinRequest = null;
     if (PhotonNetwork.IsConnected && PhotonNetwork.CurrentRoom != null)
     {
         PhotonNetwork.LeaveRoom();
     }
 }
Ejemplo n.º 2
0
 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;
     }
 }
Ejemplo n.º 3
0
 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;
     }
 }
Ejemplo n.º 4
0
 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);
     }
 }
Ejemplo n.º 5
0
        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();
            }
        }