Пример #1
0
        internal void _HandleException(CoroutineException e)
        {
            if (_pCurrentInstruction != null)
            {
                _pCurrentInstruction.Stop();
                _pCurrentInstruction.DecRef();
                _pCurrentInstruction = null;
            }

            _pCoroutineFunc = null;
            _state          = CoroutineState.Stopped;

            if (_onException != null)
            {
                _onException(this, e);
            }
            else
            {
                if (_Parent != null)
                {
                    /// 'Throw up' to parent
                    _Parent._HandleException(e);
                }
                else
                {
                    CoroutineMgr._ThrowException(e);
                }
            }

            if (_onStopped != null)
            {
                _onStopped(this);
                _Parent = null;
            }
        }
Пример #2
0
 static public void Init()
 {
     if (_Instance == null)
     {
         _Instance = new CoroutineMgr();
         _Instance._init();
     }
     else
     {
         Debugger.LogWarning("CoroutineMgr.Init() be called more than once!!!");
     }
 }
Пример #3
0
 protected CoroutineMgr()
 {
     Debugger.Assert(_Instance == null, "Only one instance can be created for CoroutineMgr!!!");
     _Instance        = this;
     _CoEnterLogStack = new Stack <Coroutine>();
 }
Пример #4
0
 public Coroutine(CoroutineMgr pCoroutineMgr, IEnumerator pCoroutineFunc = null)
 {
     _pCoroutineMgr = pCoroutineMgr;
     _state         = CoroutineState.Stopped;
     _AutoKill      = true;
 }