Example #1
0
        /// <summary>
        /// Sends a request to create a lobby, using a specified factory
        /// </summary>
        public void CreateLobby(string factory, MstProperties options, CreateLobbyCallback calback, IClientSocket connection)
        {
            if (!connection.IsConnected)
            {
                calback.Invoke(null, "Not connected");
                return;
            }

            options.Set(MstDictKeys.lobbyFactoryId, factory);

            connection.SendMessage((short)MstMessageCodes.CreateLobby, options.ToBytes(), (status, response) =>
            {
                if (status != ResponseStatus.Success)
                {
                    calback.Invoke(null, response.AsString("Unknown error"));
                    return;
                }

                var lobbyId = response.AsInt();

                calback.Invoke(lobbyId, null);
            });
        }
        /// <summary>
        ///     Sends a request to create a lobby, using a specified factory
        /// </summary>
        public void CreateLobby(string factory, Dictionary <string, string> properties,
                                CreateLobbyCallback calback, IClientSocket connection)
        {
            if (!connection.IsConnected)
            {
                calback.Invoke(null, "Not connected");
                return;
            }

            properties[MsfDictKeys.LobbyFactoryId] = factory;

            connection.SendMessage((short)MsfOpCodes.CreateLobby, properties.ToBytes(), (status, response) => {
                if (status != ResponseStatus.Success)
                {
                    calback.Invoke(null, response.AsString("Unknown error"));
                    return;
                }

                var lobbyId = response.AsInt();

                calback.Invoke(lobbyId, null);
            });
        }
Example #3
0
        /// <summary>
        /// Sends a request to create a lobby, using a specified factory
        /// </summary>
        public void CreateLobby(string lobbyTypeId, Dictionary <string, string> properties,
                                CreateLobbyCallback callback, ErrorCallback errorCallback)
        {
            if (!Client.IsConnected)
            {
                errorCallback.Invoke("Not connected");
                return;
            }

            properties[OptionKeys.LobbyFactoryId] = lobbyTypeId;

            Client.SendMessage((ushort)OpCodes.CreateLobby, properties.ToBytes(), (status, response) =>
            {
                if (status != ResponseStatus.Success)
                {
                    errorCallback.Invoke(response.AsString("Unknown error"));
                    return;
                }

                var lobbyId = response.AsInt();

                callback.Invoke(lobbyId);
            });
        }
Example #4
0
 /// <summary>
 /// Sends a request to create a lobby, using a specified factory
 /// </summary>
 public void CreateLobby(string factory, MstProperties options, CreateLobbyCallback calback)
 {
     CreateLobby(factory, options, calback, Connection);
 }
Example #5
0
 /// <summary>
 /// Sends a request to create a lobby, using a specified factory
 /// </summary>
 public void CreateLobby(string factory, Dictionary <string, string> properties,
                         CreateLobbyCallback calback)
 {
     CreateLobby(factory, properties, calback, Connection);
 }