internal override void LoadImage(UIConfig.ImageSettings imageSettings, byte[] filedata) { config = imageSettings; mgGif.Decoder decoder = new mgGif.Decoder(filedata); var img = decoder.NextImage(); frameDelayMS = img.Delay; List <Texture2D> images = new List <Texture2D>(); while (img != null) { Texture2D newtexture = img.CreateTexture(config.Filter); newtexture.hideFlags = HideFlags.HideAndDontSave; newtexture.DontDestroyOnLoad(); images.Add(newtexture); img = decoder.NextImage(); } textures = images.ToArray(); MainTexture = textures[0]; AspectRatio = MainTexture.width / (float)MainTexture.height; AllElements.Add(this); }
internal AnimatedImage(byte[] filedata, FilterMode filterMode = FilterMode.Bilinear) { mgGif.Decoder decoder = new mgGif.Decoder(filedata); var img = decoder.NextImage(); frameDelayMS = img.Delay; SetSize(img.Width, img.Height); List <Texture2D> images = new List <Texture2D>(); while (img != null) { images.Add(img.CreateTexture(filterMode)); img = decoder.NextImage(); } textures = images.ToArray(); MainTexture = textures[0]; }
internal override void LoadImage(UIConfig.ImageSettings imageSettings, byte[] filedata) { config = imageSettings; mgGif.Decoder decoder = new mgGif.Decoder(filedata); var img = decoder.NextImage(); frameDelayMS = img.Delay; List <Texture2D> images = new List <Texture2D>(); while (img != null) { images.Add(img.CreateTexture(config.Filter)); img = decoder.NextImage(); } textures = images.ToArray(); MainTexture = textures[0]; AspectRatio = MainTexture.width / (float)MainTexture.height; }