Exemplo n.º 1
0
 override public void Dispose()
 {
     if (_textureExt != null)
     {
         App.objectPoolManager.ReleaseObject(_textureExt);
         _textureExt = null;
     }
     base.Dispose();
 }
Exemplo n.º 2
0
        protected override void OnLoadComplete()
        {
            string fileName = UrlUtil.GetFileName(_urlRelative);

            _textureExt = App.objectPoolManager.GetObject <TextureExt>();
            _textureExt.Init(fileName, _assetBundle);
            _data = _textureExt;

            //_assetBundle.Unload(false);
        }
Exemplo n.º 3
0
        public void Init(string fileName, AssetBundle assetBundle)
        {
            _texture = App.objectPoolManager.GetObject <TextureExt>();
            _texture.Init(fileName, assetBundle);

            int length = _texture.paramList.Length;

            _spriteList      = new Sprite[length];
            _alphaSpriteList = new Sprite[length];

            _spriteDict.Clear();
            _alphaSpriteDict.Clear();
        }
Exemplo n.º 4
0
 /// <summary>
 /// 重置
 /// </summary>
 public void Reset()
 {
     if (_texture != null)
     {
         App.objectPoolManager.ReleaseObject(_texture);
         _texture = null;
     }
     foreach (Sprite sprite in _spriteList)
     {
         UnityEngine.Object.Destroy(sprite);
     }
     foreach (Sprite sprite in _alphaSpriteList)
     {
         UnityEngine.Object.Destroy(sprite);
     }
     _spriteList = null;
     _spriteDict.Clear();
     _alphaSpriteList = null;
     _alphaSpriteDict.Clear();
 }
Exemplo n.º 5
0
        /// <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);
        }
Exemplo n.º 6
0
 public override void OnPoolReset()
 {
     base.OnPoolGet();
     _textureExt = null;
 }
Exemplo n.º 7
0
 protected override void onDispose()
 {
     base.onDispose();
     _textureExt = null;
 }