NetOuterComponentSystem.cs 922 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using Model;
  2. namespace Hotfix
  3. {
  4. [ObjectEvent]
  5. public class NetOuterComponentEvent : ObjectEvent<NetOuterComponent>, IAwake, IAwake<string, int>, IUpdate
  6. {
  7. public void Awake()
  8. {
  9. this.Get().Awake();
  10. }
  11. public void Awake(string a, int b)
  12. {
  13. this.Get().Awake(a, b);
  14. }
  15. public void Update()
  16. {
  17. this.Get().Update();
  18. }
  19. }
  20. public static class NetOuterComponentSystem
  21. {
  22. public static void Awake(this NetOuterComponent self)
  23. {
  24. self.Awake(NetworkProtocol.TCP);
  25. self.MessagePacker = new MongoPacker();
  26. self.MessageDispatcher = new OuterMessageDispatcher();
  27. }
  28. public static void Awake(this NetOuterComponent self, string host, int port)
  29. {
  30. self.Awake(NetworkProtocol.TCP, host, port);
  31. self.MessagePacker = new MongoPacker();
  32. self.MessageDispatcher = new OuterMessageDispatcher();
  33. }
  34. public static void Update(this NetOuterComponent self)
  35. {
  36. self.Update();
  37. }
  38. }
  39. }