コード例 #1
0
        public CompletableHandle <T> RegisterCompletable <T>(ICompletable <T> completable)
        {
            var handle = new CompletableHandle <T>(completable);

            PendingCompletables.Add(handle);
            return(handle);
        }
コード例 #2
0
        private bool DoSafeStep(CompletableHandle x)
        {
#if UNITY_EDITOR
            UnityEngine.Profiling.Profiler.BeginSample("stepping " + x.TaskDescription);
#endif
            try
            {
                var stepChanged = x.TryStep();

                var error = x.GetError();
                if (error != null)
                {
                    Debug.LogWarning("completable error: " + error);
                    return(false);
                }

                return(stepChanged);
            }
            catch (System.Exception e1)
            {
                Debug.LogException(e1);
                try
                {
                    x.Cancel();
                }
                catch (System.Exception e2)
                {
                    Debug.LogException(e2);
                }
                return(false);
            }
#if UNITY_EDITOR
            finally
            {
                UnityEngine.Profiling.Profiler.EndSample();
            }
#endif
        }