using System.Linq; namespace ET.Server { [FriendOf(typeof (GameMapComponent))] public static class GameMapComponentSystem { public class GameMapComponentAwakeSystem: AwakeSystem { /// /// 游戏服场景组件创建 /// /// protected override void Awake(GameMapComponent self) { GameMapComponent.Instance = self; // todo 添加场景销毁检测定时器 } } public class GameMapComponentDestroySystem: DestroySystem { /// /// 游戏服场景组件销毁 /// /// protected override void Destroy(GameMapComponent self) { } } public static void Add(this GameMapComponent self, Map map) { self.allMaps.TryAdd(map.Id, map); } public static Map Get(this GameMapComponent self, long instanceId) { self.allMaps.TryGetValue(instanceId, out Map map); return map; } public static void Remove(this GameMapComponent self, long instanceId) { self.allMaps.Remove(instanceId); } public static Map[] GetAll(this GameMapComponent self) { return self.allMaps.Values.ToArray(); } } }