C# Класс UnityTools.Threading.UnityTask

A helper class inspired by the .NET 4.0 Task object and javascript flow libraries such as Q
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
_dispatcher IDispatcher
_endCallbacks List
_exception System.Exception
_failureCallbacks List>
_finished bool
_progressCallbacks List>
_result object
_succeeded bool
_successCallbacks List>
_thread Thread
_waitHandle System.Threading.EventWaitHandle

Открытые методы

Метод Описание
All ( ) : UnityTask

Combines multiple tasks of the same type into one callback and runs them simultaneously. On failure the failure callback is called immediately and the result of the other tasks is discarded.

AllSequential ( ) : UnityTask

Combines multiple tasks of the same type into one callback and runs them sequentially. On failure the failure callback is called immediately and the result of the other tasks is discarded.

Notify ( float progress ) : void

Fire all the progress callbacks with the current progress

Reject ( Exception error ) : UnityTask

Finish the task with an error state

Resolve ( object value = null ) : UnityTask

Finish the task with a result

Then ( Action onFulfilled = null, Action onFailure = null, Action onProgress = null, System.Action onEnd = null ) : UnityTask

Add callbacks that will fire on certain task states. If the task has already completed or failed, the related callbacks will fire immediately. Returns the this task so that calls can be chained together.

UnityTask ( IDispatcher dispatcher = null ) : System

Initializes a new instance of the UnityTask`1 class.

UnityTask ( UnityTaskAutoThreadDelegate taskAction, IDispatcher dispatcher = null ) : System

Initializes a new instance of the UnityTask`1 class which wraps an action, automatically running it on a new thread. All uncaught exceptions thrown in the spawned thread will automatically trigger Task.Reject().

Приватные методы

Метод Описание
All ( IDispatcher dispatcher ) : UnityTask

Combines multiple tasks of the same type into one callback and runs them simultaneously. On failure the failure callback is called immediately and the result of the other tasks is discarded.

AllSequential ( IDispatcher dispatcher ) : UnityTask

Combines multiple tasks of the same type into one callback and runs them sequentially. On failure the failure callback is called immediately and the result of the other tasks is discarded.

FireEndCallbacks ( ) : void

Called internally to trigger all the onEnd callbacks

Описание методов

All() публичный статический Метод

Combines multiple tasks of the same type into one callback and runs them simultaneously. On failure the failure callback is called immediately and the result of the other tasks is discarded.
public static All ( ) : UnityTask
Результат UnityTask

AllSequential() публичный статический Метод

Combines multiple tasks of the same type into one callback and runs them sequentially. On failure the failure callback is called immediately and the result of the other tasks is discarded.
public static AllSequential ( ) : UnityTask
Результат UnityTask

Notify() публичный Метод

Fire all the progress callbacks with the current progress
public Notify ( float progress ) : void
progress float A floating point value representing the current progress
Результат void

Reject() публичный Метод

Finish the task with an error state
public Reject ( Exception error ) : UnityTask
error System.Exception Error details.
Результат UnityTask

Resolve() публичный Метод

Finish the task with a result
public Resolve ( object value = null ) : UnityTask
value object The result of the task.
Результат UnityTask

Then() публичный Метод

Add callbacks that will fire on certain task states. If the task has already completed or failed, the related callbacks will fire immediately. Returns the this task so that calls can be chained together.
public Then ( Action onFulfilled = null, Action onFailure = null, Action onProgress = null, System.Action onEnd = null ) : UnityTask
onFulfilled Action Callback that fires when the task succeeds
onFailure Action Callback that fires when the task fails
onProgress Action Callback that fires when the progress of the task changes
onEnd System.Action Callback that fires when the task succeeds or fails
Результат UnityTask

UnityTask() публичный Метод

Initializes a new instance of the UnityTask`1 class.
public UnityTask ( IDispatcher dispatcher = null ) : System
dispatcher IDispatcher
Результат System

UnityTask() публичный Метод

Initializes a new instance of the UnityTask`1 class which wraps an action, automatically running it on a new thread. All uncaught exceptions thrown in the spawned thread will automatically trigger Task.Reject().
public UnityTask ( UnityTaskAutoThreadDelegate taskAction, IDispatcher dispatcher = null ) : System
taskAction UnityTaskAutoThreadDelegate The delegate that will be executed on a seperate thread.
dispatcher IDispatcher
Результат System

Описание свойств

_dispatcher защищенное свойство

protected IDispatcher _dispatcher
Результат IDispatcher

_endCallbacks защищенное свойство

protected List _endCallbacks
Результат List

_exception защищенное свойство

protected Exception,System _exception
Результат System.Exception

_failureCallbacks защищенное свойство

protected List> _failureCallbacks
Результат List>

_finished защищенное свойство

protected bool _finished
Результат bool

_progressCallbacks защищенное свойство

protected List> _progressCallbacks
Результат List>

_result защищенное свойство

protected object _result
Результат object

_succeeded защищенное свойство

protected bool _succeeded
Результат bool

_successCallbacks защищенное свойство

protected List> _successCallbacks
Результат List>

_thread защищенное свойство

protected Thread _thread
Результат Thread

_waitHandle защищенное свойство

protected EventWaitHandle,System.Threading _waitHandle
Результат System.Threading.EventWaitHandle