This commit is contained in:
2025-03-30 16:06:57 +02:00
parent e62bd2aa6d
commit 623ba3f621
148 changed files with 2773 additions and 1441 deletions

View File

@@ -0,0 +1,28 @@
using System.Threading;
using Cysharp.Threading.Tasks;
using RebootKit.Engine.UI;
using UnityEngine;
using UnityEngine.UIElements;
namespace RebootKit.Engine.Services.Development {
public class DebugOverlayView : MonoBehaviour, IView {
[SerializeField] UIDocument m_Document;
void Start() {
}
public async UniTask Show(CancellationToken cancellationToken) {
gameObject.SetActive(true);
await UniTask.Yield(cancellationToken);
}
public async UniTask Hide(CancellationToken cancellationToken) {
gameObject.SetActive(false);
await UniTask.Yield(cancellationToken);
}
void SetOverlayModeChanged(int mode) {
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f18f4d0e8d914fdca81f98faf0e1546f
timeCreated: 1743249301

View File

@@ -0,0 +1,46 @@
using System;
using Cysharp.Threading.Tasks;
using RebootKit.Engine.Foundation;
using RebootKit.Engine.Services.Console;
using UnityEngine;
namespace RebootKit.Engine.Services.Development {
static class DebugCVars {
public const string k_OverlayMode = "debug.mode";
}
public class DevToolsService : ServiceMonoBehaviour {
[SerializeField] DebugOverlayView m_DebugOverlayView;
[CVar(DebugCVars.k_OverlayMode, 1)] CVar m_OverlayMode;
IDisposable m_CVarChangedListener;
void OnEnable() {
m_CVarChangedListener = RR.CVarChanged.Listen(OnCVarChanged);
OnOverlayModeChanged(m_OverlayMode.IndexValue);
}
void OnDisable() {
Dispose();
}
public override void Dispose() {
m_CVarChangedListener.Dispose();
}
void OnOverlayModeChanged(int mode) {
if (mode == 1) {
m_DebugOverlayView.Show(destroyCancellationToken).Forget();
} else {
m_DebugOverlayView.Hide(destroyCancellationToken).Forget();
}
}
void OnCVarChanged(string cvarName, CVarValue value) {
if (cvarName == DebugCVars.k_OverlayMode) {
OnOverlayModeChanged((int)value.numberValue);
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 0ea9757c83234daaae0d4227ac495da2
timeCreated: 1743250681