public override bool LoadSync() { if (!CheckLoadAble()) { return(false); } ResState = eResState.kLoading; //TimeDebugger timer = ResMgr.Instance.timeDebugger; string url = FrameworkConfigData.AssetBundleName2Url(mAssetName); //timer.Begin("LoadSync AssetBundle:" + mName); AssetBundle bundle = AssetBundle.LoadFromFile(url); //timer.End(); mUnloadFlag = true; if (bundle == null) { Log.e("Failed Load AssetBundle:" + mAssetName); OnResLoadFaild(); return(false); } assetBundle = bundle; ResState = eResState.kReady; //Log.i(string.Format("Load AssetBundle Success.ID:{0}, Name:{1}", bundle.GetInstanceID(), bundle.name)); //timer.Dump(-1); return(true); }
public override IEnumerator StartIEnumeratorTask(Action finishCallback) { //开启的时候已经结束了 if (RefCount <= 0) { OnResLoadFaild(); finishCallback(); yield break; } string url = FrameworkConfigData.AssetBundleName2Url(mAssetName); AssetBundleCreateRequest abcR = AssetBundle.LoadFromFileAsync(url); mAssetBundleCreateRequest = abcR; yield return(abcR); mAssetBundleCreateRequest = null; if (!abcR.isDone) { Log.e("AssetBundleCreateRequest Not Done! Path:" + mAssetName); OnResLoadFaild(); finishCallback(); yield break; } assetBundle = abcR.assetBundle; ResState = eResState.kReady; finishCallback(); }
public string[] GetAllDependenciesByUrl(string url) { string abName = FrameworkConfigData.AssetBundleUrl2Name(url); string[] depends = null; for (int i = m_ActiveAssetDataGroup.Count - 1; i >= 0; --i) { if (!m_ActiveAssetDataGroup[i].GetAssetBundleDepends(abName, out depends)) { continue; } return(depends); } return(null); }
public static FrameworkConfigData Load() { IOUtils.CreateDirIfNotExists(mConfigSavedDir); if (!File.Exists(mConfigSavedDir + mConfigSavedFileName)) { using (var fileStream = File.Create(mConfigSavedDir + mConfigSavedFileName)) { fileStream.Close(); } } var frameworkConfigData = SerializeHelper.LoadJson <FrameworkConfigData>(mConfigSavedDir + mConfigSavedFileName); if (frameworkConfigData == null || string.IsNullOrEmpty(frameworkConfigData.Namespace)) { frameworkConfigData = new FrameworkConfigData(); frameworkConfigData.Namespace = "Putao.ProjectName"; } return(frameworkConfigData); }
public static string[] GetAllDependenciesByUrl(string url) { return(mManifest.GetAllDependencies(FrameworkConfigData.AssetBundleUrl2Name(url))); }