summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XUtliPoolLib/AssetBundleLoader.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Client/Assets/Scripts/XUtliPoolLib/AssetBundleLoader.cs')
-rw-r--r--Client/Assets/Scripts/XUtliPoolLib/AssetBundleLoader.cs92
1 files changed, 92 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XUtliPoolLib/AssetBundleLoader.cs b/Client/Assets/Scripts/XUtliPoolLib/AssetBundleLoader.cs
new file mode 100644
index 00000000..e9ab225c
--- /dev/null
+++ b/Client/Assets/Scripts/XUtliPoolLib/AssetBundleLoader.cs
@@ -0,0 +1,92 @@
+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<XUpdater.XUpdater>.singleton.ABManager.BundleCount;
+ XSingleton<XUpdater.XUpdater>.singleton.ABManager.UnloadNotUsedLoader();
+ Resources.UnloadUnusedAssets();
+ XSingleton<XDebug>.singleton.AddErrorLog("AssetBundle Count: ", bundleCount.ToString(), " , ", XSingleton<XUpdater.XUpdater>.singleton.ABManager.BundleCount.ToString(), null, null);
+ result = true;
+ }
+ else
+ {
+ result = false;
+ }
+ return result;
+ }
+ }
+}