public void UpdateLoadProgress(UpdateEvent e, LoadingChannelNode loaderNode, [JoinBy(typeof(AssetGroupComponent))] LoadStatNode resource) { AssetBundleInfo key = loaderNode.assetBundleLoading.Info; ResourceLoadStatComponent resourceLoadStat = resource.resourceLoadStat; Dictionary <AssetBundleInfo, float> bundleToProgress = resourceLoadStat.BundleToProgress; if (!bundleToProgress.ContainsKey(key)) { resourceLoadStat.Progress = 1f; } else { float progress = loaderNode.assetBundleLoading.AssetBundleDiskCacheRequest.Progress; bundleToProgress[key] = progress; if (Mathf.Abs((float)(progress - bundleToProgress[key])) >= 0.001f) { float num3 = 0f; Dictionary <AssetBundleInfo, float> .Enumerator enumerator = bundleToProgress.GetEnumerator(); while (enumerator.MoveNext()) { KeyValuePair <AssetBundleInfo, float> current = enumerator.Current; num3 += current.Key.Size * current.Value; } resourceLoadStat.Progress = (resourceLoadStat.BytesTotal != 0) ? Mathf.Clamp01(num3 / ((float)resourceLoadStat.BytesTotal)) : 1f; resourceLoadStat.BytesLoaded = Mathf.RoundToInt(resourceLoadStat.BytesTotal * resourceLoadStat.Progress); } } }
public void CalculateLoadSize(NodeAddedEvent e, LoadStatNode node, SingleNode <AssetBundleDatabaseComponent> db) { int num = 0; foreach (AssetBundleInfo info in node.assetBundlesLoadData.BundlesToLoad) { num += info.Size; node.resourceLoadStat.BundleToProgress[info] = 0f; } node.resourceLoadStat.BytesTotal = num; }