disable and enable debug stuff

This commit is contained in:
JohnCorby 2022-01-18 16:19:49 -08:00
parent ae90014137
commit a9ed275eb8
3 changed files with 23 additions and 18 deletions

View File

@ -14,8 +14,10 @@ using QSB.StatueSync;
using QSB.TimeSync; using QSB.TimeSync;
using QSB.Utility; using QSB.Utility;
using QSB.WorldSync; using QSB.WorldSync;
using System;
using System.Linq; using System.Linq;
using UnityEngine; using UnityEngine;
using UnityEngine.InputSystem;
/* /*
Copyright (C) 2020 - 2021 Copyright (C) 2020 - 2021
@ -150,14 +152,20 @@ namespace QSB
} }
} }
public static void ToggleDebug() private void Update()
{ {
DebugSettings.DebugMode = !DebugSettings.DebugMode; if (Keyboard.current[Key.Q].isPressed && Keyboard.current[Key.D].isPressed &&
(Keyboard.current[Key.Q].wasPressedThisFrame || Keyboard.current[Key.D].wasPressedThisFrame))
{
DebugSettings.DebugMode = !DebugSettings.DebugMode;
QuantumManager.UpdateFromDebugSetting(); GetComponent<DebugActions>().enabled = DebugMode;
DebugCameraSettings.UpdateFromDebugSetting(); GetComponent<DebugGUI>().enabled = DebugMode;
QuantumManager.UpdateFromDebugSetting();
DebugCameraSettings.UpdateFromDebugSetting();
DebugLog.ToConsole($"DEBUG MODE = {DebugMode}"); DebugLog.ToConsole($"DEBUG MODE = {DebugMode}");
}
} }
} }
} }

View File

@ -2,6 +2,7 @@
using QSB.Player; using QSB.Player;
using QSB.ShipSync; using QSB.ShipSync;
using QSB.Utility.Messages; using QSB.Utility.Messages;
using System;
using System.Linq; using System.Linq;
using UnityEngine; using UnityEngine;
using UnityEngine.InputSystem; using UnityEngine.InputSystem;
@ -31,18 +32,10 @@ namespace QSB.Utility
private void DamageShipElectricalSystem() => ShipManager.Instance.ShipElectricalComponent.SetDamaged(true); private void DamageShipElectricalSystem() => ShipManager.Instance.ShipElectricalComponent.SetDamaged(true);
private void Awake() => enabled = QSBCore.DebugMode;
public void Update() public void Update()
{ {
if (Keyboard.current[Key.Q].isPressed && Keyboard.current[Key.D].wasPressedThisFrame)
{
QSBCore.ToggleDebug();
}
if (!QSBCore.DebugMode)
{
return;
}
/* /*
* 1 - Warp to first non local player * 1 - Warp to first non local player
* 2 - Set time flowing * 2 - Set time flowing

View File

@ -30,7 +30,12 @@ namespace QSB.Utility
private readonly GUIStyle guiGUIStyle = new(); private readonly GUIStyle guiGUIStyle = new();
private static readonly GUIStyle labelGUIStyle = new(); private static readonly GUIStyle labelGUIStyle = new();
private void Awake() => guiGUIStyle.fontSize = 9; private void Awake()
{
enabled = QSBCore.DebugMode;
guiGUIStyle.fontSize = 9;
}
private void WriteLine(int columnID, string text) private void WriteLine(int columnID, string text)
{ {
@ -72,8 +77,7 @@ namespace QSB.Utility
public void OnGUI() public void OnGUI()
{ {
if (!QSBCore.DebugMode || if (Event.current.type != EventType.Repaint)
Event.current.type != EventType.Repaint)
{ {
return; return;
} }