Beispiel #1
0
        public void OnAssetBundleLoadFinished(string name, BundleCache bundle)
        {
            //failed
            if (bundle == null)
            {
                m_status = AssetLoadStatus.Finished;
                if (finishedCallback != null)
                {
                    finishedCallback(name, null);
                }
                return;
            }
            //self
            if (name.Equals(this.name))
            {
                if (self != null)
                {
                    self.ReduceRef();
                }

                self = bundle;
                self.AddRef();
            }
            //no depend ab
            if (!info.HasDependBundle())
            {
                m_status = AssetLoadStatus.Finished;
                if (finishedCallback != null)
                {
                    finishedCallback(this.name, self);
                }
                return;
            }
            m_status = AssetLoadStatus.Loading;
            if (name.Equals(this.name))
            {
                return;
            }
            //depend
            if (!info.IsDependBundle(name))
            {
                LogUtils.LogWarning("IsDependBundle() == false");
                return;
            }
            if (!m_refBundle.Contains(bundle))
            {
                m_refBundle.Add(bundle);
                bundle.AddRef();
            }
            m_unRefDependName.Remove(name);
            //load sucess
            if (info.GetDependBundleCount() == m_refBundle.Count && self != null)
            {
                for (int i = 0; i < m_refBundle.Count; ++i)
                {
                    self.AddDependBundle(m_refBundle[i]);
                }

                m_status = AssetLoadStatus.Finished;
                if (finishedCallback != null)
                {
                    finishedCallback(this.name, self);
                }

                _CleanRef();
            }
        }
 public void Init()
 {
     LogUtils.Log("LoopUpdateMgr.Init()");
 }