示例#1
0
        public static void PacketParsing(byte[] packet, Socket clientSocket = null)
        {
            switch (packet[0])
            {
            case (byte)Header.Login:
                LoginPacket loginPacket = LoginPacket_ToStruct(packet);
                EventManager.Instance.ReceiveLoginPacket(loginPacket, clientSocket);
                break;

            case (byte)Header.Matching:
                MatchingPacket matchingPacket = MatchingPacket_ToStruct(packet);
                EventManager.Instance.ReceiveMatchingPacket(matchingPacket);
                break;

            case (byte)Header.Game:
                HandleGamePacket handleGamePacket = HandleGamePacket_ToStruct(packet);
                EventManager.Instance.ReceiveHandleGamePacket(handleGamePacket);
                break;

            case (byte)Header.GameMotion:
                IndianPokerGamePacket indianpokerGamePacket = IndianPokerGamePacket_ToStruct(packet);
                EventManager.Instance.ReceiveIndianPokerGamePacket(indianpokerGamePacket);
                break;
            }
        }
示例#2
0
        public void ReceiveMatchingPacket(MatchingPacket matchingPacket)
        {
            MatchingPacketReceivedArgs parameter = new MatchingPacketReceivedArgs();

            parameter.Data = matchingPacket;

            MatchingPacketEvent(parameter);
        }
示例#3
0
        public static MatchingPacket MatchingPacket_ToStruct(byte[] packet)
        {
            MatchingPacket temp = new MatchingPacket();
            object         obj  = (object)temp;

            PacketToStruct(packet, ref obj);
            temp = (MatchingPacket)obj;
            return(temp);
        }