| | 1 | | using DCL; |
| | 2 | | using DCL.Controllers; |
| | 3 | | using DCL.Models; |
| | 4 | |
|
| | 5 | | namespace Builder |
| | 6 | | { |
| | 7 | | public class DCLBuilderSceneMetricsController : SceneMetricsController |
| | 8 | | { |
| 2 | 9 | | public DCLBuilderSceneMetricsController(ParcelScene sceneOwner) : base(sceneOwner) |
| | 10 | | { |
| 2 | 11 | | Enable(); |
| 2 | 12 | | isDirty = true; |
| 2 | 13 | | } |
| | 14 | |
|
| | 15 | | protected override void OnEntityAdded(IDCLEntity e) |
| | 16 | | { |
| 1 | 17 | | e.OnMeshesInfoUpdated += OnEntityMeshInfoUpdated; |
| 1 | 18 | | e.OnMeshesInfoCleaned += OnEntityMeshInfoCleaned; |
| 1 | 19 | | } |
| | 20 | |
|
| | 21 | | protected override void OnEntityRemoved(IDCLEntity e) |
| | 22 | | { |
| 1 | 23 | | e.OnMeshesInfoUpdated -= OnEntityMeshInfoUpdated; |
| 1 | 24 | | e.OnMeshesInfoCleaned -= OnEntityMeshInfoCleaned; |
| | 25 | |
|
| 1 | 26 | | if (!e.components.ContainsKey(CLASS_ID_COMPONENT.SMART_ITEM)) |
| | 27 | | { |
| 1 | 28 | | SubstractMetrics(e); |
| 1 | 29 | | model.entities = entitiesMetrics.Count; |
| | 30 | | } |
| 1 | 31 | | } |
| | 32 | |
|
| | 33 | | protected override void OnEntityMeshInfoUpdated(IDCLEntity entity) |
| | 34 | | { |
| | 35 | | //builder should only check scene limits for not smart items entities |
| 2 | 36 | | if (!entity.components.ContainsKey(CLASS_ID_COMPONENT.SMART_ITEM)) |
| | 37 | | { |
| 2 | 38 | | AddOrReplaceMetrics(entity); |
| 2 | 39 | | model.entities = entitiesMetrics.Count; |
| 2 | 40 | | } |
| | 41 | | else |
| | 42 | | { |
| 0 | 43 | | SubstractMetrics(entity); |
| 0 | 44 | | model.entities = entitiesMetrics.Count; |
| | 45 | | } |
| 0 | 46 | | } |
| | 47 | | } |
| | 48 | | } |