本文整理汇总了C#中RoomOptions类的典型用法代码示例。如果您正苦于以下问题:C# RoomOptions类的具体用法?C# RoomOptions怎么用?C# RoomOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RoomOptions类属于命名空间,在下文中一共展示了RoomOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConnectToRoom
private void ConnectToRoom()
{
// if(PhotonNetwork.playerList.Length % 2 != 0)
// {
// RoomOptions roomOptions = new RoomOptions() { isVisible = true, maxPlayers = 2 };
// PhotonNetwork.JoinOrCreateRoom("roomName", roomOptions, TypedLobby.Default);
RoomOptions newRoomOptions = new RoomOptions();
newRoomOptions.isOpen = true;
newRoomOptions.isVisible = true;
newRoomOptions.maxPlayers = 2;
if(ps.type == PlayerType.PC)
newRoomOptions.customRoomProperties = new ExitGames.Client.Photon.Hashtable() { { "PC", false } };
else
newRoomOptions.customRoomProperties = new ExitGames.Client.Photon.Hashtable() { { "VR", false } };
// newRoomOptions.customRoomPropertiesForLobby = new string[] { "C0" }; // this makes "C0" available in the lobby
// let's create this room in SqlLobby "myLobby" explicitly
// TypedLobby sqlLobby = new TypedLobby("myLobby", LobbyType.SqlLobby);
// PhotonNetwork.CreateRoom(roomName, newRoomOptions, sqlLobby);
// PhotonNetwork.JoinRandomRoom(newRoomOptions.customRoomProperties, newRoomOptions.maxPlayers = 2);
// }
PhotonNetwork.JoinOrCreateRoom("room" + PhotonNetwork.countOfRooms, newRoomOptions, TypedLobby.Default);
}
示例2: CreateRoom
public void CreateRoom(string roomname)
{
Debug.Log("Creating room " + roomname);
this.Host = true;
RoomOptions ro = new RoomOptions() { isVisible = true, maxPlayers = 5 };
PhotonNetwork.CreateRoom(roomname, ro, TypedLobby.Default);
}
示例3: OnJoinedLobby
/// <summary>
/// When we joined the lobby after connecting to Photon, we want to immediately join the demo room, or create it if it doesn't exist
/// </summary>
void OnJoinedLobby()
{
RoomOptions roomOptions = new RoomOptions (){};
PhotonNetwork.JoinOrCreateRoom (_room, roomOptions, TypedLobby.Default);
Debug.Log ("Starting Server");
// if( isHost == true )
// return;
//
// if( QuitOnLogout == true )
// {
// Application.Quit();
// return;
// }
//
// if( Application.loadedLevelName == _levelName )
// {
// RoomOptions roomOptions = new RoomOptions();
// roomOptions.maxPlayers = 20;
//
// PhotonNetwork.JoinOrCreateRoom( _room, roomOptions, TypedLobby.Default );
// Debug.Log( "Joined Lobby" );
// }
// else
// {
// //If we join the lobby while not being in the MainMenu scene, something went wrong and we disconnect from Photon
// PhotonNetwork.Disconnect();
// }
}
示例4: OnJoinedLobby
void OnJoinedLobby()
{
Debug.Log("joined lobby");
RoomOptions roomOptions = new RoomOptions() { };
PhotonNetwork.JoinOrCreateRoom(_room, roomOptions, TypedLobby.Default);
}
示例5: OnJoinedLobby
void OnJoinedLobby()
{
Debug.Log("joined lobby");
RoomOptions roomOptions = new RoomOptions() {isVisible = true, maxPlayers = 4};
PhotonNetwork.JoinOrCreateRoom(Room, roomOptions, TypedLobby.Default);
}
示例6: OnJoinedLobby
//Called if Auto-Join Lobby is true in PhotonServerSettings asset
void OnJoinedLobby()
{
Debug.Log("Joined Lobby");
RoomOptions roomOptions = new RoomOptions() { isVisible = false, maxPlayers = 2 };
PhotonNetwork.JoinOrCreateRoom("Game", roomOptions, TypedLobby.Default);
}
示例7: OnPhotonRandomJoinFailed
void OnPhotonRandomJoinFailed()
{
Debug.Log("Can't join random room!");
RoomOptions roomOptions = new RoomOptions();
roomOptions.MaxPlayers = 0;
PhotonNetwork.CreateRoom(null, roomOptions, null);
}
示例8: OnGUI
void OnGUI()
{
GUILayout.Label(PhotonNetwork.connectionStateDetailed.ToString());
if (PhotonNetwork.room == null)
{
//Create room
if (GUI.Button(new Rect(50, 50, 200, 50), "Start Server"))
{
PhotonNetwork.CreateRoom(roomName + System.Guid.NewGuid().ToString("N"));
}
//Join room
if (roomsList != null)
{
for (int i = 0; i < roomsList.Length; i++)
{
if(GUI.Button(new Rect(50, 110 + (10 * i), 200, 50), "Join" + roomsList[i].name))
{
RoomOptions ro = new RoomOptions() { isVisible = true, maxPlayers = 4 };
PhotonNetwork.JoinOrCreateRoom(roomsList[i].name, ro, TypedLobby.Default);
}
}
}
}
}
示例9: OnPhotonJoinRoomFailed
void OnPhotonJoinRoomFailed()
{
Debug.Log("No such room with name : " + roomName + ", creating!");
RoomOptions roomOptions = new RoomOptions();
roomOptions.maxPlayers = 2;
PhotonNetwork.JoinOrCreateRoom(roomName, roomOptions, TypedLobby.Default);
}
示例10: OnJoinedLobby
void OnJoinedLobby(){
//Don't use these 2 lines if you wan't offline mode to work
RoomOptions roomOptions = new RoomOptions () { isVisible = false, maxPlayers = 4};
PhotonNetwork.JoinOrCreateRoom (roomName, roomOptions, TypedLobby.Default);
}
示例11: OnJoinedLobby
/// <summary>
/// When we joined the lobby after connecting to Photon, we want to immediately join the demo room, or create it if it doesn't exist
/// </summary>
void OnJoinedLobby()
{
if( isHost == true )
return;
if( QuitOnLogout == true )
{
Application.Quit();
return;
}
if( Application.loadedLevelName == _levelName )
{
RoomOptions roomOptions = new RoomOptions();
roomOptions.maxPlayers = 20;
PhotonNetwork.JoinOrCreateRoom( "Wizard", roomOptions, TypedLobby.Default );
Debug.Log( "Joined Lobby" );
}
else
{
//If we join the lobby while not being in the MainMenu scene, something went wrong and we disconnect from Photon
PhotonNetwork.Disconnect();
}
}
示例12: OnConnectedToMaster
void OnConnectedToMaster()
{
if (ApplicationModel.NetState == NetSate.Default)
{
Debug.Log("JoinRandomRoom");
PhotonNetwork.JoinRandomRoom(); // création de la room
return;
}
Debug.Log("JoinNanRandomRoom : " + ApplicationModel.NetState);
string RoomID = ApplicationModel.RoomID;
if (RoomID != null)
this.room_name = RoomID;
else
{
Notification.Create(NotificationType.Box, "Erreur lors de l'invitation", content: "Une erreur est survenue lors de la création de la room.");
return;
}
if (ApplicationModel.NetState == NetSate.InviteFriend)
{
RoomOptions roomOptions = new RoomOptions() { IsVisible = false /*isVisible = false*/ , MaxPlayers = 2 /*maxPlayers = 2*/}; // isVisible Random can join or not (ici non)
PhotonNetwork.JoinOrCreateRoom(this.room_name, roomOptions, TypedLobby.Default);
}
else if (ApplicationModel.NetState == NetSate.InviteByFriend)
{
PhotonNetwork.JoinRoom(this.room_name);
}
PlayerPrefs.DeleteAll();
}
示例13: OnConnectedToMaster
// below, we implement some callbacks of PUN
// you can find PUN's callbacks in the class PunBehaviour or in enum PhotonNetworkingMessage
public virtual void OnConnectedToMaster()
{
Debug.Log("OnConnectedToMaster() was called by PUN. Now this client is connected and could join a room. Calling: PhotonNetwork.JoinOrCreateRoom();");
RoomOptions roomOptions = new RoomOptions() { isVisible = false, maxPlayers = 8 };
PhotonNetwork.JoinOrCreateRoom(roomName, roomOptions, TypedLobby.Default);
GameObject.Find("Canvas/Room Label").GetComponent<Text>().text = "Room: " + roomName;
}
示例14: OnJoinedLobby
void OnJoinedLobby() {
RoomOptions roomOptions = new RoomOptions() {
isVisible = false,
maxPlayers = 4
};
PhotonNetwork.JoinOrCreateRoom(roomName, roomOptions, TypedLobby.Default);
}
示例15: OnPhotonRandomJoinFailed
public void OnPhotonRandomJoinFailed()
{
hostFlag = true;
RoomOptions roomOptions = new RoomOptions() { isVisible = true, maxPlayers = 2 };
PhotonNetwork.CreateRoom(null, roomOptions, TypedLobby.Default);
//PhotonNetwork.CreateRoom(null);
}