Ejemplo n.º 1
0
        private static IEnumerator _LoadWithDependenciesAsync(string uri, int ttl, Action <AssetBundleRef> onComplete)
        {
#if PROFILE_FILE
            // Profiler.BeginSample("BundleHelper._LoadWithDependenciesAsync");
#endif
            var            fixedUri    = fixBundleUri(uri);
            AssetBundleRef assetBundle = null;
            var            iter        = BundleManager.LoadWithDependenciesAsync(fixedUri, ttl);
            while (iter.MoveNext())
            {
                yield return(null);
            }
            assetBundle = BundleManager.GetBundleRef(fixedUri);
            onComplete(assetBundle);
#if PROFILE_FILE
            // Profiler.EndSample();
#endif
        }
Ejemplo n.º 2
0
        private static IEnumerator _LoadWithDependenciesAsync(string uri, int ttl, LuaTable lua)
        {
#if PROFILE_FILE
            // Profiler.BeginSample("BundleHelper._LoadWithDependenciesAsync");
#endif
            var            fixedUri    = fixBundleUri(uri);
            AssetBundleRef assetBundle = null;
            var            iter        = BundleManager.LoadWithDependenciesAsync(fixedUri, ttl);
            int            count       = 0;
            while (iter.MoveNext())
            {
                count++;
                yield return(null);
            }

            assetBundle = BundleManager.GetBundleRef(fixedUri);
            if (lua != null)
            {
                lua.setOneLevelField("bundle", assetBundle);
            }
#if PROFILE_FILE
            // Profiler.EndSample();
#endif
        }
Ejemplo n.º 3
0
        private static IEnumerator _LoadLevelAdditiveAsync(string uri, int ttl, Action onComplete, Action <AsyncLoadingType, float> onProgress = null)
        {
#if PROFILE_FILE
            // Profiler.BeginSample("BundleHelper.LoadLevelAdditiveAsync");
#endif
            var fixedUri = fixBundleUri(uri);
#if !UNITY_EDITOR || !LOAD_FROM_EDITOR
            AssetBundleRef assetBundle = null;
            var            iter        = BundleManager.LoadWithDependenciesAsync(fixedUri, ttl, bundle => assetBundle = bundle);
            while (iter.MoveNext())
            {
                if (onProgress != null)
                {
                    onProgress(AsyncLoadingType.AssetBundle, (float)iter.Current);
                }
                yield return(null);
            }
#endif
            var asyncOp2 = Application.LoadLevelAdditiveAsync(getAssetName(uri));
            while (!asyncOp2.isDone)
            {
                if (onProgress != null)
                {
                    onProgress(AsyncLoadingType.Scene, asyncOp2.progress);
                }
                yield return(null);
            }

            yield return(new WaitForEndOfFrame());

            onComplete();

#if PROFILE_FILE
            // Profiler.EndSample();
#endif
        }