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 static AssetRes Allocate(string name, string onwerBundleName = null) { AssetRes res = SafeObjectPool <AssetRes> .Instance.Allocate(); if (res != null) { res.AssetName = name; res.mOwnerBundleName = onwerBundleName; res.InitAssetBundleName(); } return(res); }