namespace ET.Server { [FriendOf(typeof (SessionPlayerComponent))] public static class SessionPlayerComponentSystem { public class SessionPlayerComponentDestroySystem: DestroySystem { protected override void Destroy(SessionPlayerComponent self) { Player player = self.GetMyPlayer(); if (player == null) { return; } Log.Info($"玩家断线了, playerId={self.PlayerId}, name={player.Name}"); // 发送断线消息 // ActorLocationSenderComponent.Instance?.Send(self.PlayerId, new G2M_SessionDisconnect()); // 销毁玩家实体 player.Dispose(); } } /// /// 获取玩家实体 /// /// /// public static Player GetMyPlayer(this SessionPlayerComponent self) { return self.DomainScene().GetComponent().Get(self.PlayerId); } } }