namespace ET { public class SessionComponentDestroySystem: DestroySystem { public override void Destroy(SessionComponent self) { self.AccountSession?.Dispose(); self.AccountSession = null; self.GateSession?.Dispose(); self.GateSession = null; } } public static class SessionComponentComponent { public static void DisconnectAccount(this SessionComponent self) { self.AccountSession?.GetComponent()?.CancelAlert(); self.AccountSession?.Dispose(); self.AccountSession = null; } public static void Disconnect(this SessionComponent self) { self.DisconnectAccount(); self.GateSession?.GetComponent()?.CancelAlert(); self.GateSession?.Dispose(); self.GateSession = null; } } }