Esempio n. 1
0
        /// <summary>
        /// Tells the server to create a new room, randomly named but with some defult settings (properties).
        /// </summary>
        /// <remarks>
        /// This method shows how to create a room without assigning a name.
        /// Unless you want to show a list of rooms, this is the best workflow for random matchmaking.
        /// Showing a list of rooms to make users pick one is not always much more than a random picking, also.
        ///
        /// Note the maxPlayers being 0. This means "any number of players". In your game, you would set some value > 0 here.
        /// </remarks>
        /// <seealso cref="http://doc.exitgames.com/photon-cloud/MatchmakingAndLobby/#cat-references"/>
        /// <param name="maptype">Any value of DemoConstants.MapType</param>
        /// <param name="gridSize"></param>
        public void CreateParticleDemoRoom(DemoConstants.MapType maptype, int gridSize)
        {
            // custom room properties to use when this client creates a room. Note: Not all are listed in the lobby.
            Hashtable roomPropsForCreation = new Hashtable()
            {
                { DemoConstants.MapProp, maptype.ToString() }, { DemoConstants.GridSizeProp, gridSize }
            };

            this.OpCreateRoom(null, true, true, 0, roomPropsForCreation, RoomPropsInLobby);
        }
        /// <summary>
        /// Tells the server to create a new room, randomly named but with some defult settings (properties).
        /// </summary>
        /// <remarks>
        /// This method shows how to create a room without assigning a name.
        /// Unless you want to show a list of rooms, this is the best workflow for random matchmaking.
        /// Showing a list of rooms to make users pick one is not always much more than a random picking, also.
        ///
        /// Note the maxPlayers being 0. This means "any number of players". In your game, you would set some value > 0 here.
        /// </remarks>
        /// <seealso cref="https://doc.photonengine.com/en/realtime/current/reference/matchmaking-and-lobby"/>
        /// <param name="maptype">Any value of DemoConstants.MapType</param>
        /// <param name="gridSize"></param>
        public void CreateParticleDemoRoom(DemoConstants.MapType maptype, int gridSize)
        {
            // custom room properties to use when this client creates a room. Note: Not all are listed in the lobby.
            Hashtable roomPropsForCreation = new Hashtable()
            {
                { DemoConstants.MapProp, maptype.ToString() }, { DemoConstants.GridSizeProp, gridSize }
            };

            this.OpJoinOrCreateRoom("Demo", new RoomOptions()
            {
                CustomRoomProperties = roomPropsForCreation, CustomRoomPropertiesForLobby = RoomPropsInLobby
            }, null);
        }