NetInnerComponentSystem.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using System.Net;
  2. using Model;
  3. namespace Hotfix
  4. {
  5. [ObjectEvent]
  6. public class NetInnerComponentEvent : ObjectEvent<NetInnerComponent>, IAwake, IAwake<IPEndPoint>, IUpdate
  7. {
  8. public void Awake()
  9. {
  10. this.Get().Awake();
  11. }
  12. public void Awake(IPEndPoint ipEndPoint)
  13. {
  14. this.Get().Awake(ipEndPoint);
  15. }
  16. public void Update()
  17. {
  18. this.Get().Update();
  19. }
  20. }
  21. public static class NetInnerComponentSystem
  22. {
  23. public static void Awake(this NetInnerComponent self)
  24. {
  25. self.Awake(NetworkProtocol.TCP);
  26. self.MessagePacker = new MongoPacker();
  27. self.MessageDispatcher = new InnerMessageDispatcher();
  28. self.AppType = self.GetComponent<StartConfigComponent>().StartConfig.AppType;
  29. }
  30. public static void Awake(this NetInnerComponent self, IPEndPoint ipEndPoint)
  31. {
  32. self.Awake(NetworkProtocol.TCP, ipEndPoint);
  33. self.MessagePacker = new MongoPacker();
  34. self.MessageDispatcher = new InnerMessageDispatcher();
  35. self.AppType = self.GetComponent<StartConfigComponent>().StartConfig.AppType;
  36. }
  37. public static void Update(this NetInnerComponent self)
  38. {
  39. self.Update();
  40. }
  41. }
  42. }