Пример #1
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;
                }
            }
        }
Пример #2
0
        public virtual void AddFreeBuf(FreeBuf buf, IEventArgs args)
        {
            string key = FreeUtil.ReplaceVar(buf.GetKey(), args);

            if (map.ContainsKey(key))
            {
                FreeLog.Error("buf '" + key + "' 覆盖了原有的BUF", null);
            }
            this.map[key] = buf;
        }