| | 1 | | using System.Collections; |
| | 2 | | using System.Collections.Generic; |
| | 3 | | using DCL; |
| | 4 | | using DCL.Controllers; |
| | 5 | | using DCL.Models; |
| | 6 | | using UnityEngine; |
| | 7 | |
|
| | 8 | | public class BiwSceneMetricsAnalyticsHelper |
| | 9 | | { |
| 1 | 10 | | private string currentExceededLimitTypes = ""; |
| | 11 | |
|
| | 12 | | private IParcelScene scene; |
| | 13 | |
|
| 1 | 14 | | public BiwSceneMetricsAnalyticsHelper(IParcelScene sceneOwner) |
| | 15 | | { |
| 1 | 16 | | this.scene = sceneOwner; |
| 1 | 17 | | scene.metricsCounter.OnMetricsUpdated += OnMetricsUpdated; |
| 1 | 18 | | } |
| | 19 | |
|
| | 20 | | public void Dispose() |
| | 21 | | { |
| 1 | 22 | | scene.metricsCounter.OnMetricsUpdated -= OnMetricsUpdated; |
| 1 | 23 | | } |
| | 24 | |
|
| | 25 | | private void OnMetricsUpdated(ISceneMetricsCounter obj) |
| | 26 | | { |
| 0 | 27 | | SendSceneLimitExceededAnalyticsEvent(); |
| 0 | 28 | | } |
| | 29 | |
|
| | 30 | | private void SendSceneLimitExceededAnalyticsEvent() |
| | 31 | | { |
| 0 | 32 | | if (scene.metricsCounter.IsInsideTheLimits()) |
| | 33 | | { |
| 0 | 34 | | currentExceededLimitTypes = ""; |
| 0 | 35 | | return; |
| | 36 | | } |
| | 37 | |
|
| 0 | 38 | | var metricsModel = scene.metricsCounter.currentCount; |
| 0 | 39 | | var metricsLimits = scene.metricsCounter.maxCount; |
| | 40 | |
|
| 0 | 41 | | string exceededLimits = BIWAnalytics.GetLimitsPassedArray(metricsModel, metricsLimits); |
| | 42 | |
|
| 0 | 43 | | if (exceededLimits != currentExceededLimitTypes) |
| | 44 | | { |
| 0 | 45 | | BIWAnalytics.SceneLimitsExceeded(metricsModel, metricsLimits); |
| 0 | 46 | | currentExceededLimitTypes = exceededLimits; |
| | 47 | | } |
| 0 | 48 | | } |
| | 49 | | } |