Пример #1
0
        public virtual ZeroLagCommand GetTimeoutedCommand(TimeoutCommand timeout)
        {
            List <ZeroLagCommand> currTurnCommands;

            if (!commands.TryGetValue(timeout.targetCommandStep, out currTurnCommands))
            {
                return(null);
            }
            ZeroLagCommand targetCommand = currTurnCommands.Find(cmd => cmd.hash == timeout.targetCommandHash);

            return(targetCommand);
        }
Пример #2
0
        public void ReceiveTimeout(TimeoutCommand timeout)
        {
            List <TimeoutCommand> currStepReceivedTimeouts;
            int step = getCurrStep();

            if (!timeouts.TryGetValue(step, out currStepReceivedTimeouts))
            {
                currStepReceivedTimeouts = new List <TimeoutCommand>();
                timeouts.Add(step, currStepReceivedTimeouts);
            }
            currStepReceivedTimeouts.Add(timeout);
        }
Пример #3
0
        private bool TryConsumeTimeout(TimeoutCommand timeout)
        {
            ZeroLagCommand targetCommand = playedGameReplay.GetTimeoutedCommand(timeout);

            if (targetCommand == null)
            {
                return(false);
            }
            int targetCommandStep = targetCommand.stepInd;

            lastActualStep = Math.Min(lastActualStep, targetCommandStep);
            targetCommand.OnTimedout(timeout);
            playedGameReplay.commands[targetCommandStep].RemoveOne(cmd => cmd.hash == timeout.targetCommandHash);
            if (timeout.whatToDo == ActionOnTimeout.ExecuteLater)
            {
                ReceiveCommand(targetCommand); // Receive command later.
            }
            return(true);
        }
Пример #4
0
 public virtual void ReceiveTimeout(TimeoutCommand timeout)
 {
 }
Пример #5
0
        public override ZeroLagCommand GetTimeoutedCommand(TimeoutCommand timeout)
        {
            var replay = FlatternToReplay();

            return(replay.GetTimeoutedCommand(timeout));
        }
Пример #6
0
 public override void ReceiveTimeout(TimeoutCommand timeout)
 {
     lock (timeoutsBufferLock)
         timeoutsThreadBuffer.Add(timeout);
 }
Пример #7
0
 public override void ReceiveTimeout(TimeoutCommand timeout)
 {
     base.ReceiveTimeout(timeout);
     notConsideredCommands.Add(timeout);
 }