コード例 #1
0
        public int AddAgent(string hostName)
        {
            this._agentBase++;
            FourPlayerAgent agent = new FourPlayerAgent(this._agentBase, this, hostName);

            this._agents[this._agentBase] = agent;
            return(this._agentBase);
        }
コード例 #2
0
        public void OnSetPosition(int sessionID, byte position, string player)
        {
            FourPlayerAgent clientAgent = this.GetClientAgent(sessionID);

            if ((clientAgent != null) && !clientAgent.Closed)
            {
                clientAgent.SetPosition(sessionID, position, player);
            }
        }
コード例 #3
0
        public void OnClose(int sessionID)
        {
            FourPlayerAgent clientAgent = this.GetClientAgent(sessionID);

            if (clientAgent != null)
            {
                clientAgent.Close();
            }
        }
コード例 #4
0
        public void OnStartBattle(int sessionID)
        {
            FourPlayerAgent clientAgent = this.GetClientAgent(sessionID);

            if (clientAgent != null)
            {
                int battleIdentity = this.HandleAddBattleEvent();
                clientAgent.StartBattle(battleIdentity);
            }
        }
コード例 #5
0
        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);
            }
        }
コード例 #6
0
        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);
                }
            }
        }