OpLeave() public method

Operation Leave will exit any current room.
This also happens when you disconnect from the server. Disconnect might be a step less if you don't want to create a new room on the same server.
public OpLeave ( ) : bool
return bool
Ejemplo n.º 1
0
 public static bool LeaveRoom()
 {
     if (offlineMode)
     {
         offlineModeRoom = null;
         NetworkingPeer.SendMonoMessage(PhotonNetworkingMessage.OnLeftRoom, new object[0]);
         return(true);
     }
     if (room == null)
     {
         Debug.LogWarning("PhotonNetwork.room is null. You don't have to call LeaveRoom() when you're not in one. State: " + connectionStatesDetailed);
     }
     return(networkingPeer.OpLeave());
 }
Ejemplo n.º 2
0
 public static bool LeaveRoom(bool becomeInactive = true)
 {
     if (offlineMode)
     {
         offlineModeRoom = null;
         NetworkingPeer.SendMonoMessage(PhotonNetworkingMessage.OnLeftRoom);
         return(true);
     }
     if (room == null)
     {
         Debug.LogWarning("PhotonNetwork.room is null. You don't have to call LeaveRoom() when you're not in one. State: " + connectionStateDetailed);
     }
     else
     {
         becomeInactive = becomeInactive && room.playerTtl != 0;
     }
     return(networkingPeer.OpLeave(becomeInactive));
 }
Ejemplo n.º 3
0
    /// <summary>
    /// Leave the current game room
    /// </summary>
    public static void LeaveRoom()
    {
        if (room == null)
        {
            UnityEngine.Debug.LogError("PhotonNetwork: Error, you cannot leave a room if you're not in a room!");
            return;
        }

        if (offlineMode)
        {
            offlineMode_inRoom = false;
            NetworkingPeer.SendMonoMessage(PhotonNetworkingMessage.OnLeftRoom);
        }
        else
        {
            networkingPeer.OpLeave();
        }
    }