Class CommandWaitTask
- Namespace
- Uncreated.Warfare.Interaction.Commands
- Assembly
- Uncreated.Warfare.dll
Allows await a command execution from either all players or a given player.
public class CommandWaitTask : CustomYieldInstruction, IEnumerator, IDisposable
- Inheritance
-
CustomYieldInstructionCommandWaitTask
- Implements
- Inherited Members
-
CustomYieldInstruction.MoveNext()CustomYieldInstruction.Reset()CustomYieldInstruction.Current
Remarks
Constructors
CommandWaitTask(CommandInfo, ICommandUser?, TimeSpan, CancellationToken, CommandWaitOptions, IServiceProvider)
public CommandWaitTask(CommandInfo command, ICommandUser? user, TimeSpan timeout, CancellationToken token, CommandWaitOptions flags, IServiceProvider serviceProvider)
Parameters
commandCommandInfouserICommandUsertimeoutTimeSpantokenCancellationTokenflagsCommandWaitOptionsserviceProviderIServiceProvider
Exceptions
- InvalidOperationException
Services CommandDispatcher and/or ILoopTickerFactory not found.
- OperationCanceledException
tokenis cancelled.
CommandWaitTask(CommandInfo, ICommandUser?, TimeSpan, CancellationToken, CommandWaitOptions, CommandDispatcher, ILoopTickerFactory)
public CommandWaitTask(CommandInfo command, ICommandUser? user, TimeSpan timeout, CancellationToken token, CommandWaitOptions flags, CommandDispatcher commandDispatcher, ILoopTickerFactory tickerFactory)
Parameters
commandCommandInfouserICommandUsertimeoutTimeSpantokenCancellationTokenflagsCommandWaitOptionscommandDispatcherCommandDispatchertickerFactoryILoopTickerFactory
Properties
Command
The command to wait for.
public CommandInfo Command { get; }
Property Value
IsAborted
If the task was aborted before the timeout.
public bool IsAborted { get; }
Property Value
IsCancelled
If the task was cancelled using a CancellationToken before the timeout.
public bool IsCancelled { get; }
Property Value
IsCompleted
If the command was executed or timed out.
public bool IsCompleted { get; }
Property Value
IsDisconnected
If the user disconnected before the timeout.
public bool IsDisconnected { get; }
Property Value
IsSuccessfullyExecuted
If the command was executed.
public bool IsSuccessfullyExecuted { get; }
Property Value
IsTimedOut
If the command timed out.
public bool IsTimedOut { get; }
Property Value
Remarks
Always true if IsDisconnected is true.
Options
Flags deciding how the task is awaited.
public CommandWaitOptions Options { get; }
Property Value
Result
Get info about the command execution after completion.
public CommandWaitResult Result { get; }
Property Value
Exceptions
- InvalidOperationException
Task not completed.
- TimeoutException
Task timed out or user disconnected.
- OperationCanceledException
Operation was aborted.
Timeout
The amount of time before the wait is aborted.
public TimeSpan Timeout { get; }
Property Value
User
The user that should run the command. null matches all players.
public ICommandUser? User { get; }
Property Value
keepWaiting
Property for UnityEngine.CustomYieldInstruction. true when a coroutine should continue waiting on this task.
public override bool keepWaiting { get; }
Property Value
Methods
Abort()
Cancel this task.
public void Abort()
GetAwaiter()
public CommandWaitTask.CommandWaitAwaiter GetAwaiter()
Returns
MarkCompleted(Lazy<CommandContext>, ICommandUser)
Notify this task that it's command has been executed by user.
public void MarkCompleted(Lazy<CommandContext> contextFactory, ICommandUser user)
Parameters
contextFactoryLazy<CommandContext>userICommandUser
MarkDisconnected()
Notify this task that it's user disconnected.
public void MarkDisconnected()