public void RequestResource(string name, AssetBundleLoader.OnLoadAllBundle callback,
                             enResourceLoadMode loadMode     = enResourceLoadMode.Sync,
                             enResourceLoadCache loadCache   = enResourceLoadCache.NormalLoad,
                             enResourceLoadMethod loadMethod = enResourceLoadMethod.LoadFromFile, object userdata = null)
 {
     CurrentResourceModule.RequestResource(name, callback, loadMode, loadCache, loadMethod, userdata);
 }
 public ResourceLoadInfo(string assetName, string assetBundleName, enResourceLoadCache resourceLoadCache, enResourceLoadMode resourceLoadMode, enResourceLoadMethod resourceLoadMethod)
 {
     this.assetName          = assetName;
     this.assetBundleName    = assetBundleName;
     this.resourceLoadMode   = resourceLoadMode;
     this.resourceLoadMethod = resourceLoadMethod;
     this.resourceLoadCache  = resourceLoadCache;
 }
 protected override void RealRequestResource(string name, AssetBundleLoader.OnLoadAllBundle callback,
                                             enResourceLoadMode loadMode     = enResourceLoadMode.Sync,
                                             enResourceLoadCache loadCache   = enResourceLoadCache.NormalLoad,
                                             enResourceLoadMethod loadMethod = enResourceLoadMethod.LoadFromFile, object userData = null)
 {
     if (AllLoadedResourceInfos[enResourceLoadCache.NormalLoad].ContainsKey(name))
     {
         callback(AllLoadedResourceInfos[enResourceLoadCache.NormalLoad][name], userData);
         if (loadCache > enResourceLoadCache.NormalLoad)
         {
             ChangeResourceInfoLoadType(name, enResourceLoadCache.NormalLoad, loadCache);
         }
     }
     else if (AllLoadedResourceInfos[enResourceLoadCache.Preload].ContainsKey(name))
     {
         callback(AllLoadedResourceInfos[enResourceLoadCache.Preload][name], userData);
         if (loadCache > enResourceLoadCache.Preload)
         {
             ChangeResourceInfoLoadType(name, enResourceLoadCache.Preload, loadCache);
         }
     }
     else if (AllLoadedResourceInfos[enResourceLoadCache.PermanentLoad].ContainsKey(name))
     {
         callback(AllLoadedResourceInfos[enResourceLoadCache.PermanentLoad][name], userData);
     }
     else
     {
         AssetBundleLoader assetBundleLoader = null;
         if (AssetBundleLoaders.ContainsKey(name))
         {
             assetBundleLoader                        = AssetBundleLoaders[name];
             assetBundleLoader.UserData               = userData;
             assetBundleLoader.LoadCache              = loadCache;
             assetBundleLoader.LoadMode               = loadMode;
             assetBundleLoader.LoadMethod             = loadMethod;
             assetBundleLoader.OnLoadAllBundleAction += callback;
             assetBundleLoader.OnLoadSelfBundleAction = OnLoadSelfBundleAction;
             if (loadMode == enResourceLoadMode.Sync)
             {
                 assetBundleLoader.LoadState = enLoadState.None;
                 assetBundleLoader.StartLoadBundle();
             }
         }
         else
         {
             assetBundleLoader                        = CreateAssetBundleLoader(name);
             assetBundleLoader.LoadMethod             = loadMethod;
             assetBundleLoader.UserData               = userData;
             assetBundleLoader.LoadCache              = loadCache;
             assetBundleLoader.LoadMode               = loadMode;
             assetBundleLoader.OnLoadAllBundleAction  = callback;
             assetBundleLoader.OnLoadSelfBundleAction = OnLoadSelfBundleAction;
             AssetBundleLoaders.Add(name, assetBundleLoader);
             assetBundleLoader.StartLoadBundle();
         }
     }
 }
Beispiel #4
0
 public AssetDatabaseLoader()
 {
     AssetBundleName        = String.Empty;
     OnLoadSelfBundleAction = null;
     OnLoadAllBundleAction  = null;
     LoadMethod             = enResourceLoadMethod.LoadFromFile;
     LoadState  = enLoadState.None;
     LoadMode   = enResourceLoadMode.Sync;
     BundleInfo = null;
 }
Beispiel #5
0
 public void Reset()
 {
     AssetBundleName        = String.Empty;
     OnLoadAllBundleAction  = null;
     OnLoadSelfBundleAction = null;
     LoadMode   = enResourceLoadMode.Sync;
     LoadCache  = enResourceLoadCache.NormalLoad;
     LoadMethod = enResourceLoadMethod.LoadFromFile;
     BundleInfo = null;
     UserData   = null;
 }
Beispiel #6
0
 public void RequestResource(string name, AssetBundleLoader.OnLoadAllBundle callback,
                             enResourceLoadMode loadMode     = enResourceLoadMode.Sync,
                             enResourceLoadCache loadCache   = enResourceLoadCache.NormalLoad,
                             enResourceLoadMethod loadMethod = enResourceLoadMethod.LoadFromFile, object userData = null)
 {
     if (ResourceWhiteList.Contains(name))
     {
         loadCache = enResourceLoadCache.Preload;
     }
     RealRequestResource(name, callback, loadMode, loadCache, loadMethod, userData);
 }
Beispiel #7
0
 protected abstract void RealRequestResource(string name, AssetBundleLoader.OnLoadAllBundle callback,
                                             enResourceLoadMode loadMode     = enResourceLoadMode.Sync,
                                             enResourceLoadCache loadCache   = enResourceLoadCache.NormalLoad,
                                             enResourceLoadMethod loadMethod = enResourceLoadMethod.LoadFromFile, object userData = null);