예제 #1
0
        public void Udpate()
        {
            _network.Update();
            while (_request.Count > 0)
            {
                var request  = _request.Dequeue();
                var value    = request.Item2 as ChatValue;
                var callback = request.Item3;
                var owner    = request.Item1;
                if (value == null)
                {
                    callback.Fail(_unknownFormat);
                    return;
                }

                if (string.IsNullOrEmpty(value.Message))
                {
                    callback.Fail(_toEmptyMessage);
                    return;
                }

                if (value.Message.Length > _maxLengthMessage)
                {
                    callback.Fail(_toBigChatMessage);
                    return;
                }

                string name = _clients[owner];
                foreach (var client in _clients)
                {
                    IOwner clientOwner = client.Key;
                    if (clientOwner != owner)
                    {
                        _network.Request(clientOwner, value, new ChatCallbacks(name, client.Value, value.Message));
                    }
                }
                callback.Ack(_ok);
            }
        }
예제 #2
0
 public void Update()
 {
     _network.Update();
 }