using System; using UnityEngine; using XUpdater; namespace XUtliPoolLib { public abstract class AssetBundleLoader { public virtual bool isComplete { get { return this.state == LoadState.State_Error || this.state == LoadState.State_Complete; } } internal AssetBundleManager.LoadAssetCompleteHandler onComplete; public int loadHandlerID; public uint bundleName; public AssetBundleData bundleData; public AssetBundleInfo bundleInfo; public AssetBundleManager bundleManager; public LoadState state = LoadState.State_None; protected AssetBundleLoader[] depLoaders; public virtual void Load() { } public virtual void LoadImm() { } public virtual void LoadBundle() { } public virtual void LoadBundleImm() { } protected virtual void Complete() { bool flag = this.onComplete != null; if (flag) { AssetBundleManager.LoadAssetCompleteHandler loadAssetCompleteHandler = this.onComplete; this.onComplete = null; loadAssetCompleteHandler(this.bundleInfo, this.loadHandlerID); } this.bundleManager.LoadComplete(this); } protected virtual void Error() { bool flag = this.onComplete != null; if (flag) { AssetBundleManager.LoadAssetCompleteHandler loadAssetCompleteHandler = this.onComplete; this.onComplete = null; loadAssetCompleteHandler(this.bundleInfo, this.loadHandlerID); } this.bundleManager.LoadError(this); } protected bool UnloadNotLoadingBundle(AssetBundle bundle) { bool flag = bundle == null; bool result; if (flag) { int bundleCount = XSingleton.singleton.ABManager.BundleCount; XSingleton.singleton.ABManager.UnloadNotUsedLoader(); Resources.UnloadUnusedAssets(); XSingleton.singleton.AddErrorLog("AssetBundle Count: ", bundleCount.ToString(), " , ", XSingleton.singleton.ABManager.BundleCount.ToString(), null, null); result = true; } else { result = false; } return result; } } }