using System.Linq; namespace ET.Server { [FriendOf(typeof (GamePlayerComponent))] public static class GamePlayerComponentSystem { public class PlayerComponentAwakeSystem: AwakeSystem { /// /// 游戏服在线玩家组件创建 /// /// protected override void Awake(GamePlayerComponent self) { } } public class PlayerComponentDestroySystem: DestroySystem { /// /// 游戏服在线玩家组件销毁 /// /// protected override void Destroy(GamePlayerComponent self) { } } public static void Add(this GamePlayerComponent self, long playerId, WNPlayer player) { self.idPlayers[playerId] = player; } public static WNPlayer Get(this GamePlayerComponent self, long id) { self.idPlayers.TryGetValue(id, out WNPlayer gamer); return gamer; } public static void Remove(this GamePlayerComponent self, long id) { self.idPlayers.Remove(id); } public static WNPlayer[] GetAll(this GamePlayerComponent self) { return self.idPlayers.Values.ToArray(); } } }