| | 1 | | using DCL.ECSRuntime; |
| | 2 | | using UnityEngine; |
| | 3 | |
|
| | 4 | | namespace DCL.ECSComponents |
| | 5 | | { |
| | 6 | | public class NFTShapeRegister |
| | 7 | | { |
| | 8 | | private readonly ECSComponentsFactory factory; |
| | 9 | | private readonly IECSComponentWriter componentWriter; |
| | 10 | | private readonly int componentId; |
| | 11 | |
|
| 21 | 12 | | public NFTShapeRegister(int componentId, ECSComponentsFactory factory, IECSComponentWriter componentWriter, IInt |
| | 13 | | { |
| 21 | 14 | | var shapeFrameFactory = Resources.Load<NFTShapeFrameFactory>("NFTShapeFrameFactory"); |
| 21 | 15 | | factory.AddOrReplaceComponent(componentId, ProtoSerialization.Deserialize<PBNftShape>, |
| 0 | 16 | | () => new ECSNFTShapeComponentHandler(shapeFrameFactory, |
| | 17 | | new NFTInfoRetriever(), |
| | 18 | | new NFTAssetRetriever(), |
| | 19 | | internalComponents.renderersComponent)); |
| 21 | 20 | | componentWriter.AddOrReplaceComponentSerializer<PBNftShape>(componentId, ProtoSerialization.Serialize); |
| | 21 | |
|
| 21 | 22 | | this.factory = factory; |
| 21 | 23 | | this.componentWriter = componentWriter; |
| 21 | 24 | | this.componentId = componentId; |
| 21 | 25 | | } |
| | 26 | |
|
| | 27 | | public void Dispose() |
| | 28 | | { |
| 2 | 29 | | factory.RemoveComponent(componentId); |
| 2 | 30 | | componentWriter.RemoveComponentSerializer(componentId); |
| 2 | 31 | | } |
| | 32 | | } |
| | 33 | | } |