override public void Dispose() { if (_textureExtSprite != null) { App.objectPoolManager.ReleaseObject(_textureExtSprite); _textureExtSprite = null; } base.Dispose(); }
/// <summary> /// 销毁 /// </summary> public void Dispose() { if (_textureExtSprite != null) { App.objectPoolManager.ReleaseObject(_textureExtSprite); _textureExtSprite = null; } _actionID = 0; }
protected override void OnLoadComplete() { string fileName = UrlUtil.GetFileName(_urlRelative); _textureExtSprite = App.objectPoolManager.GetObject <TextureExtSprite>(); _textureExtSprite.Init(fileName, _assetBundle); _data = _textureExtSprite; //_assetBundle.Unload(false); }
public void Init(string fileName, AssetBundle assetBundle) { int index = fileName.IndexOf('_'); if (index > 0) { int.TryParse(fileName.Substring(0, index), out _actionID); } _textureExtSprite = App.objectPoolManager.GetObject <TextureExtSprite>(); _textureExtSprite.Init(fileName, assetBundle); }
public override void OnPoolReset() { base.OnPoolGet(); _textureExtSprite = null; }
protected override void onDispose() { base.onDispose(); _textureExtSprite = 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); }