public void Dump() { StringBuilder sb = new StringBuilder(); sb.AppendFormat("Dump Bundle Cache. Count = {0}\n", m_caches.Count); var iter = m_caches.GetEnumerator(); while (iter.MoveNext()) { AssetBundleInfo item = iter.Current.Value; sb.AppendFormat("{0} count:{1} persistent:{2}\n", iter.Current.Key, item.ReferencedCount, item.Persistent); } iter.Dispose(); Logger.Log(sb.ToString()); }
/*private void InitVersionData(bool start = true) * { * Clear(); * * m_origns.Clear(); * for (int i = 0; i < VersionData.Inst.Items.Length; ++i) * { * VersionData.VersionItem item = VersionData.Inst.Items[i]; * m_origns.Add(item.Name, item.Md5); * } * * if (start) * { * LoadManifest(); * } * }*/ /*public void SetPatchData(JSONClass list, bool clear = false) * { * if (clear) * { * Clear(); * } * * m_patchs.Clear(); * if (list != null) * { * foreach (KeyValuePair<string, JSONNode> item in list) * { * m_patchs.Add(item.Key, item.Value["md5"]); * } * } * * LoadManifest(); * }*/ /*private void LoadVersion() * { * Logger.Log("LoadVersion"); * if (ConstantData.EnableMd5Name) * { * string pathPatch = string.Format("{0}/version_patch", Application.persistentDataPath); * bool hasPatch = false; * * if (ConstantData.EnablePatch) * { * hasPatch = File.Exists(pathPatch); * } * * InitVersionData(!hasPatch); * * if (hasPatch) * { * LoadStream(pathPatch, (data) => * { * byte[] bytes = data as byte[]; * if (bytes == null) * { * Logger.LogError("Load patch version Failed!"); * return; * } * * string text = Encoding.UTF8.GetString(bytes); * JSONClass json = JSONNode.Parse(text) as JSONClass; * if (json == null) * { * Logger.LogError("Load patch version Failed!"); * return; * } * * JSONClass jsonList = null; * if (string.Equals(json["version"], LogicConstantData.Version)) * { * jsonList = json["list"] as JSONClass; * } * * m_urlPatch = json["url"]; * SetPatchData(jsonList); * }, false, false, true); * } * } * else * { * LoadManifest(); * } * }*/ // 加载资源清单 private void LoadManifest() { Logger.Log("LoadManifest"); if (m_manifest != null) { Object.DestroyImmediate(m_manifest, true); m_manifest = null; } if (m_mapping != null) { Object.DestroyImmediate(m_mapping, true); m_mapping = null; } // 加载AssetBundle依赖文件 LoadAssetBundle(null, ConstantData.AssetbundleManifest, (group, data) => { AssetBundleInfo ab = data as AssetBundleInfo; if (ab != null) { m_manifest = ab.LoadAsset <AssetBundleManifest>("AssetBundleManifest"); } }, false, false, false); // 加载资源到AssetBundle映射表 string name = ConstantData.AssetbundleMapping; LoadAssetFromBundle(null, name, name, typeof(AssetBundleMapping), (group, data) => { m_mapping = data as AssetBundleMapping; if (m_mapping != null) { m_mapping.Init(); } }, false); Logger.Log("LoadManifest End"); }