Exemplo n.º 1
0
        public virtual void Action(IList <ArgValue> funcArgs, IEventArgs args)
        {
            long s = FreeTimeDebug.RecordStart("call " + name + "(" + key + ")");

            FreeLog.CallFunc("call " + name + "(" + key + "):");
            if (funcArgs != null)
            {
                foreach (FuncArg arg in this.args)
                {
                    SetArg(arg, funcArgs, args);
                }
            }
            if (action != null)
            {
                action.Act(args);
            }
            if (funcArgs != null)
            {
                foreach (FuncArg arg in this.args)
                {
                    RemoveArg(arg, args);
                }
            }
            FreeTimeDebug.RecordEnd("call " + name + "(" + key + ")", s);
        }
Exemplo n.º 2
0
        public override void DoAction(IEventArgs args)
        {
            if (values == null)
            {
                values = new List <ArgValue>();
            }

            foreach (CommonGameAction function in args.Functions)
            {
                if (function.GetKey() == FreeUtil.ReplaceVar(key, args))
                {
                    GameFunc func = function.ToGameFunc();
                    checkArg(func);

                    try
                    {
                        //long mem = GC.GetTotalMemory(false);
                        func.Action(values, args);
                        //Debug.LogFormat("call func {0}, args:{1}, memory:{2}", key, ToArgString(), GC.GetTotalMemory(false) - mem);
                        if (FreeLog.IsEnable())
                        {
                            FreeLog.CallFunc(string.Format("call func:{0}, args:{1}", key, ToArgString()));
                        }
                    }
                    catch (Exception e)
                    {
                        FreeLog.Error("call func " + key + " failed.\n"
                                      + ExceptionUtil.GetExceptionContent(e), this);
                    }

                    break;
                }
            }
        }