Пример #1
0
    void Start()
    {
        c  = new CoroutinePromise(CoroutineA());
        ca = c.Then(CoroutineB());
        CoroutinePromise cb = ca.Then(CoroutineC());

        StartPromiseSet(c);

        CoroutinePromise c2 = new CoroutinePromise(CoroutineA2());

        c2.Then(CoroutineB2()).Then(CoroutineC2());
        StartPromiseSet(c2);
    }
Пример #2
0
 public IEnumerator SuperCoroutine()
 {
     while (currentPromise != null)
     {
         if (!(!currentPromise.IsDone && currentPromise.Coroutine.MoveNext()))
         {
             if (currentPromise.Promise != null)
             {
                 currentPromise = currentPromise.Promise;
             }
             else
             {
                 currentPromise = null;
             }
         }
         yield return(null);
     }
 }
Пример #3
0
 public CoroutinePromiseSet(CoroutinePromise c)
 {
     currentPromise = c;
 }
Пример #4
0
 public CoroutinePromise Resolve(IEnumerator newCoroutine)
 {
     promise = new CoroutinePromise(newCoroutine);
     isDone  = true;
     return(promise);
 }
Пример #5
0
 public CoroutinePromise Then(IEnumerator newCoroutine)
 {
     promise = new CoroutinePromise(newCoroutine);
     return(promise);
 }
Пример #6
0
    public void StartPromiseSet(CoroutinePromise c)
    {
        CoroutinePromiseSet cSet = new CoroutinePromiseSet(c);

        StartCoroutine(cSet.SuperCoroutine());
    }
 public void StartPromiseSet(CoroutinePromise c)
 {
     CoroutinePromiseSet cSet = new CoroutinePromiseSet(c);
     StartCoroutine(cSet.SuperCoroutine());
 }
 public IEnumerator SuperCoroutine()
 {
     while (currentPromise != null)
     {
         if (!(!currentPromise.IsDone && currentPromise.Coroutine.MoveNext())) {
             if (currentPromise.Promise != null)
                 currentPromise = currentPromise.Promise;
             else
                 currentPromise = null;
         }
         yield return null;
     }
 }
 public CoroutinePromiseSet(CoroutinePromise c)
 {
     currentPromise = c;
 }
 public CoroutinePromise Then(IEnumerator newCoroutine)
 {
     promise = new CoroutinePromise(newCoroutine);
     return promise;
 }
 public CoroutinePromise Resolve(IEnumerator newCoroutine)
 {
     promise = new CoroutinePromise(newCoroutine);
     isDone = true;
     return promise;
 }
    void Start()
    {
        c = new CoroutinePromise(CoroutineA());
        ca = c.Then(CoroutineB());
        CoroutinePromise cb = ca.Then(CoroutineC());
        StartPromiseSet(c);

        CoroutinePromise c2 = new CoroutinePromise(CoroutineA2());
        c2.Then(CoroutineB2()).Then(CoroutineC2());
        StartPromiseSet(c2);
    }