< Summary

Class:DCL.DebugController
Assembly:DebugController
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/DebugController/DebugController.cs
Covered lines:22
Uncovered lines:20
Coverable lines:42
Total lines:101
Line coverage:52.3% (22 of 42)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
DebugController(...)0%110100%
SetDebug()0%220100%
HideFPSPanel()0%220100%
ShowFPSPanel()0%220100%
SetSceneDebugPanel()0%6200%
SetEngineDebugPanel()0%6200%
RunPerformanceMeterTool(...)0%2100%
InstantiateBotsAtWorldPos(...)0%2100%
InstantiateBotsAtCoords(...)0%2100%
RemoveBot(...)0%2100%
ClearBots()0%2100%
GetTrackedTeleportPositions()0%2100%
GetTrackedMovements()0%2100%
Dispose()0%220100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/DebugController/DebugController.cs

#LineLine coverage
 1using System;
 2using DCL.Bots;
 3using System.Collections.Generic;
 4using DCL.Helpers;
 5using DCL.Interface;
 6using UnityEngine.UI;
 7using UnityEngine;
 8using Object = UnityEngine.Object;
 9
 10namespace DCL
 11{
 12    public class DebugController : IDebugController
 13    {
 014        private DebugConfig debugConfig => DataStore.i.debugConfig;
 53115        private readonly PerformanceMeterController performanceMeterController = new PerformanceMeterController();
 16        private readonly IBotsController botsController;
 17
 18        public DebugView debugView;
 19
 20        public readonly CrashPayloadPositionTracker positionTracker;
 21
 22        public event Action OnDebugModeSet;
 23
 53124        public DebugController(IBotsController botsController)
 25        {
 53126            positionTracker = new CrashPayloadPositionTracker();
 27
 53128            GameObject view = Object.Instantiate(UnityEngine.Resources.Load("DebugView")) as GameObject;
 53129            debugView = view.GetComponent<DebugView>();
 53130            this.botsController = botsController;
 53131        }
 32
 33        public void SetDebug()
 34        {
 1035            Debug.unityLogger.logEnabled = true;
 36
 1037            debugConfig.isDebugMode = true;
 38
 1039            ShowFPSPanel();
 40
 1041            OnDebugModeSet?.Invoke();
 1042        }
 43
 44        public void HideFPSPanel()
 45        {
 146            if (debugView != null)
 147                debugView.HideFPSPanel();
 148        }
 49
 50        public void ShowFPSPanel()
 51        {
 1052            if (debugView != null)
 1053                debugView.ShowFPSPanel();
 1054        }
 55
 56        public void SetSceneDebugPanel()
 57        {
 058            if (debugView != null)
 059                debugView.SetSceneDebugPanel();
 060        }
 61
 62        public void SetEngineDebugPanel()
 63        {
 064            if (debugView != null)
 065                debugView.SetEngineDebugPanel();
 066        }
 67
 068        public void RunPerformanceMeterTool(float durationInSeconds) { performanceMeterController.StartSampling(duration
 69
 70        public void InstantiateBotsAtWorldPos(string configJson)
 71        {
 072            var config = new DCL.Bots.WorldPosInstantiationConfig();
 073            JsonUtility.FromJsonOverwrite(configJson, config);
 74
 075            CoroutineStarter.Start(botsController.InstantiateBotsAtWorldPos(config));
 076        }
 77
 78        public void InstantiateBotsAtCoords(string configJson)
 79        {
 080            var config = new DCL.Bots.CoordsInstantiationConfig();
 081            JsonUtility.FromJsonOverwrite(configJson, config);
 82
 083            CoroutineStarter.Start(botsController.InstantiateBotsAtCoords(config));
 084        }
 85
 086        public void RemoveBot(string targetEntityId) { botsController.RemoveBot(targetEntityId); }
 87
 088        public void ClearBots() { botsController.ClearBots(); }
 89
 090        public List<Vector3> GetTrackedTeleportPositions() { return positionTracker.teleportPositions; }
 91
 092        public List<Vector3> GetTrackedMovements() { return positionTracker.movePositions; }
 93
 94        public void Dispose()
 95        {
 53796            positionTracker.Dispose();
 53797            if (debugView != null)
 53198                Object.Destroy(debugView.gameObject);
 53799        }
 100    }
 101}