public static IEnumerator ResourceRequest( UnityAwaiter <UnityEngine.Object> awaiter, ResourceRequest instruction) { yield return(instruction); awaiter.Complete(instruction.asset, null); }
public static IEnumerator ReturnSelf <T>( UnityAwaiter <T> awaiter, T instruction) { yield return(instruction); awaiter.Complete(instruction, null); }
protected virtual void Awake() { updateQueues = new List <ContinuationQueue> { new ContinuationQueue <FrameContinuation>(128), new ContinuationQueue <TimeContinuation>(64), new ContinuationQueue <UnscaledTimeContinuation>(32), new ContinuationQueue <ConditionContinuation>(32), new ContinuationQueue <CustomContinuation>(16), new ContinuationQueue <AsyncOpContinuation>(16) }; lateUpdateQueues = new List <ContinuationQueue> { new ContinuationQueue <FrameContinuation>(32) }; fixedUpdateQueues = new List <ContinuationQueue> { new ContinuationQueue <FixedContinuation>(32) }; updateAwaiter = new UnityAwaiter <FrameContinuation>(updateQueues[0]); lateUpdateAwaiter = new UnityAwaiter <FrameContinuation>(lateUpdateQueues[0]); fixedUpdateAwaiter = new UnityAwaiter <FixedContinuation>(fixedUpdateQueues[0]); timeAwaiter = new UnityAwaiter <TimeContinuation>(updateQueues[1]); unscaledTimeAwaiter = new UnityAwaiter <UnscaledTimeContinuation>(updateQueues[2]); conditionAwaiter = new UnityAwaiter <ConditionContinuation>(updateQueues[3]); customAwaiter = new UnityAwaiter <CustomContinuation>(updateQueues[4]); asyncOpAwaiter = new UnityAwaiter <AsyncOpContinuation>(updateQueues[5]); }
public static IEnumerator AssetBundleCreateRequest( UnityAwaiter <AssetBundle> awaiter, AssetBundleCreateRequest instruction) { yield return(instruction); awaiter.Complete(instruction.assetBundle, null); }
public CoroutineWrapper( IEnumerator coroutine, UnityAwaiter <T> awaiter) { _processStack = new Stack <IEnumerator>(); _processStack.Push(coroutine); _awaiter = awaiter; }
public static IEnumerator ReturnVoid( UnityAwaiter awaiter, object instruction) { // 暂且认定不会抛异常 yield return(instruction); awaiter.Complete(null); }
static UnityAwaiter <T> GetAwaiterReturnSelf <T>(T instruction) { var awaiter = new UnityAwaiter <T>(); RunOnUnityScheduler(() => AsyncCoroutineRunner.Instance.StartCoroutine( InstructionWrappers.ReturnSelf(awaiter, instruction))); return(awaiter); }
public static UnityAwaiter <object> GetAwaiter(this IEnumerator coroutine) { var awaiter = new UnityAwaiter <object>(); RunOnUnityScheduler(() => AsyncCoroutineRunner.Instance.StartCoroutine( new CoroutineWrapper <object>(coroutine, awaiter).Run())); return(awaiter); }
public static UnityAwaiter <UnityEngine.Object> GetAwaiter(this AssetBundleRequest instruction) { var awaiter = new UnityAwaiter <UnityEngine.Object>(); RunOnUnityScheduler(() => AsyncCoroutineRunner.Instance.StartCoroutine( InstructionWrappers.AssetBundleRequest(awaiter, instruction))); return(awaiter); }
public static UnityAwaiter <T> GetAwaiter <T>(this WaitForFunc <T> waitForFunc) { var awaiter = new UnityAwaiter <T>(); if (waitForFunc.GetFunc() != null) { RunOnUnityScheduler(() => AsyncCoroutineRunner.Instance.StartCoroutine(InstructionWrappers.FuncGetReturn <T>(awaiter, waitForFunc.GetFunc()))); } return(awaiter); }
public static UnityAwaiter GetAwaiter <T>(this WaitForAction <T> waitForAction) { var awaiter = new UnityAwaiter(); if (waitForAction.GetAction() != null) { RunOnUnityScheduler(waitForAction.GetAction(), waitForAction.GetData()); } awaiter.Complete(null); return(awaiter); }
public static IEnumerator FuncGetReturn <T>(UnityAwaiter <T> awaiter, Func <T> func) { yield return(null); awaiter.Complete(func(), null); }