Esempio n. 1
0
        /// <summary>
        /// 异步加载
        /// </summary>
        public override void LoadAsync()
        {
            if (m_state == ResState.Ready)
            {
                Notification(true);
            }
            else if (m_state == ResState.Waiting || m_state == ResState.Failed)
            {
                m_state = ResState.Loading;

                // 先加载依赖
                if (FindDependencies())
                {
                    m_dependWaitCount = m_dependencies.Length;
                    for (int i = 0; i < m_dependWaitCount; i++)
                    {
                        m_dependencies[i].AddNotification(OnReceiveNotification);
                        m_dependencies[i].LoadAsync();
                    }
                }
                else
                {
                    RunAsyncSystem.PushEnumerator(this);
                }
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 接收通知处理依赖
 /// </summary>
 /// <param name="readly"></param>
 /// <param name="res"></param>
 private void OnReceiveNotification(bool ready, Res res)
 {
     m_dependWaitCount--;
     res.RemoveNotification(OnReceiveNotification);
     if (m_dependWaitCount <= 0)
     {
         // 依赖加载完毕
         RunAsyncSystem.PushEnumerator(this);
     }
 }
Esempio n. 3
0
 /// <summary>
 /// 异步加载
 /// </summary>
 public override void LoadAsync()
 {
     if (m_state == ResState.Ready)
     {
         Notification(true);
     }
     else if (m_state == ResState.Waiting || m_state == ResState.Failed)
     {
         m_state = ResState.Loading;
         RunAsyncSystem.PushEnumerator(this);
     }
 }