This commit is contained in:
2025-04-14 23:22:38 +02:00
parent 72b8a37345
commit 1e190fe94b
166 changed files with 2989 additions and 687 deletions

View File

@@ -1,28 +1,39 @@
using System.Threading;
using Cysharp.Threading.Tasks;
using System;
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);
}
public class DebugOverlayView : UIDocumentView {
const string k_DebugLabelClassName = "rr__debug-label";
void SetOverlayModeChanged(int mode) {
VisualElement m_RootElement;
Label m_FPSLabel;
void Update() {
if (m_RootElement == null) {
return;
}
m_FPSLabel.text = $"fps: {Mathf.RoundToInt(1f / Time.deltaTime)} | dt: {Time.deltaTime:F4}ms | runtime: {Time.time:F4}s";
}
public override VisualElement Build() {
m_RootElement = new VisualElement();
CreateLabel($"Toggle Overlay [F3] | RebootKit | game: {Application.productName}, version: {Application.version}");
m_FPSLabel = CreateLabel($"FPS: {Application.targetFrameRate}");
return m_RootElement;
}
Label CreateLabel(string text) {
Label label = (Label)LabelBuilder.New(text).Build();
label.AddToClassList(k_DebugLabelClassName);
m_RootElement.Add(label);
return label;
}
}
}