public void BeginCompare(AssetUpdateMgr parent, CompareBundleVersionCallBack callBack) { mParent = parent; mFinishCallBack = callBack; mABFileMgr = ABFileMgr.Instance; mFValue = 0f; UpdateLoadCompressProgress(0f); DownloadManifest(); }
private void DoCompare() { updateABConfigs.Clear(); Dictionary <string, AssetBundleConfig> tmpDict = new Dictionary <string, AssetBundleConfig>(); ABFileMgr mABFileMgr = ABFileMgr.Instance; if (null != remoteConfigs) { int totalSize = remoteConfigs.Count; for (int i = 0; i < totalSize; i++) { dispatcher.AddAction(() => { progressCallback(i * 1.0f / totalSize); }); AssetBundleConfig localCfg = null; AssetBundleConfig streamCfg = null; bool isNew = false; if (localConfigDict.TryGetValue(remoteConfigs[i].ABName, out localCfg)) { if (localCfg.MD5Value.Equals(remoteConfigs[i].MD5Value)) { isNew = false; } else { isNew = true; } } else { if (streamConfigDict.TryGetValue(remoteConfigs[i].ABName, out streamCfg)) { if (streamCfg.MD5Value.Equals(remoteConfigs[i].MD5Value)) { isNew = false; if (!tmpDict.ContainsKey(remoteConfigs[i].RelativePath)) { mABFileMgr.SetABFileState(remoteConfigs[i].RelativePath, ABFileState.STREAMEXIT); } } else { isNew = true; } } else { isNew = true; } } if (isNew) { if (!tmpDict.ContainsKey(remoteConfigs[i].RelativePath)) { string relativePath = remoteConfigs[i].RelativePath; string[] dp = dps[relativePath]; for (int j = 0; j < dp.Length; j++) { if (!tmpDict.ContainsKey("/" + dp[j])) { AssetBundleConfig reTmpCfg = null; if (remoteConfigDict.TryGetValue("/" + dp[j], out reTmpCfg)) { AssetBundleConfig tmpCfg = null; if (localConfigDict.TryGetValue(reTmpCfg.ABName, out tmpCfg)) { if (!tmpCfg.MD5Value.Equals(reTmpCfg.MD5Value)) { mABFileMgr.SetABFileState(reTmpCfg.RelativePath, ABFileState.NONE); updateABConfigs.Add(reTmpCfg); tmpDict[reTmpCfg.RelativePath] = reTmpCfg; } } else { if (streamConfigDict.TryGetValue(reTmpCfg.ABName, out tmpCfg)) { if (tmpCfg.MD5Value.Equals(reTmpCfg.MD5Value)) { reTmpCfg.Build = remoteConfigs[i].Build; } } else { reTmpCfg.Build = remoteConfigs[i].Build; } mABFileMgr.SetABFileState(reTmpCfg.RelativePath, ABFileState.NONE); updateABConfigs.Add(reTmpCfg); tmpDict[reTmpCfg.RelativePath] = reTmpCfg; } } } else { AssetBundleConfig reTmpCfg = tmpDict["/" + dp[j]]; if (reTmpCfg.Build > remoteConfigs[i].Build) { reTmpCfg.Build = remoteConfigs[i].Build; } } } updateABConfigs.Add(remoteConfigs[i]); tmpDict[remoteConfigs[i].RelativePath] = remoteConfigs[i]; } else { AssetBundleConfig reTmpCfg = tmpDict[remoteConfigs[i].RelativePath]; if (reTmpCfg.Build > remoteConfigs[i].Build) { reTmpCfg.Build = remoteConfigs[i].Build; } } } } } dispatcher.AddAction(finishCallback); }