示例#1
0
        /// <summary>
        /// Current player sends a request to join a team
        /// </summary>
        public void JoinTeam(int lobbyId, string teamName, SuccessCallback callback, ErrorCallback errorCallback)
        {
            var packet = new LobbyJoinTeamPacket()
            {
                LobbyId  = lobbyId,
                TeamName = teamName
            };

            Client.SendMessage((ushort)OpCodes.JoinLobbyTeam, packet,
                               (status, response) =>
            {
                if (status != ResponseStatus.Success)
                {
                    errorCallback.Invoke(response.AsString("unknown error"));
                    return;
                }

                callback.Invoke();
            });
        }
示例#2
0
        /// <summary>
        /// Current player sends a request to join a team
        /// </summary>
        public void JoinTeam(int lobbyId, string teamName, SuccessCallback callback)
        {
            var packet = new LobbyJoinTeamPacket()
            {
                LobbyId  = lobbyId,
                TeamName = teamName
            };

            Connection.SendMessage((short)OpCodes.JoinLobbyTeam, packet,
                                   (status, response) =>
            {
                if (status != ResponseStatus.Success)
                {
                    callback.Invoke(false, response.AsString("unknown error"));
                    return;
                }

                callback.Invoke(true, null);
            });
        }