public static IRes Create(string assetName, string ownerBundleName, short assetType) { switch (assetType) { case ResType.AssetBundle: return(AssetBundleRes.Allocate(assetName)); case ResType.ABAsset: return(AssetRes.Allocate(assetName, ownerBundleName)); case ResType.ABScene: return(SceneRes.Allocate(assetName)); case ResType.Internal: return(InternalRes.Allocate(assetName)); case ResType.NetImageRes: return(NetImageRes.Allocate(assetName)); case ResType.LocalImageRes: return(LocalImageRes.Allocate(assetName)); default: Log.E("Invalid assetType :" + assetType); return(null); } }
public static IRes Create(ResSearchRule resSearchRule, short assetType) { switch (assetType) { case ResType.AssetBundle: return(AssetBundleRes.Allocate(resSearchRule.AssetName)); case ResType.ABAsset: return(AssetRes.Allocate(resSearchRule.AssetName, resSearchRule.OwnerBundle)); case ResType.ABScene: return(SceneRes.Allocate(resSearchRule.AssetName)); case ResType.Internal: return(ResourcesRes.Allocate(resSearchRule.AssetName, resSearchRule.AssetName.StartsWith("resources://") ? InternalResNamePrefixType.Url : InternalResNamePrefixType.Folder)); case ResType.NetImageRes: return(NetImageRes.Allocate(resSearchRule.AssetName)); case ResType.LocalImageRes: return(LocalImageRes.Allocate(resSearchRule.AssetName)); default: Log.E("Invalid assetType :" + assetType); return(null); } }
public override void Load() { base.Load(); if (assetBundleRes == null) { assetBundleRes = ResMgr.GetAssetBundleRes(Application.streamingAssetsPath + "/AssetBundles/" + assetBundleName); } asset = (assetBundleRes.Asset as AssetBundle).LoadAsset(Name); if (asset == null) { Debug.LogErrorFormat("AssetBundle{0} do not contain asset{1}", assetBundleRes, asset); } }
public static AssetBundleRes GetAssetBundleRes(string assetName) { Res res = SharedLoadedReses.Find(loadedAsset => loadedAsset.Name == assetName); if (res != null) { res.Retain(); return(res as AssetBundleRes); } res = new AssetBundleRes(assetName); res.Load(); SharedLoadedReses.Add(res); res.Retain(); return(res as AssetBundleRes); }
public static Res Create(string assetName, string assetBundleName) { Res res = null; if (assetBundleName != null) { res = new AssetRes(assetName, assetBundleName); } else if (assetName.StartsWith("resources://")) { res = new ResourcesRes(assetName); } else { res = new AssetBundleRes(assetName); } return(res); }
public void OnSyncLoadFinish(IResLoader loader, AssetBundleRes res) { //Log.W("OnSyncLoadFinish:AssetBundleRes:" + res.name); if (res.assetBundle == null) { return; } string[] assetNames = res.assetBundle.GetAllAssetNames(); if (assetNames == null) { return; } for (int i = assetNames.Length - 1; i >= 0; --i) { loader.Add2Load(PathHelper.FullAssetPath2Name(assetNames[i]), null, false); } }
public override bool LoadSync() { if (!CheckLoadAble()) { return(false); } if (string.IsNullOrEmpty(AssetBundleName)) { return(false); } AssetBundleRes abR = ResMgr.Instance.GetRes <AssetBundleRes>(AssetBundleName); if (abR == null || abR.assetBundle == null) { Log.E("Failed to Load Asset, Not Find AssetBundleImage:" + abR); return(false); } State = ResState.Ready; return(true); }
public virtual void OnAsyncLoadFinish(IResLoader loader, AssetBundleRes res) { }
public void OnSyncLoadFinish(IResLoader loader, AssetBundleRes res) { }