SessionComponent.cs 765 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using ETModel;
  2. namespace ETHotfix
  3. {
  4. [ObjectSystem]
  5. public class SessionComponentAwakeSystem : AwakeSystem<SessionComponent>
  6. {
  7. public override void Awake(SessionComponent self)
  8. {
  9. self.Awake();
  10. }
  11. }
  12. public class SessionComponent: Component
  13. {
  14. public static SessionComponent Instance;
  15. private Session session;
  16. public Session Session
  17. {
  18. get
  19. {
  20. return this.session;
  21. }
  22. set
  23. {
  24. this.session = value;
  25. if (this.session != null)
  26. {
  27. this.session.Parent = this;
  28. }
  29. }
  30. }
  31. public void Awake()
  32. {
  33. Instance = this;
  34. }
  35. public override void Dispose()
  36. {
  37. if (this.IsDisposed)
  38. {
  39. return;
  40. }
  41. base.Dispose();
  42. this.Session.Dispose();
  43. this.Session = null;
  44. Instance = null;
  45. }
  46. }
  47. }