public int AddAgent(string hostName)
        {
            this._agentBase++;
            FourPlayerAgent agent = new FourPlayerAgent(this._agentBase, this, hostName);

            this._agents[this._agentBase] = agent;
            return(this._agentBase);
        }
        public void OnSetPosition(int sessionID, byte position, string player)
        {
            FourPlayerAgent clientAgent = this.GetClientAgent(sessionID);

            if ((clientAgent != null) && !clientAgent.Closed)
            {
                clientAgent.SetPosition(sessionID, position, player);
            }
        }
        public void OnClose(int sessionID)
        {
            FourPlayerAgent clientAgent = this.GetClientAgent(sessionID);

            if (clientAgent != null)
            {
                clientAgent.Close();
            }
        }
        public void OnStartBattle(int sessionID)
        {
            FourPlayerAgent clientAgent = this.GetClientAgent(sessionID);

            if (clientAgent != null)
            {
                int battleIdentity = this.HandleAddBattleEvent();
                clientAgent.StartBattle(battleIdentity);
            }
        }
        public void OnLogon(int sessionID, int identity)
        {
            BattleAgentSession client = base.GetClient(sessionID) as BattleAgentSession;
            FourPlayerAgent    agent  = this.GetAgent(identity);

            if ((agent != null) && !agent.Closed)
            {
                client.AgentID = identity;
                agent.PlayerLogon(sessionID);
            }
        }
        private void FourPlayerAgentServer_OnClientDisconnected(ClientSession client)
        {
            BattleAgentSession session = client as BattleAgentSession;

            if (session.AgentID != -1)
            {
                FourPlayerAgent agent = this.GetAgent(session.AgentID);
                if ((agent != null) && !agent.Closed)
                {
                    agent.PlayerExit(client.SessionID);
                }
            }
        }