Exemplo n.º 1
0
 public void RemoveClient(UnityClient client)
 {
     using (WriteLock.TryEnter(this.readWriteLock, 1000))
     {
         Clients.Remove(client);
     }
 }
Exemplo n.º 2
0
 public void RemoveClient(UnityClient client)
 {
     using (WriteLock.TryEnter(this.readWriteLock, 1000))
     {
         Clients.Remove(client);
     }
 }
Exemplo n.º 3
0
 public void AddClient(UnityClient client)
 {
     using (WriteLock.TryEnter(this.readWriteLock, 1000))
     {
         Clients.Add(client);
     }
 }
Exemplo n.º 4
0
 public void AddClient(UnityClient client)
 {
     using (WriteLock.TryEnter(this.readWriteLock, 1000))
     {
         Clients.Add(client);
     }
 }
Exemplo n.º 5
0
        public void TrySendChatMessage()
        {
            var chatRequest = new ChatMessage(UnityClient.Protocol, OperationRequest);

            if (!chatRequest.IsValid)
            {
                UnityClient.SendOperationResponse(chatRequest.GetResponse(ErrorCode.InvalidParameters), SendParameters);
                return;
            }

            string message = chatRequest.Message;

            message = UnityClient.CharacterName + ": " + message;
            ChatLobby.Instance.AddMessage(message);

            var eventData = new EventData((byte)EventCode.ChatMessage);

            eventData.Parameters = new Dictionary <byte, object>()
            {
                { (byte)ParameterCode.ChatMessage, message }
            };
            eventData.SendTo(AccountService.Instance.Clients, SendParameters);
        }
Exemplo n.º 6
0
        public void TryAuthorization()
        {
            var loginRequest = new Login(UnityClient.Protocol, OperationRequest);

            UnityClient.CharacterName = loginRequest.CharacterName;

            if (!loginRequest.IsValid)
            {
                UnityClient.SendOperationResponse(loginRequest.GetResponse(ErrorCode.InvalidParameters), SendParameters);
                return;
            }

            if (AccountService.Instance.IsContain(UnityClient.CharacterName))
            {
                UnityClient.SendOperationResponse(loginRequest.GetResponse(ErrorCode.NameIsExist), SendParameters);
                return;
            }

            AccountService.Instance.AddClient(UnityClient);

            var response = new OperationResponse(OperationRequest.OperationCode);

            UnityClient.SendOperationResponse(response, SendParameters);
        }
Exemplo n.º 7
0
 public ChatInfo(UnityClient client, OperationRequest operationRequest, SendParameters sendParameters)
 {
     UnityClient      = client;
     OperationRequest = operationRequest;
     SendParameters   = sendParameters;
 }
Exemplo n.º 8
0
 public ChatInfo(UnityClient client, OperationRequest operationRequest, SendParameters sendParameters)
 {
     UnityClient = client;
     OperationRequest = operationRequest;
     SendParameters = sendParameters;
 }