mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-04 03:39:55 +00:00
move debug stuff around
This commit is contained in:
parent
7e6269f8ef
commit
7d47450ae1
@ -1,6 +1,7 @@
|
||||
using QSB.Anglerfish.WorldObjects;
|
||||
using QSB.AuthoritySync;
|
||||
using QSB.Syncs.Unsectored.Rigidbodies;
|
||||
using QSB.Utility;
|
||||
using QSB.WorldSync;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
@ -65,7 +66,7 @@ namespace QSB.Anglerfish.TransformSync
|
||||
|
||||
protected override void OnRenderObject()
|
||||
{
|
||||
if (!QSBCore.ShowLinesInDebug
|
||||
if (!QSBCore.DebugSettings.DrawLines
|
||||
|| !IsInitialized
|
||||
|| AttachedRigidbody == null
|
||||
|| AttachedRigidbody.IsSuspended())
|
||||
|
@ -86,7 +86,7 @@ namespace QSB.Animation.Player.Thrusters
|
||||
|
||||
private void OnRenderObject()
|
||||
{
|
||||
if (!QSBCore.ShowLinesInDebug || !QSBWorldSync.AllObjectsReady)
|
||||
if (!QSBCore.DebugSettings.DrawLines || !QSBWorldSync.AllObjectsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ namespace QSB.JellyfishSync.TransformSync
|
||||
|
||||
protected override void OnRenderObject()
|
||||
{
|
||||
if (!QSBCore.ShowLinesInDebug
|
||||
if (!QSBCore.DebugSettings.DrawLines
|
||||
|| !IsInitialized
|
||||
|| AttachedRigidbody == null
|
||||
|| ReferenceTransform == null
|
||||
|
@ -248,7 +248,7 @@ namespace QSB.Menus
|
||||
SetButtonActive(NewGameButton, true);
|
||||
}
|
||||
|
||||
if (QSBCore.SkipTitleScreen)
|
||||
if (QSBCore.DebugSettings.SkipTitleScreen)
|
||||
{
|
||||
Application.runInBackground = true;
|
||||
var titleScreenManager = FindObjectOfType<TitleScreenManager>();
|
||||
|
@ -260,7 +260,7 @@ namespace QSB.Player.TransformSync
|
||||
|
||||
protected override void OnRenderObject()
|
||||
{
|
||||
if (!QSBCore.ShowLinesInDebug
|
||||
if (!QSBCore.DebugSettings.DrawLines
|
||||
|| !IsInitialized
|
||||
|| ReferenceTransform == null)
|
||||
{
|
||||
|
@ -46,14 +46,6 @@ namespace QSB
|
||||
public static IModUnityEvents UnityEvents => Helper.Events.Unity;
|
||||
public static string DefaultServerIP { get; private set; }
|
||||
public static int Port { get; private set; }
|
||||
public static bool DebugMode => DebugSettings.DebugMode;
|
||||
public static bool ShowLinesInDebug => DebugMode && DebugSettings.DrawLines;
|
||||
public static bool ShowQuantumVisibilityObjects => DebugMode && DebugSettings.ShowQuantumVisibilityObjects;
|
||||
public static bool ShowDebugLabels => DebugMode && DebugSettings.ShowDebugLabels;
|
||||
public static bool AvoidTimeSync => DebugMode && DebugSettings.AvoidTimeSync;
|
||||
public static bool SkipTitleScreen => DebugMode && DebugSettings.SkipTitleScreen;
|
||||
public static bool GreySkybox => DebugMode && DebugSettings.GreySkybox;
|
||||
public static bool PlayerIdInLogs => DebugMode && DebugSettings.PlayerIdInLogs;
|
||||
public static AssetBundle NetworkAssetBundle { get; internal set; }
|
||||
public static AssetBundle InstrumentAssetBundle { get; private set; }
|
||||
public static AssetBundle ConversationAssetBundle { get; private set; }
|
||||
@ -66,8 +58,7 @@ namespace QSB
|
||||
public static GamePlatform Platform { get; private set; }
|
||||
public static bool DLCInstalled => EntitlementsManager.IsDlcOwned() == EntitlementsManager.AsyncOwnershipStatus.Owned;
|
||||
public static IMenuAPI MenuApi { get; private set; }
|
||||
|
||||
private static DebugSettings DebugSettings { get; set; } = new();
|
||||
public static DebugSettings DebugSettings { get; set; } = new();
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
@ -170,17 +161,17 @@ namespace QSB
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Keyboard.current[Key.Q].isPressed && Keyboard.current[Key.D].isPressed &&
|
||||
(Keyboard.current[Key.Q].wasPressedThisFrame || Keyboard.current[Key.D].wasPressedThisFrame))
|
||||
if (Keyboard.current[Key.LeftArrow].isPressed && Keyboard.current[Key.RightArrow].isPressed &&
|
||||
(Keyboard.current[Key.LeftArrow].wasPressedThisFrame || Keyboard.current[Key.RightArrow].wasPressedThisFrame))
|
||||
{
|
||||
DebugSettings.DebugMode = !DebugSettings.DebugMode;
|
||||
|
||||
GetComponent<DebugActions>().enabled = DebugMode;
|
||||
GetComponent<DebugGUI>().enabled = DebugMode;
|
||||
GetComponent<DebugActions>().enabled = DebugSettings.DebugMode;
|
||||
GetComponent<DebugGUI>().enabled = DebugSettings.DrawGui;
|
||||
QuantumManager.UpdateFromDebugSetting();
|
||||
DebugCameraSettings.UpdateFromDebugSetting();
|
||||
|
||||
DebugLog.ToConsole($"DEBUG MODE = {DebugMode}");
|
||||
DebugLog.ToConsole($"DEBUG MODE = {DebugSettings.DebugMode}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ namespace QSB.QuantumSync
|
||||
|
||||
public void OnRenderObject()
|
||||
{
|
||||
if (!QSBCore.ShowLinesInDebug)
|
||||
if (!QSBCore.DebugSettings.DrawLines)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -132,7 +132,7 @@ namespace QSB.QuantumSync
|
||||
|
||||
public static void UpdateFromDebugSetting()
|
||||
{
|
||||
if (QSBCore.ShowQuantumVisibilityObjects)
|
||||
if (QSBCore.DebugSettings.ShowQuantumVisibilityObjects)
|
||||
{
|
||||
if (_debugSphere == null)
|
||||
{
|
||||
|
@ -254,7 +254,7 @@ namespace QSB.Syncs
|
||||
|
||||
protected virtual void OnRenderObject()
|
||||
{
|
||||
if (!QSBCore.ShowLinesInDebug
|
||||
if (!QSBCore.DebugSettings.DrawLines
|
||||
|| !IsInitialized
|
||||
|| AttachedTransform == null
|
||||
|| ReferenceTransform == null)
|
||||
@ -278,7 +278,7 @@ namespace QSB.Syncs
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
if (!QSBCore.ShowDebugLabels ||
|
||||
if (!QSBCore.DebugSettings.ShowDebugLabels ||
|
||||
Event.current.type != EventType.Repaint)
|
||||
{
|
||||
return;
|
||||
|
@ -121,7 +121,7 @@ namespace QSB.TimeSync
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!QSBCore.AvoidTimeSync)
|
||||
if (!QSBCore.DebugSettings.AvoidTimeSync)
|
||||
{
|
||||
WakeUpOrSleep();
|
||||
}
|
||||
@ -248,7 +248,7 @@ namespace QSB.TimeSync
|
||||
{
|
||||
UpdateServer();
|
||||
}
|
||||
else if (isLocalPlayer && !QSBCore.AvoidTimeSync)
|
||||
else if (isLocalPlayer && !QSBCore.DebugSettings.AvoidTimeSync)
|
||||
{
|
||||
UpdateClient();
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ namespace QSB.Tools.TranslatorTool
|
||||
|
||||
private void OnRenderObject()
|
||||
{
|
||||
if (!QSBCore.ShowLinesInDebug || !QSBWorldSync.AllObjectsReady)
|
||||
if (!QSBCore.DebugSettings.DrawLines || !QSBWorldSync.AllObjectsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ namespace QSB.Utility
|
||||
|
||||
private void DamageShipElectricalSystem() => ShipManager.Instance.ShipElectricalComponent.SetDamaged(true);
|
||||
|
||||
private void Awake() => enabled = QSBCore.DebugMode;
|
||||
private void Awake() => enabled = QSBCore.DebugSettings.DebugMode;
|
||||
|
||||
public void Update()
|
||||
{
|
||||
|
@ -6,7 +6,7 @@ namespace QSB.Utility
|
||||
{
|
||||
public static void UpdateFromDebugSetting()
|
||||
{
|
||||
if (QSBCore.GreySkybox)
|
||||
if (QSBCore.DebugSettings.GreySkybox)
|
||||
{
|
||||
QSBSceneManager.OnSceneLoaded += OnSceneLoaded;
|
||||
Camera.main.backgroundColor = Color.gray;
|
||||
|
@ -32,7 +32,7 @@ namespace QSB.Utility
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
enabled = QSBCore.DebugMode;
|
||||
enabled = QSBCore.DebugSettings.DrawGui;
|
||||
|
||||
guiGUIStyle.fontSize = 9;
|
||||
}
|
||||
@ -251,7 +251,7 @@ namespace QSB.Utility
|
||||
|
||||
private static void DrawWorldObjectLabels()
|
||||
{
|
||||
if (!QSBCore.ShowDebugLabels)
|
||||
if (!QSBCore.DebugSettings.ShowDebugLabels)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -272,7 +272,7 @@ namespace QSB.Utility
|
||||
|
||||
private static void DrawWorldObjectLines()
|
||||
{
|
||||
if (!QSBCore.ShowLinesInDebug)
|
||||
if (!QSBCore.DebugSettings.DrawLines)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ namespace QSB.Utility
|
||||
{
|
||||
public static void ToConsole(string message, MessageType type = MessageType.Message)
|
||||
{
|
||||
if (NetworkClient.localPlayer != null && QSBCore.PlayerIdInLogs)
|
||||
if (NetworkClient.localPlayer != null && QSBCore.DebugSettings.PlayerIdInLogs)
|
||||
{
|
||||
message = $"[{NetworkClient.localPlayer.netId}] " + message;
|
||||
}
|
||||
@ -37,7 +37,7 @@ namespace QSB.Utility
|
||||
|
||||
public static void DebugWrite(string message, MessageType type = MessageType.Message)
|
||||
{
|
||||
if (QSBCore.DebugMode)
|
||||
if (QSBCore.DebugSettings.DebugMode)
|
||||
{
|
||||
ToConsole(message, type);
|
||||
}
|
||||
|
@ -7,25 +7,36 @@ namespace QSB.Utility
|
||||
[JsonProperty("debugMode")]
|
||||
public bool DebugMode { get; set; }
|
||||
|
||||
[JsonProperty("drawGui")]
|
||||
private bool _drawGui;
|
||||
public bool DrawGui { get => _drawGui && DebugMode; set => _drawGui = value; }
|
||||
|
||||
[JsonProperty("drawLines")]
|
||||
public bool DrawLines { get; set; }
|
||||
private bool _drawLines;
|
||||
public bool DrawLines { get => _drawLines && DebugMode; set => _drawLines = value; }
|
||||
|
||||
[JsonProperty("showQuantumVisibilityObjects")]
|
||||
public bool ShowQuantumVisibilityObjects { get; set; }
|
||||
private bool _showQuantumVisibilityObjects;
|
||||
public bool ShowQuantumVisibilityObjects { get => _showQuantumVisibilityObjects && DebugMode; set => _showQuantumVisibilityObjects = value; }
|
||||
|
||||
[JsonProperty("showDebugLabels")]
|
||||
public bool ShowDebugLabels { get; set; }
|
||||
private bool _showDebugLabels;
|
||||
public bool ShowDebugLabels { get => _showDebugLabels && DebugMode; set => _showDebugLabels = value; }
|
||||
|
||||
[JsonProperty("avoidTimeSync")]
|
||||
public bool AvoidTimeSync { get; set; }
|
||||
private bool _avoidTimeSync;
|
||||
public bool AvoidTimeSync { get => _avoidTimeSync && DebugMode; set => _avoidTimeSync = value; }
|
||||
|
||||
[JsonProperty("skipTitleScreen")]
|
||||
public bool SkipTitleScreen { get; set; }
|
||||
private bool _skipTitleScreen;
|
||||
public bool SkipTitleScreen { get => _skipTitleScreen && DebugMode; set => _skipTitleScreen = value; }
|
||||
|
||||
[JsonProperty("greySkybox")]
|
||||
public bool GreySkybox { get; set; }
|
||||
private bool _greySkybox;
|
||||
public bool GreySkybox { get => _greySkybox && DebugMode; set => _greySkybox = value; }
|
||||
|
||||
[JsonProperty("playerIdInLogs")]
|
||||
public bool PlayerIdInLogs { get; set; }
|
||||
private bool _playerIdInLogs;
|
||||
public bool PlayerIdInLogs { get => _playerIdInLogs && DebugMode; set => _playerIdInLogs = value; }
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
"debugMode": true,
|
||||
"debugGui": true,
|
||||
"drawLines": false,
|
||||
"showQuantumVisibilityObjects": false,
|
||||
"showDebugLabels": false,
|
||||
|
Loading…
x
Reference in New Issue
Block a user