public void Process(ZeroGPacket packet) { GamePacket origPacket = PacketGenerator.Decompile(packet); if (packet.PacketType == "LevelInfo" && (origPacket.GetType() == typeof(GameLevelInfo))) { GameLevelInfo newPacket = (GameLevelInfo)origPacket; LevelInfoProcessor.Process(newPacket); } else if (packet.PacketType == "PlayerNames" && (origPacket.GetType() == typeof(PlayerNames))) { PlayerNames newpacket = (PlayerNames)origPacket; PlayerNamesProcessor.Process(newpacket); } else if (packet.PacketType == "PlayerPosition" && (origPacket.GetType() == typeof(PlayerPosition))) { PlayerPosition newpacket = (PlayerPosition)origPacket; PlayerPositionProcessor.Process(newpacket); } else if (packet.PacketType == "AllLoaded" && (origPacket.GetType() == typeof(AllPlayersLoaded))) { AllPlayersLoaded newpacket = (AllPlayersLoaded)origPacket; AllPlayersLoadedProcessor.Process(newpacket); } }
public void Process(ZeroGPacket packet, NetPeer peer) { GamePacket origPacket = PacketGenerator.Decompile(packet); if (packet.PacketType == "LoadingComplete" && (origPacket.GetType() == typeof(LoadingComplete))) { LoadingComplete newPacket = (LoadingComplete)origPacket; // Console.WriteLine("Player " + newPacket.userName + " has set loading complete status to " + newPacket.isComplete); LoadingCompleteProcessor.Process(newPacket); } else if (packet.PacketType == "ClientInfo" && (origPacket.GetType() == typeof(ClientInfo))) { ClientInfo newPacket = (ClientInfo)origPacket; ClientInfoProcessor.Process(newPacket, peer.Id); } else if (packet.PacketType == "PlayerPosition" && (origPacket.GetType() == typeof(PlayerPosition))) { PlayerPositionProcessor.Process(packet, peer); } }