예제 #1
0
        public override void HandleMessage(INetPacket packet)
        {
            Debug.WriteLine($"Message received: \"{packet.GetType().Name}\" ({Id})");

            if (Index < 2)
            {
                var ser = (BattleServer)Server;
                switch (packet)
                {
                case PBEActionsResponsePacket arp:
                    ser.ActionsSubmitted(this, arp.Actions);
                    break;

                case PBEPartyResponsePacket prp:
                    Party = prp.Party;
                    ser.PartySubmitted(this);
                    break;

                case PBESwitchInResponsePacket sirp:
                    ser.SwitchesSubmitted(this, sirp.Switches);
                    break;
                }
            }

            ResetEvent.Set();
        }
예제 #2
0
        public override void HandleMessage(INetPacket packet)
        {
            Debug.WriteLine($"Message received: \"{packet.GetType().Name}\" ({BattleId})");
            if (Socket == null || ResetEvent.SafeWaitHandle.IsClosed)
            {
                return;
            }
            ResetEvent.Set();

            if (BattleId < 2)
            {
                var ser = (BattleServer)Server;
                switch (packet)
                {
                case PBEActionsResponsePacket arp:
                {
                    ser.ActionsSubmitted(this, arp.Actions);
                    break;
                }

                case PBEPartyResponsePacket prp:
                {
                    Party = prp.Party;
                    ser.PartySubmitted(this);
                    break;
                }

                case PBESwitchInResponsePacket sirp:
                {
                    ser.SwitchesSubmitted(this, sirp.Switches);
                    break;
                }
                }
            }
        }
예제 #3
0
        public override void HandleMessage(INetPacket packet)
        {
            Debug.WriteLine($"Message received: \"{packet.GetType().Name}\" ({BattleId})");
            if (Socket == null || ResetEvent.SafeWaitHandle.IsClosed)
            {
                return;
            }
            ResetEvent.Set();

            if (BattleId < 2)
            {
                var ser = (BattleServer)Server;
                switch (packet)
                {
                case PBEActionsResponsePacket arp:
                {
                    ser.ActionsSubmitted(this, arp.Actions);
                    break;
                }

                case PBEPartyResponsePacket prp:
                {
                    Console.WriteLine($"Received team from {TrainerName}!");
                    if (TeamShell == null)
                    {
                        TeamShell = prp.TeamShell;
                        ser.PartySubmitted(this);
                    }
                    else
                    {
                        Console.WriteLine("Team submitted multiple times!");
                    }
                    break;
                }

                case PBESwitchInResponsePacket sirp:
                {
                    ser.SwitchesSubmitted(this, sirp.Switches);
                    break;
                }
                }
            }
        }