Ejemplo n.º 1
0
        private void handlePacketProxy(object sender, OnPacketEventArgs e)
        {
            switch (e.Type)
            {
            case PacketTypes.GET_ROOM_LIST:
                RoomListPacket l  = (RoomListPacket)this.server.GetRoomListPacket();
                RoomListPacket l2 = new RoomListPacket(l.getBytes());
                Console.WriteLine("Room Count: " + l2.RoomCount);
                for (int i = 0; i < l2.RoomCount; i++)
                {
                    Console.WriteLine(l2.RoomList[i].Id + ": " + l2.RoomList[i].P1Name);
                }
                this.Send(l);
                break;

            case PacketTypes.CONNECT:
                this.handleConnectPacket((ConnectPacket)e.Packet);
                break;

            case PacketTypes.GAME_ERR:
                GameErrorPacket p = (GameErrorPacket)e.Packet;
                Console.WriteLine("Received Client Error: #" + p.Code + " \"" + p.Message + "\"");
                break;

            case PacketTypes.GAME_CLIENT_END:
                this.handleClientEndPacket((GameClientEndPacket)e.Packet);
                break;

            default:
                //EMIT Packet for GameRooms
                this.emitPacketEvent(e);
                break;
            }
        }
Ejemplo n.º 2
0
 private void PacketListener(object sender, OnPacketEventArgs e)
 {
     switch (e.Type)
     {
     case PacketTypes.GAME_ACTION:
         this.handleAction((GameClient)sender, (GameActionPacket)e.Packet);
         break;
     }
 }
Ejemplo n.º 3
0
        private void emitPacketEvent(OnPacketEventArgs e)
        {
            EventHandler <OnPacketEventArgs> handler = this.onPacket;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Ejemplo n.º 4
0
        protected virtual void EmitPacketEvent(BasePacket p)
        {
            OnPacketEventArgs e = new OnPacketEventArgs(p.Type, p);
            EventHandler <OnPacketEventArgs> handler = onPacket;

            if (handler != null)
            {
                handler(this, e);
            }
        }