Table of Contents

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
CustomYieldInstruction
CommandWaitTask
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

command CommandInfo
user ICommandUser
timeout TimeSpan
token CancellationToken
flags CommandWaitOptions
serviceProvider IServiceProvider

Exceptions

InvalidOperationException

Services CommandDispatcher and/or ILoopTickerFactory not found.

OperationCanceledException

token is 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

command CommandInfo
user ICommandUser
timeout TimeSpan
token CancellationToken
flags CommandWaitOptions
commandDispatcher CommandDispatcher
tickerFactory ILoopTickerFactory

Properties

Command

The command to wait for.

public CommandInfo Command { get; }

Property Value

CommandInfo

IsAborted

If the task was aborted before the timeout.

public bool IsAborted { get; }

Property Value

bool

IsCancelled

If the task was cancelled using a CancellationToken before the timeout.

public bool IsCancelled { get; }

Property Value

bool

IsCompleted

If the command was executed or timed out.

public bool IsCompleted { get; }

Property Value

bool

IsDisconnected

If the user disconnected before the timeout.

public bool IsDisconnected { get; }

Property Value

bool

IsSuccessfullyExecuted

If the command was executed.

public bool IsSuccessfullyExecuted { get; }

Property Value

bool

IsTimedOut

If the command timed out.

public bool IsTimedOut { get; }

Property Value

bool

Remarks

Always true if IsDisconnected is true.

Options

Flags deciding how the task is awaited.

public CommandWaitOptions Options { get; }

Property Value

CommandWaitOptions

Result

Get info about the command execution after completion.

public CommandWaitResult Result { get; }

Property Value

CommandWaitResult

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

TimeSpan

User

The user that should run the command. null matches all players.

public ICommandUser? User { get; }

Property Value

ICommandUser

keepWaiting

Property for UnityEngine.CustomYieldInstruction. true when a coroutine should continue waiting on this task.

public override bool keepWaiting { get; }

Property Value

bool

Methods

Abort()

Cancel this task.

public void Abort()

GetAwaiter()

public CommandWaitTask.CommandWaitAwaiter GetAwaiter()

Returns

CommandWaitTask.CommandWaitAwaiter

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

contextFactory Lazy<CommandContext>
user ICommandUser

MarkDisconnected()

Notify this task that it's user disconnected.

public void MarkDisconnected()