public override void DoAction(IEventArgs args) { Ini(args); List <FreeData> list = new List <FreeData>(); foreach (PlayerEntity unit in args.GameContext.player.GetInitializedPlayerEntities()) { if (unit.hasFreeData) { FreeData fd = (FreeData)unit.freeData.FreeData; args.TempUse(selectedName, fd); if (con == null || con.Meet(args)) { list.Add(fd); } args.Resume(selectedName); } } if (!StringUtil.IsNullOrEmpty(order)) { DataBlock bl = new DataBlock(); foreach (FreeData fd in list) { bl.AddData(fd); } if (method == null || FreeUtil.IsVar(order)) { method = new SelectMethod(order); } list.Clear(); foreach (IFeaturable fe in method.Select(bl).GetAllDatas()) { list.Add((FreeData)fe); } } if (list.Count > 0) { if (count > 0) { int[] ids = RandomUtil.Random(0, list.Count - 1, count); if (!StringUtil.IsNullOrEmpty(order)) { ids = new int[(int)MyMath.Min(count, list.Count)]; for (int i = 0; i < ids.Length; i++) { ids[i] = i; } } for (int i = 0; i < ids.Length; i++) { int id = ids[i]; FreeData unit = list[id]; args.TempUsePara(new IntPara("index", i + 1)); args.TempUsePara(new IntPara("count", ids.Length)); args.TempUse(selectedName, unit); action.Act(args); args.Resume(selectedName); args.ResumePara("index"); args.ResumePara("count"); } } else { int i = 1; foreach (FreeData unit in list) { args.TempUsePara(new IntPara("index", i++)); args.TempUsePara(new IntPara("count", list.Count)); args.TempUse(selectedName, unit); action.Act(args); args.Resume(selectedName); args.ResumePara("index"); args.ResumePara("count"); } } } else { if (noneAction != null) { noneAction.Act(args); } } }