Esempio n. 1
0
        protected override void Create(RenewableDownloadHandler handle)
        {
            if (RenewablePool.Instance.Exist(cache, handle.key + handle.parameter, handle.secret))
            {
                Object asset = RenewablePool.Instance.Pop <Object>(cache, handle.key + handle.parameter);

                if (current == handle.key && parameter == handle.parameter && asset != null)
                {
                    Refresh(asset);
                }
            }
            else
            {
                RenewableAssetBundle.Instance.LoadAsync(handle.key, handle.buffer, handle.parameter, (asset) =>
                {
                    if (asset != null)
                    {
                        if (current == handle.key && parameter == handle.parameter && asset != null)
                        {
                            Refresh(asset);
                        }
                        RenewablePool.Instance.Push(cache, handle.key + handle.parameter, handle.secret, handle.recent, asset);
                    }
                });
            }
        }
Esempio n. 2
0
        protected override void Create(RenewableDownloadHandler handle)
        {
            Texture2D _texture;

            if (RenewablePool.Instance.Exist(cache, handle.key, handle.secret))
            {
                _texture = RenewablePool.Instance.Pop <Texture2D>(cache, handle.key);
            }
            else
            {
                if (handle.source != null)
                {
                    _texture = handle.Get <Texture2D>();
                }
                else
                {
                    _texture = new Texture2D(10, 10, TextureFormat.RGBA32, false);

                    _texture.LoadImage(handle.buffer);
                }
                RenewablePool.Instance.Push(cache, handle.key, handle.secret, handle.recent, _texture);
            }

            if (this == null)
            {
                return;
            }

            if (current != handle.key)
            {
                return;
            }

            SetTexture(_texture);
        }
Esempio n. 3
0
        protected override void Create(RenewableDownloadHandler handle)
        {
            AudioClip clip = null;

            if (RenewablePool.Instance.Exist(cache, handle.key, handle.secret))
            {
                clip = RenewablePool.Instance.Pop <AudioClip>(cache, handle.key);
            }
            else
            {
                if (handle.source != null)
                {
                    clip = handle.Get <AudioClip>();

                    RenewablePool.Instance.Push(cache, handle.key, handle.secret, handle.recent, clip);
                }
                else
                {
                    Debug.LogWarningFormat("{0} 无法解析!", handle.key);
                }
            }

            if (this == null)
            {
                return;
            }

            if (current != handle.key)
            {
                return;
            }

            Play(clip);
        }
Esempio n. 4
0
        protected override void Create(RenewableDownloadHandler handle)
        {
            if (this == null)
            {
                return;
            }

            if (current != handle.key)
            {
                return;
            }

            SetText(Encoding.Default.GetString(handle.buffer));
        }