debug overlay mode is hidden by default

This commit is contained in:
2025-05-26 17:40:27 +02:00
parent 6bda371baa
commit 4ea7eb9aea
2 changed files with 52 additions and 53 deletions

View File

@@ -55,9 +55,9 @@ namespace RebootKitEditor.Build {
}
static bool TryParseVersion(string version, out int major, out int minor, out int patch) {
major = 0;
minor = 0;
patch = 0;
major = -1;
minor = -1;
patch = -1;
string[] parts = version.Split('.');
if (parts.Length != 3) {

View File

@@ -1,51 +1,50 @@
using System;
using RebootKit.Engine.Foundation;
using RebootKit.Engine.Services.Console;
using UnityEngine;
using UnityEngine.InputSystem;
namespace RebootKit.Engine.Services.Development {
static class DebugConfig {
[ConfigVar("debug.overlay", 1, "Controls overlay visibility. 0 - hidden, 1 - visible")] public static ConfigVar s_OverlayMode;
}
public class DevToolsService : ServiceMonoBehaviour {
[SerializeField] DebugOverlayView m_DebugOverlayView;
IDisposable m_CVarChangedListener;
void Start() {
ConfigVar.StateChanged += OnCVarChanged;
// OnOverlayModeChanged(m_OverlayMode.IndexValue);
}
void OnDisable() {
Dispose();
}
public override void Dispose() {
ConfigVar.StateChanged -= OnCVarChanged;
}
void Update() {
if (InputSystem.GetDevice<Keyboard>().f3Key.wasReleasedThisFrame) {
DebugConfig.s_OverlayMode.Set(DebugConfig.s_OverlayMode.IndexValue == 1 ? 0 : 1);
}
}
void OnOverlayModeChanged(int mode) {
if (mode == 1) {
m_DebugOverlayView.gameObject.SetActive(true);
} else {
m_DebugOverlayView.gameObject.SetActive(false);
}
}
void OnCVarChanged(ConfigVar cvar) {
if (cvar == DebugConfig.s_OverlayMode) {
OnOverlayModeChanged(cvar.IndexValue);
}
}
}
using System;
using RebootKit.Engine.Foundation;
using RebootKit.Engine.Services.Console;
using UnityEngine;
using UnityEngine.InputSystem;
namespace RebootKit.Engine.Services.Development {
static class DebugConfig {
[ConfigVar("debug.overlay", 0, "Controls overlay visibility. 0 - hidden, 1 - visible")] public static ConfigVar s_OverlayMode;
}
public class DevToolsService : ServiceMonoBehaviour {
[SerializeField] DebugOverlayView m_DebugOverlayView;
IDisposable m_CVarChangedListener;
void Start() {
ConfigVar.StateChanged += OnCVarChanged;
OnCVarChanged(DebugConfig.s_OverlayMode);
}
void OnDisable() {
Dispose();
}
public override void Dispose() {
ConfigVar.StateChanged -= OnCVarChanged;
}
void Update() {
if (InputSystem.GetDevice<Keyboard>().f3Key.wasReleasedThisFrame) {
DebugConfig.s_OverlayMode.Set(DebugConfig.s_OverlayMode.IndexValue == 1 ? 0 : 1);
}
}
void OnOverlayModeChanged(int mode) {
if (mode == 1) {
m_DebugOverlayView.gameObject.SetActive(true);
} else {
m_DebugOverlayView.gameObject.SetActive(false);
}
}
void OnCVarChanged(ConfigVar cvar) {
if (cvar == DebugConfig.s_OverlayMode) {
OnOverlayModeChanged(cvar.IndexValue);
}
}
}
}