using System; using System.Collections.Generic; using System.Reflection; namespace Mistox.Attributes { public class NetworkPacketDictionary { // Fills out the NetworkPacket Lookup Dictionary public static readonly Dictionary ClientToClientPackets = new(); public static readonly Dictionary ServerToClientPackets = new(); public static void BuildNetworkPacketList() { Type[] allClasses = Assembly.GetExecutingAssembly().GetTypes(); foreach( Type cur in allClasses) { mPacket attribute = cur.GetCustomAttribute(false); if (attribute != null) { if ( attribute.PacketUse.HasFlag(PacketUsage.ClientToClient) ) { ClientToClientPackets[attribute.ID] = cur; } else if ( attribute.PacketUse.HasFlag(PacketUsage.ClientToServer) ) { ServerToClientPackets[attribute.ID] = cur; } } } } } }