SessionComponent.cs 520 B

12345678910111213141516171819202122232425262728293031323334353637
  1. namespace Model
  2. {
  3. [ObjectEvent]
  4. public class SessionComponentEvent : ObjectEvent<SessionComponent>, IAwake
  5. {
  6. public void Awake()
  7. {
  8. this.Get().Awake();
  9. }
  10. }
  11. public class SessionComponent: Component
  12. {
  13. public static SessionComponent Instance;
  14. public Session Session;
  15. public void Awake()
  16. {
  17. Instance = this;
  18. }
  19. public override void Dispose()
  20. {
  21. if (this.Id == 0)
  22. {
  23. return;
  24. }
  25. base.Dispose();
  26. this.Session.Dispose();
  27. this.Session = null;
  28. Instance = null;
  29. }
  30. }
  31. }