| | 1 | | using System; |
| | 2 | | using System.Collections; |
| | 3 | | using DCL.Helpers; |
| | 4 | | using UnityEngine; |
| | 5 | |
|
| | 6 | | namespace DCL |
| | 7 | | { |
| | 8 | | public class AssetPromise_PrimitiveMesh: AssetPromise<Asset_PrimitiveMesh> |
| | 9 | | { |
| | 10 | | public PrimitiveMeshModel model; |
| | 11 | |
|
| 1 | 12 | | private static readonly IPrimitiveMeshFactory primitiveMeshFactory = new PrimitiveMeshFactory(); |
| | 13 | |
|
| 4 | 14 | | public AssetPromise_PrimitiveMesh(PrimitiveMeshModel model) |
| | 15 | | { |
| 4 | 16 | | this.model = model; |
| 4 | 17 | | } |
| | 18 | |
|
| 42 | 19 | | protected override void OnAfterLoadOrReuse() { } |
| | 20 | |
|
| 42 | 21 | | protected override void OnBeforeLoadOrReuse() { } |
| | 22 | |
|
| 0 | 23 | | protected override void OnCancelLoading() { } |
| | 24 | |
|
| | 25 | | protected override void OnLoad(Action OnSuccess, Action<Exception> OnFail) |
| | 26 | | { |
| | 27 | | try |
| | 28 | | { |
| 34 | 29 | | Mesh currentMesh = primitiveMeshFactory.CreateMesh(model); |
| 34 | 30 | | asset.mesh = currentMesh; |
| 34 | 31 | | OnSuccess?.Invoke(); |
| 34 | 32 | | } |
| 0 | 33 | | catch(Exception e) |
| | 34 | | { |
| 0 | 35 | | OnFail?.Invoke(e); |
| 0 | 36 | | } |
| 34 | 37 | | } |
| | 38 | |
|
| 231 | 39 | | public override object GetId() { return model; } |
| | 40 | | } |
| | 41 | | } |