public bool UpdateState() { bool handle = false; if (m_status == AssetLoadStatus.Loaded) { m_status = AssetLoadStatus.Finished; if (m_refBundle == null) { OnAssetLoaded(null); return(handle); } UnityEngine.Object obj = m_refBundle.LoadAsset(AssetCache.AssetNameToBundleAssetName(info.name, info.extName)); if (obj == null) { OnAssetLoaded(null); return(handle); } handle = true; AssetCache cache = new AssetCache(name, info, obj); AssetsMgr.GetInst().AddAssetCache(name, cache); OnAssetLoaded(cache); } return(handle); }
public bool DownLoad() { bool b = VersionUpdate.GetIns().UpdateOneRes(name, DownloadResult); if (b == true) { m_status = AssetLoadStatus.Downloading; } return(b); }
public void OnAssetLoaded(AssetCache asset) { m_status = AssetLoadStatus.Finished; if (asset != null) { asset.Access(); } if (finishedCallback != null) { finishedCallback(name, asset); } }
public void OnAssetBundleLoaded(string bundleName, BundleCache bundle) { LogUtils.Log("bundle loaded!:", bundleName); m_status = AssetLoadStatus.Loaded; if (bundle == null) { OnAssetLoaded(null); return; } if (m_refBundle != null) { m_refBundle.ReduceRef(); } m_refBundle = bundle; m_refBundle.AddRef(); }
public void SetLoading() { m_status = AssetLoadStatus.Loading; }
void DownloadResult(string name, bool isSucc) { m_status = AssetLoadStatus.Downloaded; }
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(); } }