hey gang just wondering how you join a room in photon (not joinrandomroom)
but joint room with a name?
Owner of the quest starts the room, other players joining the quest join his room :)
public string QuestName;
public string Username;
public bool IamTheOwner;
// Update is called once per frame
public void LeveOnMission () {
PhotonNetwork.Disconnect ();
}
void OnDisconnectedFromPhoton(){
LoadQuest ();
}
void LoadQuest(){
PhotonNetwork.autoJoinLobby = true; // we join randomly. always. no need to join a lobby to get the list of rooms.
PhotonNetwork.ConnectUsingSettings("EAO 0.1");
}
public void OnConnectedToMaster()
{
string RoomName = Username;
if (IamTheOwner == false) {
RoomOptions roomOptions = new RoomOptions () { isVisible = true, maxPlayers = 4};
Debug.Log ("OnPhotonRandomJoinFailed() was called by PUN. No random room available, so we create one. Calling: PhotonNetwork.CreateRoom(null, new RoomOptions() {maxPlayers = 4}, null);");
PhotonNetwork.JoinRoom(roomOptions);
}
if (IamTheOwner == true) {
RoomOptions roomOptions = new RoomOptions () { isVisible = true, maxPlayers = 4 };
Debug.Log ("OnPhotonRandomJoinFailed() was called by PUN. No random room available, so we create one. Calling: PhotonNetwork.CreateRoom(null, new RoomOptions() {maxPlayers = 4}, null);");
PhotonNetwork.CreateRoom (RoomName, roomOptions, TypedLobby.Default);
}
}
↧