Example #1
0
        public bool CanUnload()
        {
            if (assetRequests != null)
            {
                foreach (var pair in this.assetRequests)
                {
                    if (!pair.Value.isDone)
                    {
                        return(false);
                    }
                }
            }

            if (parentBundles != null)
            {
                foreach (var pair in this.parentBundles)
                {
                    var parentBundlePath = pair.Key;
                    var parentBundle     = BundleManager.GetBundleRef(parentBundlePath);
                    if (parentBundle != null && !parentBundle.CanUnload())
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Example #2
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
        }
Example #3
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
        }