Example #1
0
        /// <summary>
        /// Sends Join Or Create Room request to the server, the server will try to match a player with any available room
        /// if the server didn't find an available room, the server will create a room for the player
        /// <para>
        /// use <b>public override void OnRoomCreated</b> or <b>public override void OnRoomJoin</b> to get the server response
        /// </para>
        /// </summary>
        /// <param name="playerName"> player name to be assigned to player</param>
        /// <param name="playerAvatar">(integer value) Avatar Index from EdgeManager Spawn Prefabs</param>
        /// <param name="maxPlayersPerRoom">In case of room creation, the maximum players allowed in the room</param>
        /// <param name="playerTags">Dictionary<string,string> custom data associated with the player</param>
        public static void JoinOrCreateRoom(string playerName, int playerAvatar, int maxPlayersPerRoom, Dictionary <string, string> playerTags = null)
        {
            if (maxPlayersPerRoom < 2)
            {
                Debug.LogError("EdgeMultiplay : maxPlayersPerRoom must be greater than 1");
                return;
            }
            Hashtable playertagsHashtable;

            if (playerTags != null)
            {
                playertagsHashtable = Tag.DictionaryToHashtable(playerTags);
            }
            else
            {
                playertagsHashtable = null;
            }
            JoinOrCreateRoomRequest createOrJoinRoomRequest = new JoinOrCreateRoomRequest(playerName, playerAvatar, maxPlayersPerRoom, playertagsHashtable);

            wsClient.Send(Messaging <JoinOrCreateRoomRequest> .Serialize(createOrJoinRoomRequest));
        }
Example #2
0
 public void SendtoServer(byte[] imgBinary)
 {
     client.Send(imgBinary);
 }