当前位置: 首页>>代码示例>>C#>>正文


C# RoomOptions类代码示例

本文整理汇总了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);
	}
开发者ID:blackbook2016,项目名称:UnityRepository_4,代码行数:26,代码来源:PhotonManager_GS.cs

示例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);
 }
开发者ID:SHEePYTaGGeRNeP,项目名称:FontysMobileGameJam,代码行数:7,代码来源:PhotonManager.cs

示例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();
//		}
	}
开发者ID:MiloBuwalda,项目名称:wizard,代码行数:31,代码来源:NetworkController.cs

示例4: OnJoinedLobby

	void OnJoinedLobby()
	{
		Debug.Log("joined lobby");
		
		RoomOptions roomOptions = new RoomOptions() { };
		PhotonNetwork.JoinOrCreateRoom(_room, roomOptions, TypedLobby.Default);
	}
开发者ID:samantas,项目名称:Jamz,代码行数:7,代码来源:NetworkController.cs

示例5: OnJoinedLobby

    void OnJoinedLobby()
    {
        Debug.Log("joined lobby");

        RoomOptions roomOptions = new RoomOptions() {isVisible = true, maxPlayers = 4};
        PhotonNetwork.JoinOrCreateRoom(Room, roomOptions, TypedLobby.Default);
    }
开发者ID:frossdelaqrois,项目名称:Afro_Chicken,代码行数:7,代码来源:NetworkController.cs

示例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);
    }
开发者ID:NoManAlone,项目名称:NMA-Unity-Project,代码行数:8,代码来源:GameManager.cs

示例7: OnPhotonRandomJoinFailed

 void OnPhotonRandomJoinFailed()
 {
     Debug.Log("Can't join random room!");
     RoomOptions roomOptions = new RoomOptions();
     roomOptions.MaxPlayers = 0;
     PhotonNetwork.CreateRoom(null, roomOptions, null);
 }
开发者ID:daniel-cheng,项目名称:stellar,代码行数:7,代码来源:NetworkManager.cs

示例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);
                    }
                }
            }
        }
    }
开发者ID:elluuuh,项目名称:Battle-City,代码行数:26,代码来源:NetworkManager.cs

示例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);
 }
开发者ID:Hoon-Park,项目名称:MMOArenaUnity,代码行数:7,代码来源:MMOArenaPhotonConnector.cs

示例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);

	}
开发者ID:KarateF22,项目名称:GameX,代码行数:7,代码来源:NetworkManager.cs

示例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();
		}
	}
开发者ID:MiloBuwalda,项目名称:wizard,代码行数:28,代码来源:NetworkController.cs

示例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();

        }
开发者ID:CanPayU,项目名称:SuperSwungBall,代码行数:30,代码来源:NetworkController.cs

示例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;
 }
开发者ID:Ckeds,项目名称:PortfolioWorks,代码行数:9,代码来源:NetworkManager.cs

示例14: OnJoinedLobby

	void OnJoinedLobby() {
		RoomOptions roomOptions = new RoomOptions() {
			isVisible = false,
			maxPlayers = 4
		};
		PhotonNetwork.JoinOrCreateRoom(roomName, roomOptions, TypedLobby.Default);
	}
开发者ID:rthill91,项目名称:Independent-Study,代码行数:7,代码来源:NetworkManager.cs

示例15: OnPhotonRandomJoinFailed

 public void OnPhotonRandomJoinFailed()
 {
     hostFlag = true;
     RoomOptions roomOptions = new RoomOptions() { isVisible = true, maxPlayers = 2 };
     PhotonNetwork.CreateRoom(null, roomOptions, TypedLobby.Default);
     //PhotonNetwork.CreateRoom(null);
 }
开发者ID:chocopuyo,项目名称:photon_invador,代码行数:7,代码来源:SpacePhotonScript.cs


注:本文中的RoomOptions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。