public static bool JoinOrCreateRoom(string roomName, RoomOptions roomOptions, TypedLobby typedLobby)
{
if (offlineMode)
{
if (offlineModeRoom != null)
{
Debug.LogError("JoinOrCreateRoom failed. In offline mode you still have to leave a room to enter another.");
return(false);
}
offlineModeRoom = new Room(roomName, roomOptions);
NetworkingPeer.SendMonoMessage(PhotonNetworkingMessage.OnCreatedRoom, 0, new object[0]);
NetworkingPeer.SendMonoMessage(PhotonNetworkingMessage.OnJoinedRoom, 0, new object[0]);
return(true);
}
if ((networkingPeer.server != ServerConnection.MasterServer) || !connectedAndReady)
{
Debug.LogError("JoinOrCreateRoom failed. Client is not on Master Server or not yet ready to call operations. Wait for callback: OnJoinedLobby or OnConnectedToMaster.");
return(false);
}
if (string.IsNullOrEmpty(roomName))
{
Debug.LogError("JoinOrCreateRoom failed. A roomname is required. If you don't know one, how will you join?");
return(false);
}
return(networkingPeer.OpJoinRoom(roomName, roomOptions, typedLobby, true));
}