C# Class KEngine.KAsync

链式操作,结合协程和DOTween, 并且支持真线程(用于密集运算,无法调用Unity大部分函数) 适合做动画、结合协程、回调一堆的情况
Datei anzeigen Open project: mr-kelly/KEngine Class Usage Examples

Public Methods

Method Description
AddMainThreadCall ( System.Action call ) : void

在子线程执行一个函数,让其回到主线程再执行的

Coroutine ( Coroutine co ) : KAsync

等待一个已经被其它MonoBehaviour开启的协程

Coroutine ( IEnumerator enumtor ) : KAsync

开启并等待一个协程

Start ( ) : KAsync
Start ( System.Action callback ) : KAsync
Start ( AsyncThenDelegateEasy callback ) : KAsync
Then ( System.Action callback ) : KAsync
Then ( AsyncThenDelegate thenFunc ) : KAsync
Then ( AsyncThenDelegateEasy thenFunc ) : KAsync
Thread ( System.Action threadCalAction ) : KAsync
Thread ( AsyncThreadDelegate threadCalAction ) : KAsync

线程。注意大部分Unity函数不能使用! 借用协程配合~

Thread ( AsyncThreadDelegateFull threadCalAction, object param ) : KAsync
Until ( Func retBool, float timeout = 20 ) : KAsync
WaitFinish ( ) : Coroutine
WaitForEndOfFrame ( ) : KAsync

等到本帧结束

WaitForFrames ( int frameCount ) : KAsync

等待一定帧数

WaitForSeconds ( float time ) : KAsync

等待秒数

When ( Func retBool, float timeout = 20 ) : KAsync

等待条件成立

_Thread ( AsyncThreadDelegateFull threadCalAction, object param = null ) : IEnumerator

Private Methods

Method Description
EmWaitFinish ( ) : IEnumerator
KAsync ( ) : System
Next ( ) : void
WaitNext ( AsyncWaitNextDelegate callback ) : void
_CoWaitForSeconds ( float time, System.Action next ) : IEnumerator
_CoWhen ( Func retBool, float timeout, System.Action next ) : IEnumerator
_Coroutine ( Coroutine co, System.Action next ) : IEnumerator
_StartCoroutine ( IEnumerator enumtor, System.Action next ) : IEnumerator
_WaitForEndOfFrame ( System.Action next ) : IEnumerator
_WaitForFrames ( int frameCount, System.Action next ) : IEnumerator

Method Details

AddMainThreadCall() public static method

在子线程执行一个函数,让其回到主线程再执行的
public static AddMainThreadCall ( System.Action call ) : void
call System.Action
return void

Coroutine() public method

等待一个已经被其它MonoBehaviour开启的协程
public Coroutine ( Coroutine co ) : KAsync
co UnityEngine.Coroutine
return KAsync

Coroutine() public method

开启并等待一个协程
public Coroutine ( IEnumerator enumtor ) : KAsync
enumtor IEnumerator
return KAsync

Start() public static method

public static Start ( ) : KAsync
return KAsync

Start() public static method

public static Start ( System.Action callback ) : KAsync
callback System.Action
return KAsync

Start() public static method

public static Start ( AsyncThenDelegateEasy callback ) : KAsync
callback AsyncThenDelegateEasy
return KAsync

Then() public method

public Then ( System.Action callback ) : KAsync
callback System.Action
return KAsync

Then() public method

public Then ( AsyncThenDelegate thenFunc ) : KAsync
thenFunc AsyncThenDelegate
return KAsync

Then() public method

public Then ( AsyncThenDelegateEasy thenFunc ) : KAsync
thenFunc AsyncThenDelegateEasy
return KAsync

Thread() public method

public Thread ( System.Action threadCalAction ) : KAsync
threadCalAction System.Action
return KAsync

Thread() public method

线程。注意大部分Unity函数不能使用! 借用协程配合~
public Thread ( AsyncThreadDelegate threadCalAction ) : KAsync
threadCalAction AsyncThreadDelegate
return KAsync

Thread() public method

public Thread ( AsyncThreadDelegateFull threadCalAction, object param ) : KAsync
threadCalAction AsyncThreadDelegateFull
param object
return KAsync

Until() public method

public Until ( Func retBool, float timeout = 20 ) : KAsync
retBool Func
timeout float
return KAsync

WaitFinish() public method

public WaitFinish ( ) : Coroutine
return UnityEngine.Coroutine

WaitForEndOfFrame() public method

等到本帧结束
public WaitForEndOfFrame ( ) : KAsync
return KAsync

WaitForFrames() public method

等待一定帧数
public WaitForFrames ( int frameCount ) : KAsync
frameCount int
return KAsync

WaitForSeconds() public method

等待秒数
public WaitForSeconds ( float time ) : KAsync
time float
return KAsync

When() public method

等待条件成立
public When ( Func retBool, float timeout = 20 ) : KAsync
retBool Func
timeout float
return KAsync

_Thread() public method

public _Thread ( AsyncThreadDelegateFull threadCalAction, object param = null ) : IEnumerator
threadCalAction AsyncThreadDelegateFull
param object
return IEnumerator