private void OnShaderManagerComplate(ShaderLoadResult result, string error) { if (result == ShaderLoadResult.Ok) { ResourceManager.Instance.addResources(urls, null, true, OnComplate, OnError); } else { UnityEngine.Debug.LogError("ShaderLoadResult = " + result.ToString() + " info = " + error); } }
void OnAssetBundle(ShaderLoadResult result, string error) { Debug.Assert(result == ShaderLoadResult.BundleDownloadError); Debug.Assert(!string.IsNullOrEmpty(error)); IntegrationTest.Pass(); }
IEnumerator AssetBundleTask() { Byte[] bytes = null; string err = ""; IDownloader downloader = DownloaderFactory.Instance.Downloader; yield return(downloader.ResourceTask(coreDataBundle, (bs, e) => { bytes = bs; err = e; })); if (!string.IsNullOrEmpty(err)) { actOnComplate(ShaderLoadResult.BundleDownloadError, err); yield break; } yield return(null); ShaderLoadResult error = ShaderLoadResult.Ok; string info = ""; /*AssetBundleCreateRequest abcq = AssetBundle.LoadFromMemoryAsync (bytes); * while (!abcq.isDone) { * yield return abcq; * } * ab = abcq.assetBundle;*/ ab = AssetBundle.LoadFromMemory(bytes); if (ab != null) { /*AssetBundleRequest abr = ab.LoadAssetAsync (shaderDictPath); * while (!abr.isDone) { * yield return abr; * } * UnityEngine.Object asset = abr.asset;*/ UnityEngine.Object asset = ab.LoadAsset(shaderDictPath); if (asset != null && asset is TextAsset) { TextAsset textAsset = asset as TextAsset; JsonData data = null; try { data = JsonMapper.ToObject(textAsset.text); } catch (Exception e) { error = ShaderLoadResult.DictionaryJsonError; info = e.Message + " in " + textAsset.text; } if (data != null && !BuildDictName2Path(data)) { error = ShaderLoadResult.ContentCheckError; info = textAsset.text; } } else { error = ShaderLoadResult.DictionaryLoadError; info = shaderDictPath; } } else { error = ShaderLoadResult.BundleLoadError; info = coreDataBundle; } actOnComplate(error, info); }