public static void LoadAndVerions(BuildTarget buildTargetGroup, bool isUpdate = false, int version = 10000) { m_isUpdateShader = false; m_curVersion = version; if (isUpdate) { m_currentCache = ABAssetDataUtil.ReloadCache(buildTargetGroup); if (m_curVersion <= m_currentCache.firstVersion || m_curVersion <= m_currentCache.newVersion) { m_curVersion = m_currentCache.newVersion + 1; } for (int i = 0; i < m_currentCache.assetList.Count; i++) { if (!m_oldDic.ContainsKey(m_currentCache.assetList[i].filePath)) { m_oldDic.Add(m_currentCache.assetList[i].filePath, m_currentCache.assetList[i]); if (!m_abbuildDic.ContainsKey(m_currentCache.assetList[i].bundleId)) { ABBundleInfo buildInfo = new ABBundleInfo(); buildInfo.bundleId = m_currentCache.assetList[i].bundleId; buildInfo.firstVersion = m_currentCache.firstVersion; m_abbuildDic.Add(buildInfo.bundleId, buildInfo); } } } } else { m_currentCache = new ABAssetDataList(); m_currentCache.firstVersion = m_curVersion; } }
public static void SaveAssetCache(BuildTarget buildTarget, ABAssetDataList cache) { var data = LitJson.JsonMapper.ToJson(cache); var path = X2AssetsBundleEditor.PreOutPath(buildTarget); using (Stream file = File.Create(path + "/AssetDatas.json")) { var bytes = System.Text.Encoding.UTF8.GetBytes(data); file.Write(bytes, 0, bytes.Length); file.Close(); } }
public static ABAssetDataList ReloadCache(BuildTarget buildTarget) { string data = ""; var path = X2AssetsBundleEditor.PreOutPath(buildTarget); using (StreamReader file = File.OpenText(path + "/AssetDatas.json")) { data = file.ReadToEnd(); } ABAssetDataList cache = LitJson.JsonMapper.ToObject <ABAssetDataList>(data); return(cache); }