public static FullBundleLoader GetLoader(string bundleName) { FullBundleLoader loader = null; s_NameToLoader.TryGetValue(bundleName, out loader); return(loader); }
public static FullBundleLoader GetLoader(int resourceIndex) { FullBundleLoader loader = null; s_ResIndexToLoader.TryGetValue(resourceIndex, out loader); return(loader); }
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); }
protected override void OnRecycle() { if (m_BundleIndex != -1) { FullBundleLoader.UnLoad(m_BundleIndex); } ResetData(); }
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); }
public void InitBundleManifest() { FullBundleLoader.InitBundleManifest(); }