| | 1 | | using DCL.Controllers; |
| | 2 | | using DCL.ECS7.InternalComponents; |
| | 3 | | using DCL.ECSRuntime; |
| | 4 | | using DCL.Models; |
| | 5 | | using UnityEngine; |
| | 6 | |
|
| | 7 | | namespace DCL.ECSComponents |
| | 8 | | { |
| | 9 | | public class ECSVisibilityComponentHandler : IECSComponentHandler<PBVisibilityComponent> |
| | 10 | | { |
| | 11 | | private readonly IInternalECSComponent<InternalVisibility> visibilityInternalComponent; |
| | 12 | |
|
| 0 | 13 | | public ECSVisibilityComponentHandler(IInternalECSComponent<InternalVisibility> visibilityInternalComponent) |
| | 14 | | { |
| 0 | 15 | | this.visibilityInternalComponent = visibilityInternalComponent; |
| 0 | 16 | | } |
| | 17 | |
|
| 0 | 18 | | public void OnComponentCreated(IParcelScene scene, IDCLEntity entity) { } |
| | 19 | |
|
| | 20 | | public void OnComponentRemoved(IParcelScene scene, IDCLEntity entity) |
| | 21 | | { |
| 1 | 22 | | visibilityInternalComponent.RemoveFor(scene, entity, new InternalVisibility() { visible = true }); |
| 1 | 23 | | } |
| | 24 | | public void OnComponentModelUpdated(IParcelScene scene, IDCLEntity entity, PBVisibilityComponent model) |
| | 25 | | { |
| 2 | 26 | | var internalModel = new InternalVisibility() { visible = model.GetVisible() }; |
| 2 | 27 | | visibilityInternalComponent.PutFor(scene, entity, internalModel); |
| 2 | 28 | | } |
| | 29 | | } |
| | 30 | | } |