コード例 #1
0
        public RepeatCommand(Command command, TimeSpan repeatDelay, int totalRepeats = TotalRepeats.Infinite)
        {
            command.ThrowIfNull("command");

            _command = command;
            Delay(repeatDelay);
            Times(totalRepeats);
        }
コード例 #2
0
        public RetryCommand(Command command, TimeSpan retryDelay, int maximumAttempts = MaximumAttempts.Infinite)
        {
            command.ThrowIfNull("command");

            _command = command;
            Delay(retryDelay);
            Times(maximumAttempts);
        }
コード例 #3
0
        public override ChainedCommand And(Command command)
        {
            command.ThrowIfNull("command");

            AddCommand(command);

            return this;
        }
コード例 #4
0
        public void ExecuteCommand(Command command)
        {
            command.ThrowIfNull("command");

            _worldObserver.CommandExecuting(command);

            CommandResult result = command.Execute(_context);
            bool wasDeferred = result == CommandResult.Deferred;

            if (wasDeferred)
            {
                _commandList.Add(command, _worldInstance.WorldTime.Total);
            }
            else
            {
                _worldObserver.CommandExecuted(command, result);
            }
        }
コード例 #5
0
        public void EnqueueCommandWithExecutionDelay(Command command, TimeSpan executionDelay, Action<CommandResult> commandExecutedDelegate = null)
        {
            command.ThrowIfNull("command");

            _commandList.Add(command, _worldInstance.WorldTime.Total + executionDelay, commandExecutedDelegate);
        }
コード例 #6
0
        public void EnqueueCommandToExecuteAtTime(Command command, TimeSpan totalWorldTime, Action<CommandResult> commandExecutedDelegate = null)
        {
            command.ThrowIfNull("command");

            _commandList.Add(command, totalWorldTime, commandExecutedDelegate);
        }
コード例 #7
0
        public bool CommandQueued(Command command)
        {
            command.ThrowIfNull("command");

            return _commandList.Contains(command);
        }
コード例 #8
0
        public void CancelCommand(Command command)
        {
            command.ThrowIfNull("command");

            _commandList.Remove(command);
        }
コード例 #9
0
 public void CommandExecuting(Command command)
 {
     command.ThrowIfNull("command");
 }
コード例 #10
0
        public void CommandExecuted(Command command, CommandResult result)
        {
            command.ThrowIfNull("command");

            _logRendererState.EnqueueCommandExecutedLogEntry(_worldTime.Total, command, result);
        }
コード例 #11
0
        public ChainedCommand(Command command)
        {
            command.ThrowIfNull("command");

            AddCommand(command);
        }
コード例 #12
0
ファイル: Commands.cs プロジェクト: tj-miller/TextAdventure
        public static Command Tagged(Command command, Guid tag)
        {
            command.ThrowIfNull("command");

            return command.WithTag(tag);
        }
コード例 #13
0
        public void Remove(Command command)
        {
            command.ThrowIfNull("command");

            _commands.RemoveAll(arg => arg.Command == command);
            foreach (Command nestedCommand in command.NestedCommands)
            {
                Remove(nestedCommand);
            }
        }
コード例 #14
0
        public bool Contains(Command command)
        {
            command.ThrowIfNull("command");

            return _commands.Any(arg => arg.Command == command);
        }
コード例 #15
0
        public void Add(Command command, TimeSpan executeAtTime, Action<CommandResult> commandExecutedDelegate = null)
        {
            command.ThrowIfNull("command");

            _commands.Add(new CommandListEntry(command, executeAtTime, commandExecutedDelegate));
        }