public override void DoAction(IEventArgs args) { if (StringUtil.IsNullOrEmpty(key)) { key = BaseEventArgs.DEFAULT; } IParable unit = args.GetUnit(key); if (unit != null) { IPara sort = unit.GetParameters().Get(sorter); if (sort != null && sort is ParaListSet) { ParaListSet pls = (ParaListSet)sort; IParable pa = Get(); if (action != null) { args.TempUse(TEMP_SORT, pa); args.TempUse("element", pa); action.Act(args); args.Resume("element"); args.Resume(TEMP_SORT); } pls.AddParaList(pa.GetParameters()); } } }
public override void DoAction(IEventArgs args) { if (StringUtil.IsNullOrEmpty(key)) { key = BaseEventArgs.DEFAULT; } IParable unit = args.GetUnit(key); if (unit != null) { IPara sort = unit.GetParameters().Get(sorter); if (sort != null) { ParaListSet pls = (ParaListSet)sort; IList <ParaList> removes = new List <ParaList>(); foreach (ParaList pl in pls) { if (StringUtil.IsNullOrEmpty(exp) || pl.Meet(exp)) { removes.Add(pl); } } foreach (ParaList pl_1 in removes) { pls.RemoveParaList(pl_1); } } } }
public override void DoAction(IEventArgs args) { if (StringUtil.IsNullOrEmpty(key)) { key = BaseEventArgs.DEFAULT; } IParable unit = args.GetUnit(key); if (unit != null) { IPara sort = unit.GetParameters().Get(sorter); if (sort != null) { ParaListSet pls = (ParaListSet)sort; if (action != null) { ParaListSet temp = pls.Sort(FreeUtil.ReplaceVar(exp, args)); temp.SetName(pls.GetName()); unit.GetParameters().TempUse(temp); action.Act(args); unit.GetParameters().Resume(temp.GetName()); } if (!keep) { pls.ReOrder(); } } } }
public override void DoAction(IEventArgs args) { if (StringUtil.IsNullOrEmpty(key)) { key = BaseEventArgs.DEFAULT; } IParable unit = args.GetUnit(key); if (unit != null) { IPara sort = unit.GetParameters().Get(sorter); if (sort != null) { ParaListSet pls = (ParaListSet)sort; if (action != null) { Iterator <ParaList> it = pls.Iterator(); int i = 1; while (it.HasNext()) { ParaList pl = it.Next(); args.TempUse("element", new SimpleParable(pl)); args.GetDefault().GetParameters().TempUse(new IntPara("index", i++)); if (condition == null || condition.Meet(args)) { if (action != null) { action.Act(args); } if (FreeUtil.ReplaceBool(remove, args)) { it.Remove(); } } args.GetDefault().GetParameters().Resume("index"); args.Resume("element"); } if (i == 1) { if (noneAction != null) { noneAction.Act(args); } } } } } }
public override object GetValue(IEventArgs args) { if (!StringUtil.IsNullOrEmpty(autoCondition)) { select = new SelectMethod(FreeUtil.ReplaceVar(autoCondition, args)); } IList <ParaList> list = new List <ParaList>(); ParaListSet pls = null; foreach (UnitPara sort in UnitPara.Parse(sorts)) { IParable pa = args.GetUnit(sort.GetUnit()); if (pa == null) { continue; } IPara para = pa.GetParameters().Get(sort.GetPara()); if (para == null) { continue; } if (para != null && para is ParaListSet) { ParaListSet ps = (ParaListSet)para; pls = ps; foreach (ParaList pl in ps) { list.Add(pl); } } } IList <SimpleProto> results = new List <SimpleProto>(); if (pls != null && list.Count > 0) { IList <ParaList> r = pls.Select(list, FreeUtil.ReplaceVar(order, args), capacity); int min = 0; int max = 0; if (!StringUtil.IsNullOrEmpty(range)) { string[] vs = StringUtil.Split(FreeUtil.ReplaceVar(range, args), "-"); if (vs.Length == 2) { min = int.Parse(vs[0]); max = int.Parse(vs[1]); } } foreach (ParaList pl in r) { if (min != max) { int paraOrder = (int)pl.GetFeatureValue(ParaListSet.PARA_ORDER); if (paraOrder < min || paraOrder > max) { continue; } } SimpleProto b = FreePool.Allocate(); b.Ks.Add(0); b.Key = 0; b.Ss.Add("0"); string[] fs = StringUtil.Split(fields, ","); for (int i = 0; i < fs.Length; i++) { b.Ks.Add(i + 1); b.Ss.Add(pl.GetFeatureValue(fs[i]).ToString()); if (select != null) { pl.TempUse(new IntPara("seq", i + 1)); if (select.Meet(pl)) { b.Ins.Add(2 * 100); } else { b.Ins.Add(0); } pl.Resume("seq"); } else { b.Ins.Add(0); } } results.Add(b); } } return(results.ToArray()); }
public virtual IPara GetPara(IEventArgs args) { IParable parable = args.GetUnit(unit); if (parable != null) { ParaList pl = args.GetUnit(unit).GetParameters(); if (pl.HasPara(para)) { return(pl.Get(para)); } else { bool has = (para.IndexOf('[') > -1); bool has2 = (para.IndexOf(']') > -1); string[] vs = Split(GetPara(), 1); if (has && has2) { vs = new string[] { para }; } if (vs.Length != 4) { if (has && has2 && para.Contains("[@") && para.Contains("']/@")) /* ¼õÉÙContainsµ÷ÓÃ */ { vs = Split(GetPara(), 2); } } if (vs.Length == 4) { IPara p = pl.Get(vs[0].Trim()); if (p != null && p is ParaListSet) { ParaListSet pls = (ParaListSet)p; ParaList sub = pls.GetParaList(vs[1].Trim(), vs[2].Trim(), args); if (sub != null && sub.HasPara(vs[3].Trim())) { return(sub.Get(vs[3].Trim())); } } } else { if (has && has2) { vs = Split(para, 3); if (vs.Length == 3 && StringUtil.IsNullOrEmpty(vs[2])) { IPara p = pl.Get(vs[0].Trim()); if (p != null && (p is MapPara || p is StringPara)) { if (p is MapPara) { MapPara mp = (MapPara)p; if (vs[1].Trim().Equals("length")) { return(new IntPara(p.GetName(), mp.Size())); } return(mp.GetValue(vs[1].Trim())); } if (p is StringPara) { if ("length".Equals(vs[1].Trim())) { return(new IntPara(p.GetName(), p.GetValue().ToString().Length)); } } } } } } } return(null); } else { throw new GameConfigExpception("unit " + unit + " is not existed.\n" + GetUnit() + "." + GetPara()); } }