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