public void Cancel()
 {
     if (Status == DoAfterStatus.Running)
     {
         Tcs.SetResult(DoAfterStatus.Cancelled);
     }
 }
        public void Run(float frameTime, IEntityManager entityManager)
        {
            switch (Status)
            {
                case DoAfterStatus.Running:
                    break;
                case DoAfterStatus.Cancelled:
                case DoAfterStatus.Finished:
                    return;
                default:
                    throw new ArgumentOutOfRangeException();
            }

            Elapsed += frameTime;

            if (IsFinished())
            {
                // Do the final checks here
                if (!TryPostCheck())
                {
                    Tcs.SetResult(DoAfterStatus.Cancelled);
                }
                else
                {
                    Tcs.SetResult(DoAfterStatus.Finished);
                }

                return;
            }

            if (IsCancelled(entityManager))
            {
                Tcs.SetResult(DoAfterStatus.Cancelled);
            }
        }
        public void Run(float frameTime)
        {
            switch (Status)
            {
            case DoAfterStatus.Running:
                break;

            case DoAfterStatus.Cancelled:
            case DoAfterStatus.Finished:
                return;

            default:
                throw new ArgumentOutOfRangeException();
            }

            Elapsed += frameTime;

            if (IsFinished())
            {
                Tcs.SetResult(DoAfterStatus.Finished);
                return;
            }

            if (IsCancelled())
            {
                Tcs.SetResult(DoAfterStatus.Cancelled);
            }
        }
Exemple #4
0
 public void OnNext(int value)
 {
     Sum += value;
     //if(value % 1000 == 0) Console.WriteLine(value);
     if (value == _count)
     {
         Tcs.SetResult(Sum);
     }
 }
Exemple #5
0
            new public void onSuccess(object result)
            {
                Debug.Log("Callback onSuccess");

                List <T> outList = new List <T>();
                int      size    = ((AndroidJavaObject)result).Call <int>("size");

                System.Type type = wrapper.GetType();
                for (int i = 0; i < size; i++)
                {
                    T instance = (T)System.Activator.CreateInstance(type);
                    ((IKilnObjectWrapper)instance).JavaInst = ((AndroidJavaObject)result).Call <AndroidJavaObject>("get", i);
                    outList.Add(instance);
                }

                Tcs.SetResult(outList);
            }