| | 1 | | using UnityEngine; |
| | 2 | |
|
| | 3 | | namespace DCL |
| | 4 | | { |
| | 5 | | public class Asset_Gif : Asset, ITexture |
| | 6 | | { |
| | 7 | | public event System.Action OnCleanup; |
| | 8 | |
|
| 4 | 9 | | public Texture2D texture => frames?[0].texture; |
| 0 | 10 | | public int width => texture?.width ?? 0; |
| 0 | 11 | | public int height => texture?.height ?? 0; |
| 0 | 12 | | public GifFrameData[] frames { get; internal set; } |
| | 13 | |
|
| | 14 | | internal IGifProcessor processor; |
| | 15 | |
|
| 0 | 16 | | public void Dispose() { Cleanup(); } |
| | 17 | |
|
| | 18 | | public override void Cleanup() |
| | 19 | | { |
| 14 | 20 | | OnCleanup?.Invoke(); |
| | 21 | |
|
| 14 | 22 | | processor?.DisposeGif(); |
| | 23 | |
|
| 14 | 24 | | if (frames is null) |
| | 25 | | { |
| 9 | 26 | | return; |
| | 27 | | } |
| | 28 | |
|
| 460 | 29 | | for (int i = 0; i < frames.Length; i++) |
| | 30 | | { |
| 225 | 31 | | Object.Destroy(frames[i].texture); |
| | 32 | | } |
| | 33 | |
|
| 5 | 34 | | frames = null; |
| 5 | 35 | | } |
| | 36 | | } |
| | 37 | |
|
| | 38 | | } |