public void QueueWorkingItem(IEnumerator runner) { if (this.IsDisposed) { return; } this.mHost.Stop(); this.Enabled = false; this.Queue.AddLast(new Func <bool>(runner.MoveNext)); if (this.mStatus != CoroutineStatus.Status.RUNNING) { this.mStatus = CoroutineStatus.Status.RUNNING; this.mHost.QueueWorkingItem(this); } this.Enabled = true; if (this.mHost != null) { this.mHost.Start(); } }
public void Resume() { if (this.IsDisposed) { return; } this.mStatus = CoroutineStatus.Status.RUNNING; this.Enabled = true; }
public void Pause() { if (this.IsDisposed) { return; } this.mStatus = CoroutineStatus.Status.STOP; this.Enabled = false; }
public void Stop() { if (this.IsDisposed) { return; } this.mStatus = CoroutineStatus.Status.STOP; this.Enabled = false; this.Queue.Clear(); }
public void Start() { if (this.IsDisposed) { return; } this.mStatus = CoroutineStatus.Status.RUNNING; this.Enabled = true; if (this.mHost != null) { this.mHost.QueueWorkingItem(this); this.mHost.Start(); } }
internal IEnumerator TaskRunner() { while (this.Queue.Count > 0) { LinkedListNode <Func <bool> > node = this.Queue.First; while (node != null) { LinkedListNode <Func <bool> > next = node.Next; bool nodeCanContinue = true; try { nodeCanContinue = node.Value(); } catch (Exception ee) { nodeCanContinue = false; Tracer.D(ee.ToString()); } try { if (!nodeCanContinue) { this.Queue.Remove(node); } } catch (Exception) { } node = next; yield return(true); } } if (this.Queue.Count == 0) { this.mStatus = CoroutineStatus.Status.READY; } yield break; }
public void Dispose() { if (this.IsDisposed) { return; } this.IsDisposed = true; this.Enabled = false; try { this.mStatus = CoroutineStatus.Status.STOP; this.Queue.Clear(); } catch (Exception ee) { Tracer.D(ee.ToString()); } }