示例#1
0
        /// <summary>
        /// Set gif asset for the player
        /// </summary>
        /// <param name="asset">gif asset</param>
        public void SetGif(Asset_Gif asset)
        {
            gifAsset = asset;

            if (isPlaying && IsValidAsset())
            {
                if (currentFrameIdx >= asset.frames.Length)
                {
                    currentFrameIdx = 0;
                }
                SetFrame(currentFrameIdx);
            }
        }
示例#2
0
        private static IEnumerator Create(string contentType, string url, Asset_Gif.MaxSize maxTextureSize,
                                          Action <ITexture, AssetPromise_Texture> OnSuccess, Action OnFail = null)
        {
            if (contentType != "image/gif")
            {
                AssetPromise_Texture texturePromise = new AssetPromise_Texture(url, storeTexAsNonReadable: false);
                texturePromise.OnSuccessEvent += texture => { OnSuccess?.Invoke(texture, texturePromise); };
                texturePromise.OnFailEvent    += (x) => OnFail?.Invoke();

                AssetPromiseKeeper_Texture.i.Keep(texturePromise);

                yield return(texturePromise);

                yield break;
            }

            var gif = new Asset_Gif(url, maxTextureSize, OnSuccess);

            yield return(gif.Load());
        }
示例#3
0
 public GifPlayer(Asset_Gif asset)
 {
     SetGif(asset);
 }