public override void OnPoolReset() { base.OnPoolGet(); _actionData = null; }
/// <summary> /// 从原始数据重创建资源 /// </summary> /// <param name="type"></param> /// <param name="url"></param> /// <param name="assetBundle"></param> /// <param name="bytes"></param> /// <returns></returns> public IAsset CreateAssetFromAssetBundle(LoadType type, string url, AssetBundle assetBundle, byte[] bytes = null) { IAsset asset; string fileName; switch (type) { case LoadType.ASSETBUNDLE: asset = new AssetBundleAsset(); asset.asset = assetBundle; break; case LoadType.TEXTURE_ASSET_BUNDLE: asset = new TextureAsset(); fileName = UrlUtil.GetFileName(url); asset.asset = assetBundle.LoadAsset <Texture2D>(fileName); break; case LoadType.AUDIO_ASSET_BUNDLE: asset = new AudioAsset(); fileName = UrlUtil.GetFileName(url); asset.asset = assetBundle.LoadAsset <AudioClip>(fileName); break; case LoadType.ACTION: asset = new ActionAsset(); fileName = UrlUtil.GetFileName(url); ActionData actionData = App.objectPoolManager.GetObject <ActionData>(); actionData.Init(fileName, assetBundle); asset.asset = actionData; break; case LoadType.TEXTURE_EXT: asset = new TextureExtAsset(); fileName = UrlUtil.GetFileName(url); TextureExt textureExt = App.objectPoolManager.GetObject <TextureExt>(); textureExt.Init(fileName, assetBundle); asset.asset = textureExt; break; case LoadType.TEXTURE_EXT_SPRITE: asset = new TextureExtSpriteAsset(); fileName = UrlUtil.GetFileName(url); TextureExtSprite textureExtSprite = App.objectPoolManager.GetObject <TextureExtSprite>(); textureExtSprite.Init(fileName, assetBundle); asset.asset = textureExtSprite; break; default: asset = null; break; } if (asset == null) { return(null); } asset.assetBundle = assetBundle; //asset.bytes = bytes; return(asset); }
protected override void onDispose() { base.onDispose(); _actionData = null; }