C# Class UnityTools.Threading.UnityTask

A helper class inspired by the .NET 4.0 Task object and javascript flow libraries such as Q
Afficher le fichier Open project: NoxHarmonium/unity-tools Class Usage Examples

Protected Properties

Свойство Type Description
_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

Méthodes publiques

Méthode Description
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().

Private Methods

Méthode Description
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

Method Details

All() public static méthode

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
Résultat UnityTask

AllSequential() public static méthode

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
Résultat UnityTask

Notify() public méthode

Fire all the progress callbacks with the current progress
public Notify ( float progress ) : void
progress float A floating point value representing the current progress
Résultat void

Reject() public méthode

Finish the task with an error state
public Reject ( Exception error ) : UnityTask
error System.Exception Error details.
Résultat UnityTask

Resolve() public méthode

Finish the task with a result
public Resolve ( object value = null ) : UnityTask
value object The result of the task.
Résultat UnityTask

Then() public méthode

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
Résultat UnityTask

UnityTask() public méthode

Initializes a new instance of the UnityTask`1 class.
public UnityTask ( IDispatcher dispatcher = null ) : System
dispatcher IDispatcher
Résultat System

UnityTask() public méthode

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
Résultat System

Property Details

_dispatcher protected_oe property

protected IDispatcher _dispatcher
Résultat IDispatcher

_endCallbacks protected_oe property

protected List _endCallbacks
Résultat List

_exception protected_oe property

protected Exception,System _exception
Résultat System.Exception

_failureCallbacks protected_oe property

protected List> _failureCallbacks
Résultat List>

_finished protected_oe property

protected bool _finished
Résultat bool

_progressCallbacks protected_oe property

protected List> _progressCallbacks
Résultat List>

_result protected_oe property

protected object _result
Résultat object

_succeeded protected_oe property

protected bool _succeeded
Résultat bool

_successCallbacks protected_oe property

protected List> _successCallbacks
Résultat List>

_thread protected_oe property

protected Thread _thread
Résultat Thread

_waitHandle protected_oe property

protected EventWaitHandle,System.Threading _waitHandle
Résultat System.Threading.EventWaitHandle