コード例 #1
0
ファイル: FreeLog.cs プロジェクト: yangfan111/CsharpCode
 private static IPara GetPara(IEventArgs args, ParaExp pe)
 {
     if (pe.GetUnit().Equals("robot"))
     {
         foreach (string key in args.GetUnitKeys())
         {
             if (key.Equals("robot"))
             {
                 IParable parable = args.GetUnit(key);
                 if (parable != null && parable.GetType().Name.Equals("FreeData"))
                 {
                     IPara para = parable.GetParameters().Get(pe.GetPara());
                     if (para != null)
                     {
                         return(para);
                     }
                 }
             }
         }
     }
     else
     {
         if (pe.GetUnit().Equals("player"))
         {
             foreach (string key in args.GetUnitKeys())
             {
                 if (!key.Equals("robot"))
                 {
                     IParable parable = args.GetUnit(key);
                     if (parable != null && parable.GetType().Name.Equals("FreeData"))
                     {
                         IPara para = parable.GetParameters().Get(pe.GetPara());
                         if (para != null)
                         {
                             return(para);
                         }
                     }
                 }
             }
         }
         else
         {
             IParable parable = args.GetUnit(pe.GetUnit());
             if (parable != null)
             {
                 return(pe.GetSourcePara(args));
             }
         }
     }
     return(null);
 }
コード例 #2
0
        public override void DoAction(IEventArgs args)
        {
            if (key == 0)
            {
                key = unique;
                unique++;
                if (StringUtil.IsNullOrEmpty(count) || "0".Equals(count))
                {
                    count = "1";
                }
                args.FreeContext.TimerTask.Register(key, this);
                this.map          = new MyDictionary <long, MyDictionary <string, IParable> >();
                this.vMap         = new MyDictionary <long, MyDictionary <string, ParaList> >();
                this.currentTime  = new MyDictionary <long, int>();
                this.currentCount = new MyDictionary <long, int>();
                this.keyMap       = new MyDictionary <string, long>();
            }
            long s = executeCount++;

            currentTime[s]  = FreeUtil.ReplaceInt(time, args);
            currentCount[s] = 0;
            if (FreeUtil.ReplaceVar(name, args) != null)
            {
                keyMap[FreeUtil.ReplaceVar(name, args)] = s;
            }
            map[s]  = new MyDictionary <string, IParable>();
            vMap[s] = new MyDictionary <string, ParaList>();
            foreach (string unit in args.GetUnitKeys())
            {
                IParable pa = args.GetUnit(unit);
                if (pa != null)
                {
                    map[s][unit]  = pa;
                    vMap[s][unit] = pa.GetParameters().Clone();
                }
            }
            if (startAction != null)
            {
                startAction.Act(args);
            }
        }