Esempio n. 1
0
 public override void DoAction(IEventArgs args)
 {
     if (FreeLog.IsEnable())
     {
         logger.InfoFormat("{0} | {1}", DateTime.Now.ToString(), log);
     }
 }
Esempio 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;
                }
            }
        }
Esempio n. 3
0
        public static void Handle(ServerRoom room, DebugCommand message, PlayerEntity player)
        {
            if (commandDic.ContainsKey(message.Command.ToLower()))
            {
                FreeLog.Reset();

                IGameAction action = commandDic[message.Command.ToLower()];

                if (FreeLog.IsEnable())
                {
                    FreeLog.SetTrigger(string.Format("命令行 {0}: {1}", message.Command, string.Join(" ", message.Args)));
                }

                if (commandPara == null)
                {
                    commandPara = new StringPara("command", "");
                }

                if (message.Args != null)
                {
                    for (int i = 1; i <= message.Args.Length; i++)
                    {
                        room.FreeArgs.TempUsePara(new StringPara("arg" + i, message.Args[i - 1]));
                    }
                }


                room.FreeArgs.TempUsePara(commandPara);
                room.FreeArgs.TempUse("current", (FreeData)player.freeData.FreeData);

                action.Act(room.FreeArgs);

                if (message.Command == "relive")
                {
                    player.isFlagCompensation = true;
                }

                room.FreeArgs.Resume("current");
                room.FreeArgs.ResumePara("command");

                if (message.Args != null)
                {
                    for (int i = 1; i <= message.Args.Length; i++)
                    {
                        room.FreeArgs.ResumePara("arg" + i);
                    }
                }

                FreeLog.Print();
            }
        }
Esempio n. 4
0
        public override void DoAction(IEventArgs args)
        {
            builder = FreePool.Allocate();

            BuildMessage(args);

            //if (builder.Key == 52)
            //{
            //          Debug.Log(builder.ToString());
            //}


            if (FreeLog.IsEnable())
            {
                Log(args);
            }

            if (sender != null)
            {
                sender.SendMessage(args, builder, FreeUtil.ReplaceInt(scope, args), FreeUtil.ReplaceVar(player, args));
            }
        }