/// <summary> /// 加载资源 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="abName"></param> /// <param name="objName"></param> /// <returns></returns> private Object LoadFormAssetBundle(string assetName, ManifestItem item, Type t) { Object o = null; AssetBundleWapper abr = null; if (AssetbundleMap.TryGetValue(item.Path, out abr)) { switch ((ManifestItem.AssetTypeEnum)item.Type) { //暂时需要特殊处理的只有一个 case ManifestItem.AssetTypeEnum.SpriteAtlas: { o = abr.LoadTextureFormAtlas(assetName); } break; case ManifestItem.AssetTypeEnum.Prefab: case ManifestItem.AssetTypeEnum.Texture: case ManifestItem.AssetTypeEnum.Others: default: { o = abr.LoadAsset(assetName, t); } break; } } else { BDebug.Log("资源不存在:" + assetName + " - " + item.Path, "red"); return(null); } return(o); }
/// <summary> /// 加载资源 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="abName"></param> /// <param name="objName"></param> /// <returns></returns> private Object LoadFormAssetBundle(string assetName, AssetBundleItem item, Type t) { Object o = null; AssetBundleWapper abr = null; if (AssetbundleMap.TryGetValue(item.AssetBundlePath, out abr)) { //var assetType = this.assetConfigLoder.AssetTypeList[item.AssetType]; //优先处理图集 if (item.AssetType == this.AssetConfigLoder.TYPE_SPRITE_ATLAS) { o = abr.LoadTextureFormAtlas(assetName); } //其他需要处理的资源类型,依次判断. else { o = abr.LoadAsset(assetName, t); } // switch ((AssetBundleItem.AssetTypeEnum)item.AssetType) // { // //暂时需要特殊处理的只有一个 // case AssetBundleItem.AssetTypeEnum.SpriteAtlas: // { // // } // break; // case AssetBundleItem.AssetTypeEnum.Prefab: // case AssetBundleItem.AssetTypeEnum.Texture: // case AssetBundleItem.AssetTypeEnum.Others: // default: // { // // } // break; // } } else { BDebug.Log("资源不存在:" + assetName + " - " + item.AssetBundlePath, "red"); return(null); } return(o); }