using System; using System.Collections.Generic; using System.Net; #if UNITY_WP8 using UnityPortSocket; #else using System.Net.Sockets; #endif using System.Collections; namespace SPacket.SocketInstance { public interface PacketFactory { MessageID GetPacketID(); } public abstract class PacketFactoryManager { public abstract bool Init (); public Ipacket GetPacketHandler(MessageID nMID) { Ipacket result; return m_HandlerDic.TryGetValue(nMID, out result) ? result : null; } public void RemovePacket(Ipacket pPacket) { //if (pPacket == null) return; } protected void AddFactory(PacketFactory pFactory) { m_Factories[pFactory.GetPacketID()] = pFactory; } protected void AddPacketHander(MessageID nMID, Ipacket packetHander) { m_HandlerDic[nMID] = packetHander; } protected Hashtable m_Factories = new Hashtable(); protected Dictionary m_HandlerDic = new Dictionary(); } }