debug overlay mode is hidden by default
This commit is contained in:
@@ -55,9 +55,9 @@ namespace RebootKitEditor.Build {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool TryParseVersion(string version, out int major, out int minor, out int patch) {
|
static bool TryParseVersion(string version, out int major, out int minor, out int patch) {
|
||||||
major = 0;
|
major = -1;
|
||||||
minor = 0;
|
minor = -1;
|
||||||
patch = 0;
|
patch = -1;
|
||||||
|
|
||||||
string[] parts = version.Split('.');
|
string[] parts = version.Split('.');
|
||||||
if (parts.Length != 3) {
|
if (parts.Length != 3) {
|
||||||
|
|||||||
@@ -1,51 +1,50 @@
|
|||||||
using System;
|
using System;
|
||||||
using RebootKit.Engine.Foundation;
|
using RebootKit.Engine.Foundation;
|
||||||
using RebootKit.Engine.Services.Console;
|
using RebootKit.Engine.Services.Console;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.InputSystem;
|
using UnityEngine.InputSystem;
|
||||||
|
|
||||||
namespace RebootKit.Engine.Services.Development {
|
namespace RebootKit.Engine.Services.Development {
|
||||||
static class DebugConfig {
|
static class DebugConfig {
|
||||||
[ConfigVar("debug.overlay", 1, "Controls overlay visibility. 0 - hidden, 1 - visible")] public static ConfigVar s_OverlayMode;
|
[ConfigVar("debug.overlay", 0, "Controls overlay visibility. 0 - hidden, 1 - visible")] public static ConfigVar s_OverlayMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DevToolsService : ServiceMonoBehaviour {
|
public class DevToolsService : ServiceMonoBehaviour {
|
||||||
[SerializeField] DebugOverlayView m_DebugOverlayView;
|
[SerializeField] DebugOverlayView m_DebugOverlayView;
|
||||||
|
|
||||||
|
IDisposable m_CVarChangedListener;
|
||||||
IDisposable m_CVarChangedListener;
|
|
||||||
|
void Start() {
|
||||||
void Start() {
|
ConfigVar.StateChanged += OnCVarChanged;
|
||||||
ConfigVar.StateChanged += OnCVarChanged;
|
OnCVarChanged(DebugConfig.s_OverlayMode);
|
||||||
// OnOverlayModeChanged(m_OverlayMode.IndexValue);
|
}
|
||||||
}
|
|
||||||
|
void OnDisable() {
|
||||||
void OnDisable() {
|
Dispose();
|
||||||
Dispose();
|
}
|
||||||
}
|
|
||||||
|
public override void Dispose() {
|
||||||
public override void Dispose() {
|
ConfigVar.StateChanged -= OnCVarChanged;
|
||||||
ConfigVar.StateChanged -= OnCVarChanged;
|
}
|
||||||
}
|
|
||||||
|
void Update() {
|
||||||
void Update() {
|
if (InputSystem.GetDevice<Keyboard>().f3Key.wasReleasedThisFrame) {
|
||||||
if (InputSystem.GetDevice<Keyboard>().f3Key.wasReleasedThisFrame) {
|
DebugConfig.s_OverlayMode.Set(DebugConfig.s_OverlayMode.IndexValue == 1 ? 0 : 1);
|
||||||
DebugConfig.s_OverlayMode.Set(DebugConfig.s_OverlayMode.IndexValue == 1 ? 0 : 1);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
void OnOverlayModeChanged(int mode) {
|
||||||
void OnOverlayModeChanged(int mode) {
|
if (mode == 1) {
|
||||||
if (mode == 1) {
|
m_DebugOverlayView.gameObject.SetActive(true);
|
||||||
m_DebugOverlayView.gameObject.SetActive(true);
|
} else {
|
||||||
} else {
|
m_DebugOverlayView.gameObject.SetActive(false);
|
||||||
m_DebugOverlayView.gameObject.SetActive(false);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
void OnCVarChanged(ConfigVar cvar) {
|
||||||
void OnCVarChanged(ConfigVar cvar) {
|
if (cvar == DebugConfig.s_OverlayMode) {
|
||||||
if (cvar == DebugConfig.s_OverlayMode) {
|
OnOverlayModeChanged(cvar.IndexValue);
|
||||||
OnOverlayModeChanged(cvar.IndexValue);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user