SessionComponentSystem.cs 801 B

12345678910111213141516171819202122232425262728293031
  1. namespace ET
  2. {
  3. public class SessionComponentDestroySystem: DestroySystem<SessionComponent>
  4. {
  5. public override void Destroy(SessionComponent self)
  6. {
  7. self.AccountSession?.Dispose();
  8. self.AccountSession = null;
  9. self.GateSession?.Dispose();
  10. self.GateSession = null;
  11. }
  12. }
  13. public static class SessionComponentComponent
  14. {
  15. public static void DisconnectAccount(this SessionComponent self)
  16. {
  17. self.AccountSession?.GetComponent<DisConnectedCompnent>()?.CancelAlert();
  18. self.AccountSession?.Dispose();
  19. self.AccountSession = null;
  20. }
  21. public static void Disconnect(this SessionComponent self)
  22. {
  23. self.DisconnectAccount();
  24. self.GateSession?.GetComponent<DisConnectedCompnent>()?.CancelAlert();
  25. self.GateSession?.Dispose();
  26. self.GateSession = null;
  27. }
  28. }
  29. }