using System.Collections.Generic; namespace ET { public class GatherComponentDestroySystem : DestroySystem { public override void Destroy(GatherComponent self) { } } [FriendClass(typeof(Gather))] public static class GatherComponentSystem { public static Gather GetGatherByPeopleId(this GatherComponent self, long peopleId) { foreach (var v in self.Children) { var gather = (Gather) v.Value; if (gather.HavePeople(peopleId)) { return gather; } } return null; } public static Gather GetherByResPointId(this GatherComponent self, long resId) { foreach (var v in self.Children) { var res = (Gather) v.Value; if (res.ResPointId==resId) { return res; } } return null; } #if SERVER public static void Update(this GatherComponent self, Unit unit,int tick) { Dictionary resAttriDic = new Dictionary(); foreach (var v in self.Children) { var gather = (Gather)v.Value; var attri = gather.Product(unit,tick); resAttriDic[gather.ResPointId] = attri; } GatherHelper.NotifyResourceAttri(unit,resAttriDic); } #endif } }