コード例 #1
0
        public override ChainedCommand And(Command command)
        {
            command.ThrowIfNull("command");

            AddCommand(command);

            return this;
        }
コード例 #2
0
        public RetryCommand(Command command, TimeSpan retryDelay, int maximumAttempts = MaximumAttempts.Infinite)
        {
            command.ThrowIfNull("command");

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

            _command = command;
            Delay(repeatDelay);
            Times(totalRepeats);
        }
コード例 #4
0
        protected override CommandResult OnExecute(CommandContext context)
        {
            _command = _commandDelegate(context);

            return _command.Execute(context);
        }
コード例 #5
0
 public RepeatCommand(Command command, int totalRepeats = TotalRepeats.Infinite)
     : this(command, TimeSpan.Zero, totalRepeats)
 {
 }
コード例 #6
0
 public RetryCommand(Command command, double retryDelayInSeconds, int maximumAttempts = MaximumAttempts.Infinite)
     : this(command, TimeSpan.FromSeconds(retryDelayInSeconds), maximumAttempts)
 {
 }
コード例 #7
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);
            }
        }
コード例 #8
0
        public void EnqueueCommandToExecuteAtTime(Command command, TimeSpan totalWorldTime, Action<CommandResult> commandExecutedDelegate = null)
        {
            command.ThrowIfNull("command");

            _commandList.Add(command, totalWorldTime, commandExecutedDelegate);
        }
コード例 #9
0
        public void CancelCommand(Command command)
        {
            command.ThrowIfNull("command");

            _commandList.Remove(command);
        }
コード例 #10
0
        private static void SetPaused(Command command, bool paused)
        {
            command._paused = paused;

            foreach (Command nestedCommand in command.NestedCommands)
            {
                SetPaused(nestedCommand, paused);
            }
        }
コード例 #11
0
ファイル: Commands.cs プロジェクト: tj-miller/TextAdventure
 public static RetryCommand Retry(Command command, double retryDelayInSeconds, int maximumAttempts = MaximumAttempts.Infinite)
 {
     return new RetryCommand(command, retryDelayInSeconds, maximumAttempts);
 }
コード例 #12
0
ファイル: Commands.cs プロジェクト: tj-miller/TextAdventure
 public static RetryCommand Retry(Command command, int maximumAttempts = MaximumAttempts.Infinite)
 {
     return new RetryCommand(command, maximumAttempts);
 }
コード例 #13
0
ファイル: Commands.cs プロジェクト: tj-miller/TextAdventure
 public static RepeatCommand Repeat(Command command, TimeSpan repeatDelay, int totalRepeats = TotalRepeats.Infinite)
 {
     return new RepeatCommand(command, repeatDelay, totalRepeats);
 }
コード例 #14
0
ファイル: Commands.cs プロジェクト: tj-miller/TextAdventure
 public static RepeatCommand Repeat(Command command, double repeatDelayInSeconds, int totalRepeats = TotalRepeats.Infinite)
 {
     return new RepeatCommand(command, repeatDelayInSeconds, totalRepeats);
 }
コード例 #15
0
ファイル: Commands.cs プロジェクト: tj-miller/TextAdventure
 public static RepeatCommand Repeat(Command command, int totalRepeats = TotalRepeats.Infinite)
 {
     return new RepeatCommand(command, totalRepeats);
 }
コード例 #16
0
 public RepeatCommand(Command command, double repeatDelayInSeconds, int totalRepeats = TotalRepeats.Infinite)
     : this(command, TimeSpan.FromSeconds(repeatDelayInSeconds), totalRepeats)
 {
 }
コード例 #17
0
        public void CommandExecuted(Command command, CommandResult result)
        {
            command.ThrowIfNull("command");

            _logRendererState.EnqueueCommandExecutedLogEntry(_worldTime.Total, command, result);
        }
コード例 #18
0
ファイル: Commands.cs プロジェクト: tj-miller/TextAdventure
 public static RetryCommand Retry(Command command, TimeSpan retryDelay, int maximumAttempts = MaximumAttempts.Infinite)
 {
     return new RetryCommand(command, retryDelay, maximumAttempts);
 }
コード例 #19
0
 public void CommandExecuting(Command command)
 {
     command.ThrowIfNull("command");
 }
コード例 #20
0
ファイル: Commands.cs プロジェクト: tj-miller/TextAdventure
        public static Command Tagged(Command command, Guid tag)
        {
            command.ThrowIfNull("command");

            return command.WithTag(tag);
        }
コード例 #21
0
        public virtual ChainedCommand And(Command command)
        {
            var chainedCommand = new ChainedCommand(this);

            chainedCommand.And(this);

            return chainedCommand;
        }
コード例 #22
0
ファイル: Commands.cs プロジェクト: tj-miller/TextAdventure
 public static ChainedCommand Chain(Command command)
 {
     return new ChainedCommand(command);
 }
コード例 #23
0
        public bool CommandQueued(Command command)
        {
            command.ThrowIfNull("command");

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

            AddCommand(command);
        }
コード例 #25
0
        public void EnqueueCommandWithExecutionDelay(Command command, TimeSpan executionDelay, Action<CommandResult> commandExecutedDelegate = null)
        {
            command.ThrowIfNull("command");

            _commandList.Add(command, _worldInstance.WorldTime.Total + executionDelay, commandExecutedDelegate);
        }
コード例 #26
0
        public bool Contains(Command command)
        {
            command.ThrowIfNull("command");

            return _commands.Any(arg => arg.Command == command);
        }
コード例 #27
0
 public RetryCommand(Command command, int maximumAttempts = MaximumAttempts.Infinite)
     : this(command, TimeSpan.Zero, maximumAttempts)
 {
 }
コード例 #28
0
 private void AddCommand(Command command)
 {
     _originalCommands.Add(command);
 }
コード例 #29
0
        public void Add(Command command, TimeSpan executeAtTime, Action<CommandResult> commandExecutedDelegate = null)
        {
            command.ThrowIfNull("command");

            _commands.Add(new CommandListEntry(command, executeAtTime, commandExecutedDelegate));
        }
コード例 #30
0
        public void Remove(Command command)
        {
            command.ThrowIfNull("command");

            _commands.RemoveAll(arg => arg.Command == command);
            foreach (Command nestedCommand in command.NestedCommands)
            {
                Remove(nestedCommand);
            }
        }