//加载包清单文件 public IEnumerator LoadingGameAssetBundleInventoryPackageFile() { WWW www; if (UniGameResources.IsLocalDownloadUrlPath) { www = WWW.LoadFromCacheOrDownload(FTLibrary.Text.IStringPath.ConnectPath(UniGameResources.downloadUrlPath, UniGameResourcesDefine.GameAssetBundleInventoryPackageFilePath), UniGameResources.version_GameAssetBundleInventoryPackageFile); } else { www = new WWW(FTLibrary.Text.IStringPath.ConnectPath(UniGameResources.downloadUrlPath, UniGameResourcesDefine.GameAssetBundleInventoryPackageFilePath)); } yield return(www); if (www.error != null) { GameRoot.Error(string.Format("资源引导文件下载错误:{0}", www.error)); yield break; } byte[] data = null; try { #if UNITY_4_3 || UNITY_4_6 TextAsset textAsset = www.assetBundle.Load(UniGameResourcesDefine.GameAssetBundleInventoryXmlFilePath, typeof(TextAsset)) as TextAsset; #else TextAsset textAsset = www.assetBundle.LoadAsset(UniGameResourcesDefine.GameAssetBundleInventoryXmlFilePath, typeof(TextAsset)) as TextAsset; #endif data = textAsset.bytes; UniGameResources.ReleaseOneAssets(textAsset); www.assetBundle.Unload(false); //当获取一次资源对象的时候实际是克隆一个对象 //UnityEngine.Object.DestroyObject(www.assetBundle); www.Dispose(); } catch (System.Exception ex) { GameRoot.Error(string.Format("资源引导文件读取错误:{0}", ex.ToString())); yield break; } FTEncipher encipher = null; try { //首先从BASE64转换回来 data = Convert.FromBase64String(Encoding.ASCII.GetString(data)); //构建解密组件 encipher = UniGameResources.AllocXmlFileEncipher(); #if _SupportDeviceVerify data = encipher.FileDecrypt(data, true); #else data = encipher.FileDecrypt(data); #endif //_SupportDeviceVerify encipher.Dispose(); encipher = null; MemoryStream s = new MemoryStream(data); XmlDocument doc = new XmlDocument(); doc.Load(s); s.Close(); UniGameResources.BuildSystemResourcesPackageTable(doc); } catch (System.Exception ex) { GameRoot.Error(string.Format("资源引导文件解析错误:{0}", ex.ToString())); if (encipher != null) { encipher.Dispose(); encipher = null; } yield break; } }