示例#1
0
        public static FullBundleLoader GetLoader(string bundleName)
        {
            FullBundleLoader loader = null;

            s_NameToLoader.TryGetValue(bundleName, out loader);
            return(loader);
        }
示例#2
0
        public static FullBundleLoader GetLoader(int resourceIndex)
        {
            FullBundleLoader loader = null;

            s_ResIndexToLoader.TryGetValue(resourceIndex, out loader);
            return(loader);
        }
示例#3
0
        private int InternalLoadSync(System.Action <bool, Object> loadedAction)
        {
            if (loadedAction == null)
            {
                loadedAction = s_DefaultLoadedCallback;
            }

            var index = ResourceManager.GetNewResourceIndex();

            m_ResouceIndexSet.Add(index);
            if (m_LoadState == LoadState.Init || m_LoadState == LoadState.WaitLoad)
            {
                m_BundleIndex = FullBundleLoader.LoadSync(m_BundleName, null);
                var bundleLoader = FullBundleLoader.GetLoader(m_BundleIndex);
                var bundle       = bundleLoader.GetAssetBundle();
                m_AssetObject = bundle.LoadAsset <Object>(m_AssetName);

                m_LoadState = LoadState.Complete;
                loadedAction(m_AssetObject != null, m_AssetObject);
            }
            else if (m_LoadState == LoadState.Loading)
            {
                Debug.LogWarning("错误加载 fullbundleloader");
            }
            else
            {
                loadedAction(m_AssetObject != null, m_AssetObject);
            }

            return(index);
        }
示例#4
0
 protected override void OnRecycle()
 {
     if (m_BundleIndex != -1)
     {
         FullBundleLoader.UnLoad(m_BundleIndex);
     }
     ResetData();
 }
示例#5
0
        protected override IEnumerator LoadFuncEnumerator()
        {
            if (m_LoadState != LoadState.WaitLoad)
            {
                yield break;
            }

            m_LoadState   = LoadState.Loading;
            m_BundleIndex = FullBundleLoader.LoadAsync(m_BundleName, null);
            var bundleLoader = FullBundleLoader.GetLoader(m_BundleIndex);

            while (!bundleLoader.IsComplate)
            {
                yield return(null);
            }

            var bundle  = bundleLoader.GetAssetBundle();
            var request = bundle.LoadAssetAsync <Object>(m_AssetName);

            while (!request.isDone)
            {
                yield return(null);
            }

            m_AssetObject = request.asset;
            m_LoadState   = LoadState.Complete;

            foreach (var action in m_LoadedCallbackDict)
            {
                var callback = action.Value;
                callback(m_AssetObject != null, m_AssetObject);
            }

            m_LoadedCallbackDict.Clear();
            TryUnLoadByAssetKey(m_AssetKeyName);
        }
示例#6
0
 public void InitBundleManifest()
 {
     FullBundleLoader.InitBundleManifest();
 }