public override void DoAction(IEventArgs args) { if (remove) { args.GameContext.sceneObject.DestroyAllEntities(); } else { if (MapConfigPoints.current != null) { if (MapConfigPoints.current.IDPints.Count == 0) { Logger.Error("地图点位(组)数量为0!"); } List <ItemDrop> list = new List <ItemDrop>(); foreach (MapConfigPoints.ID_Point point in MapConfigPoints.current.IDPints) { list.AddRange(SingletonManager.Get <FreeItemDrop>().GetDropItems(point.ID, args.GameContext.session.commonSession.RoomInfo.MapId)); Logger.InfoFormat("地图点位 {0} 上,将会刷新 {1} 个(组)物品", point.ID, list.Count); } if (list.Count > 0) { TimerGameAction timer = new TimerGameAction(); timer.time = "200"; timer.count = list.Count.ToString(); timer.SetAction(new RefreshItemAction(list)); timer.Act(args); } } else { Logger.Error("地图点位(组)不存在!"); } } }
public override void DoAction(IEventArgs args) { if (remove) { args.GameContext.sceneObject.DestroyAllEntities(); } else { Accumulator <string> acc = new Accumulator <string>(); if (MapConfigPoints.current != null) { foreach (MapConfigPoints.ID_Point point in MapConfigPoints.current.IDPints) { List <ItemDrop> list = FreeItemDrop.GetDropItems(point.ID); foreach (ItemDrop item in list) { acc.AddKey(string.Format("{0}_{1}", item.cat, item.id), 1); } TimerGameAction timer = new TimerGameAction(); timer.time = "200"; timer.count = list.Count.ToString(); timer.SetAction(new RefreshItemAction(list)); timer.Act(args); } } List <string> items = new List <string>(); foreach (string key in acc.KeysSortedByValue()) { items.Add(string.Format("{0}={1}", key, acc.GetCount(key))); } Debug.LogFormat("items:\n{0}", string.Join("\n", items.ToArray())); } }