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); }
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()); } }