Esempio n. 1
0
        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);
                }
            }
        }
Esempio n. 2
0
        public void UpdateLoadProgress(AssetBundlesLoadedEvent e, SingleNode <ResourceLoadStatComponent> node)
        {
            ResourceLoadStatComponent component = node.component;

            component.BytesLoaded = component.BytesTotal;
            component.Progress    = 1f;
        }
Esempio n. 3
0
        public void UpdateGearProgress(UpdateEvent evt, ActiveTankLoadGearNode gear, [JoinAll] ICollection <LoadingNotGraffitiHangarPreviewItemStatsNode> items)
        {
            int num  = 0;
            int num2 = 0;

            foreach (LoadingHangarPreviewItemStatsNode node in items)
            {
                ResourceLoadStatComponent resourceLoadStat = node.resourceLoadStat;
                num  += resourceLoadStat.BytesTotal;
                num2 += resourceLoadStat.BytesLoaded;
            }
            float num3 = (num <= 0) ? 1f : (((float)num2) / ((float)num));

            base.ScheduleEvent(new UpdateLoadGearProgressEvent(num3), gear);
        }