Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
 protected void UnloadSpecificLoadTypeResource(enResourceLoadCache loadCache)
 {
     if (loadCache == enResourceLoadCache.PermanentLoad)
     {
         return;
     }
     RealUnloadSpecificLoadTypeResource(loadCache);
 }
 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();
         }
     }
 }
Exemplo n.º 5
0
 protected void ChangeResourceInfoLoadType(string name, enResourceLoadCache oldloadCache,
                                           enResourceLoadCache newloadCache)
 {
     if (AllLoadedResourceInfos[oldloadCache].ContainsKey(name))
     {
         var info = AllLoadedResourceInfos[oldloadCache][name];
         AllLoadedResourceInfos[newloadCache].Add(name, info);
         AllLoadedResourceInfos[oldloadCache].Remove(name);
     }
 }
Exemplo n.º 6
0
 public void Reset()
 {
     AssetBundleName        = String.Empty;
     OnLoadAllBundleAction  = null;
     OnLoadSelfBundleAction = null;
     LoadMode   = enResourceLoadMode.Sync;
     LoadCache  = enResourceLoadCache.NormalLoad;
     LoadMethod = enResourceLoadMethod.LoadFromFile;
     BundleInfo = null;
     UserData   = null;
 }
Exemplo n.º 7
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);
 }
Exemplo n.º 8
0
        protected override void RealUnloadSpecificLoadTypeResourceByName(enResourceLoadCache loadCache, string name)
        {
            AbstractAssetInfo item;

            foreach (KeyValuePair <string, AbstractAssetInfo> assetInfo in AllLoadedResourceInfos[loadCache])
            {
                if (assetInfo.Value.AssetBundleName == name)
                {
                    item = assetInfo.Value;
                    AllLoadedResourceInfos[loadCache].Remove(item.AssetBundleName);
                    item.Dispose();
                    break;
                }
            }
        }
 protected override void RealUnloadSpecificLoadTypeResource(enResourceLoadCache loadCache)
 {
     foreach (KeyValuePair <string, AbstractAssetInfo> assetInfo in AllLoadedResourceInfos[loadCache])
     {
         if (assetInfo.Value.IsUnused)
         {
             UnusedAssetBundleInfos.Add(assetInfo.Value);
         }
     }
     if (UnusedAssetBundleInfos.Count == 0)
     {
         return;
     }
     foreach (AbstractAssetInfo info in UnusedAssetBundleInfos)
     {
         AllLoadedResourceInfos[loadCache].Remove(info.AssetBundleName);
         info.Dispose();
     }
     UnusedAssetBundleInfos.Clear();
 }
Exemplo n.º 10
0
 public void UnloadLoadTypeResourceByName(enResourceLoadCache loadCache, string name)
 {
     CurrentResourceModule.UnloadSpecificLoadTypeResourceByName(loadCache, name);
 }
Exemplo n.º 11
0
 public void UnloadLoadTypeResourceByName(enResourceLoadCache loadCache, string name)
 {
     resourceManager.UnloadLoadTypeResourceByName(loadCache, name);
 }
Exemplo n.º 12
0
 public void UnloadSpecificLoadTypeResourceByName(enResourceLoadCache loadCache, string name)
 {
     RealUnloadSpecificLoadTypeResourceByName(loadCache, name);
 }
Exemplo n.º 13
0
 protected abstract void RealUnloadSpecificLoadTypeResource(enResourceLoadCache loadCache);
Exemplo n.º 14
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);
Exemplo n.º 15
0
 protected abstract void RealUnloadSpecificLoadTypeResourceByName(enResourceLoadCache loadCache, string name);