| | 1 | | using System.Collections.Generic; |
| | 2 | | using UnityEngine; |
| | 3 | |
|
| | 4 | | namespace DCL |
| | 5 | | { |
| | 6 | | public class Asset_AB : Asset |
| | 7 | | { |
| | 8 | | public AssetBundle ownerAssetBundle; |
| | 9 | | public string assetBundleAssetName; |
| | 10 | |
|
| 27 | 11 | | public Dictionary<string, List<Object>> assetsByExtension = new Dictionary<string, List<Object>>(); |
| | 12 | |
|
| 27 | 13 | | public Asset_AB() |
| | 14 | | { |
| 27 | 15 | | assetsByExtension = new Dictionary<string, List<Object>>(); |
| 27 | 16 | | } |
| | 17 | |
|
| 0 | 18 | | public override object Clone() => (Asset_AB) MemberwiseClone(); |
| | 19 | |
|
| | 20 | | public void CancelShow() |
| | 21 | | { |
| 7 | 22 | | Cleanup(); |
| 7 | 23 | | } |
| | 24 | |
|
| | 25 | | public override void Cleanup() |
| | 26 | | { |
| 34 | 27 | | assetsByExtension = null; |
| | 28 | |
|
| 34 | 29 | | if (ownerAssetBundle) |
| | 30 | | { |
| 20 | 31 | | ownerAssetBundle.Unload(true); |
| 20 | 32 | | ownerAssetBundle = null; |
| | 33 | | } |
| 34 | 34 | | } |
| | 35 | |
|
| | 36 | | public List<T> GetAssetsByExtensions<T>(params string[] extensions) |
| | 37 | | where T : Object |
| | 38 | | { |
| 13 | 39 | | var goList = new List<T>(); |
| | 40 | |
|
| 78 | 41 | | for (int i1 = 0; i1 < extensions.Length; i1++) |
| | 42 | | { |
| 26 | 43 | | string ext = extensions[i1]; |
| | 44 | | List<Object> assets; |
| | 45 | |
|
| 26 | 46 | | if (assetsByExtension.ContainsKey(ext)) |
| | 47 | | { |
| 12 | 48 | | assets = assetsByExtension[ext]; |
| 12 | 49 | | int glbCount = assets.Count; |
| | 50 | |
|
| 48 | 51 | | for (int i = 0; i < glbCount; i++) |
| | 52 | | { |
| 12 | 53 | | Object go = assets[i]; |
| | 54 | |
|
| 12 | 55 | | if (go is T) |
| 12 | 56 | | goList.Add((T) go); |
| | 57 | | } |
| | 58 | | } |
| | 59 | | } |
| | 60 | |
|
| 13 | 61 | | return goList; |
| | 62 | | } |
| | 63 | | } |
| | 64 | | } |