using System.Linq; namespace ET.Server { [FriendOf(typeof (GamePlayerComponent))] public static class GamePlayerComponentSystem { public class PlayerComponentAwakeSystem: AwakeSystem<GamePlayerComponent> { /// <summary> /// 游戏服在线玩家组件创建 /// </summary> /// <param name="self"></param> protected override void Awake(GamePlayerComponent self) { } } public class PlayerComponentDestroySystem: DestroySystem<GamePlayerComponent> { /// <summary> /// 游戏服在线玩家组件销毁 /// </summary> /// <param name="self"></param> 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(); } } }