IEnumerator Start() { this.executor = new CoroutineExecutor(); IAsyncResult r1 = this.executor.RunOnCoroutine(Task1()); yield return(r1.WaitForDone()); IAsyncResult r2 = this.executor.RunOnCoroutine(promise => Task2(promise)); yield return(r2.WaitForDone()); IAsyncResult <string> r3 = this.executor.RunOnCoroutine <string> (promise => Task3(promise)); yield return(new WaitForSeconds(0.5f)); r3.Cancel(); yield return(r3.WaitForDone()); Debug.LogFormat("Task3 IsCalcelled:{0}", r3.IsCancelled); IProgressResult <float, string> r4 = this.executor.RunOnCoroutine <float, string> (promise => Task4(promise)); while (!r4.IsDone) { yield return(null); Debug.LogFormat("Task4 Progress:{0}%", Mathf.FloorToInt(r4.Progress * 100)); } Debug.LogFormat("Task4 Result:{0}", r4.Result); }
/// <summary> /// Creates a new instance of the client. /// </summary> /// <remarks> /// The server config is loaded from a text file just containing the target. /// This enables changing the server on device without recompiling the Unity app. /// </remarks> /// <param name="serverConfigPath">The server that is used.</param> public Client(ICoroutineExecutor parent, string serverConfigPath = null) { _parent = parent; // using either supplied path or a default path depending on the runtime context. var path = serverConfigPath ?? #if UNITY_EDITOR Application.dataPath + "/Resources/OpenAPEServer.txt"; #else Application.persistentDataPath + "/OpenAPEServer.txt"; #endif // Replacing new line character if we accidently read one. BaseUrl = Regex.Replace(BaseUrl, @"\t|\n|\r", String.Empty); }
public AssetBundleDataProvider(string assetBundleUrl, IDocumentParser parser) { if (string.IsNullOrEmpty(assetBundleUrl)) { throw new ArgumentNullException("assetBundleUrl"); } if (parser == null) { throw new ArgumentNullException("parser"); } this.assetBundleUrl = assetBundleUrl; this.parser = parser; this.executor = new CoroutineExecutor(); }
public CommandProcessor(ICoroutineExecutor coroutineExecutor) { this.m_ce = coroutineExecutor; }