Example #1
0
        public void RegisterClientAsAgent(ulong clientId, string message)
        {
            var client = JoiningAgents.Where(q => q.ID == clientId).FirstOrDefault();

            JoiningAgents.Remove(client);

            client.MessageInterpreter = new AgentInterpreter(this);
            var agent = new AGENT(client);

            Agents.Add(agent);
            client.BeginSend(message);
        }
Example #2
0
        public void RemoveClientOrAgent(ulong clientId)
        {
            var client = JoiningAgents.Where(q => q.ID == clientId).FirstOrDefault();

            if (client != null)
            {
                JoiningAgents.Remove(client);
            }
            var agent = Agents.Where(q => q.Client.ID == clientId).FirstOrDefault();

            if (agent != null)
            {
                Agents.Remove(agent);
                var message = new PlayerDisconnectedMessage(agent.PlayerId);
                SendMessageToGameMaster(message.Serialize());
            }
        }