Example #1
0
        public void PlayerPressCmd(Contexts room, PlayerEntity player, IUserCmd cmd)
        {
            FreeLog.Reset();

            args.input.SetUserCmd(cmd);

            FreeData freeData = (FreeData)player.freeData.FreeData;

            if (freeData.Player.gamePlay.LifeState != (int)EPlayerLifeState.Dead)
            {
                args.TempUse("current", freeData);

                args.FreeContext.Bufs.Eat(player, args);

                freeData.freeInventory.UsingItem(args);

                //freeData.GetUnitSkill().Frame(args);

                freeData.StateTimer.AutoRemove(args, serverTime);

                args.Resume("current");
            }

            FreeLog.Print();
        }
        protected override void ExecuteUserCmd(PlayerEntity player, IUserCmd cmd)
        {
            ISkillArgs args = (ISkillArgs)contexts.session.commonSession.FreeArgs;

            if (SharedConfig.IsServer)
            {
                FreeLog.Reset();
            }
            args.GetInput().SetUserCmd(cmd);
            if (player.gamePlay.LifeState != (int)EPlayerLifeState.Dead)
            {
                FreeData fd = ((FreeData)player.freeData.FreeData);
                args.TempUse("current", fd);

                if (cmd.IsPDown)
                {
                    Debug.LogFormat("p down {0}, is server {1}", cmd.Seq, SharedConfig.IsServer);
                }
                fd.GetUnitSkill().Frame(args);

                args.Resume("current");
            }

            if (SharedConfig.IsServer)
            {
                FreeLog.Print();
            }
        }
Example #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();
            }
        }
Example #4
0
        public void Update(Contexts room, int interval)
        {
            FreeLog.Reset();

            //if (firstTime == false)
            //{
            //    GameStart(room);

            //    firstTime = true;
            //}

            serverTime = Runtime.CurrentTimeMillis() - startTime;

            //RandomUtil.SetSeed((int) serverTime);

            args.FreeContext.TimerTask.TimeElapse(args, (int)(serverTime - lastServerTime));
            UpdateFreeMoveEntity(room, interval);
            args.FreeContext.TestCase.Frame(args);
            args.FreeContext.MultiFrame.Act(args);

            PlayerEntity[] players = args.GameContext.player.GetInitializedPlayerEntities();
            for (int i = 0; i < players.Length; i++)
            {
                FreeData freeData = (FreeData)players[i].freeData.FreeData;
                freeData.Bufs.Frame(args);
                freeData.EffectBufs.Update(args);
                if (!args.Triggers.IsEmpty(FreeTriggerConstant.FRAME_PLAYER))
                {
                    args.Trigger(FreeTriggerConstant.FRAME_PLAYER, new TempUnit("player", freeData));
                }
            }

            if (!this.args.Triggers.IsEmpty(FreeTriggerConstant.FRAME))
            {
                this.args.Triggers.Trigger(FreeTriggerConstant.FRAME, args);
            }


            lastServerTime = serverTime;

            FreeLog.Print();
        }