//        private PlayerStateCollectorPool _stateCollectorPool;
//
//        public UserCmdPreExecuteSystem(
//        )
//        {
//            _stateCollectorPool = gameStateProcessorFactory;
//        }

        public void ExecuteUserCmd(IPlayerUserCmdGetter getter, IUserCmd userCmd)
        {
            if (userCmd.Seq != getter.LastCmdSeq + 1)
            {
                _logger.ErrorFormat("{2} lost user cmd last {0}, cur {1}", getter.LastCmdSeq,
                                    userCmd.Seq, getter.OwnerEntityKey);
            }

            if (_logger.IsDebugEnabled)
            {
                _logger.DebugFormat("processing user cmd {0}", userCmd);
            }

            userCmd.FilteredInput = getter.GetFiltedInput(userCmd);
        }
Ejemplo n.º 2
0
        public override void Execute()
        {
            try
            {
                if (!isStepExecute())
                {
                    return;
                }
                SingletonManager.Get <DurationHelp>().ProfileStart(CustomProfilerStep.UserPrediction);
                if (!provider.IsReady())
                {
                    logger.InfoFormat("predicatoinInfoProvider is not ready");
                    return;
                }
                //当前playerContexts玩家的UserCmdPrediction,可能与ewindProvider.RemoteHistoryId不一致!!!!!
                IPlayerUserCmdGetter playerUserCmdGetter = provider.UserCmdOwner;
                // logger.InfoFormat("processing user cmd last:{0} {1} {2}", owner.LastCmdSeq, owner.UserCmdList.Count, owner.UserCmdList.Count>0?owner.UserCmdList.Last().Seq:-1);
                foreach (var cmd in playerUserCmdGetter.UserCmdList)
                {
                    currentCmd = cmd;
                    if (currentCmd.Seq > playerUserCmdGetter.LastCmdSeq)
                    {
                        //过滤输入状态
                        cmd.FilteredInput = playerUserCmdGetter.GetFiltedInput(cmd);

                        //logger.InfoFormat("processing user cmd {0}", cmd);

                        //如果当前是回滚帧数,就执行高帧数要执行的命令。

                        ExecuteSystems();
                        cmd.FilteredInput              = null;
                        cmd.PredicatedOnce             = true;
                        playerUserCmdGetter.LastCmdSeq = cmd.Seq;
                        predictionManager.SavePredictionCompoments(cmd.Seq);
                    }
                }
            }
            finally
            {
                SingletonManager.Get <DurationHelp>().ProfileEnd(CustomProfilerStep.UserPrediction);
            }
        }