| | 1 | | using System; |
| | 2 | | using DCL.ECSComponents; |
| | 3 | | using DCL.Models; |
| | 4 | |
|
| | 5 | | namespace DCL.ECS7.UI |
| | 6 | | { |
| | 7 | | public class UISceneDataContainer |
| | 8 | | { |
| | 9 | | public event Action<IDCLEntity> OnUITransformRemoved; |
| | 10 | |
|
| 9 | 11 | | public readonly BaseDictionary<long,PBUiTransform> sceneCanvasTransform = new BaseDictionary<long,PBUiTransform> |
| 9 | 12 | | public readonly BaseDictionary<long,PBUiText> sceneCanvasText = new BaseDictionary<long,PBUiText>(); |
| | 13 | |
|
| | 14 | | private bool isDirty = false; |
| | 15 | |
|
| 0 | 16 | | public bool IsDirty() => isDirty; |
| | 17 | |
|
| 0 | 18 | | public void UIRendered() => isDirty = false; |
| | 19 | |
|
| | 20 | | public void AddUIComponent(IDCLEntity entity, PBUiTransform model) |
| | 21 | | { |
| 19 | 22 | | isDirty = true; |
| 19 | 23 | | sceneCanvasTransform[entity.entityId] = model; |
| 19 | 24 | | } |
| | 25 | |
|
| | 26 | | public void AddUIComponent(IDCLEntity entity, PBUiText model) |
| | 27 | | { |
| 0 | 28 | | isDirty = true; |
| 0 | 29 | | sceneCanvasText[entity.entityId] = model; |
| 0 | 30 | | } |
| | 31 | |
|
| | 32 | | public void RemoveUITransform(IDCLEntity entity) |
| | 33 | | { |
| 1 | 34 | | isDirty = true; |
| 1 | 35 | | sceneCanvasTransform.Remove(entity.entityId); |
| 1 | 36 | | OnUITransformRemoved?.Invoke(entity); |
| 1 | 37 | | } |
| | 38 | |
|
| | 39 | | public void RemoveUIText(IDCLEntity entity) |
| | 40 | | { |
| 0 | 41 | | isDirty = true; |
| 0 | 42 | | sceneCanvasText.Remove(entity.entityId); |
| 0 | 43 | | } |
| | 44 | | } |
| | 45 | |
|
| | 46 | | } |