Overhaul UI and overall QoL

This commit is contained in:
2026-10-22 21:59:50 +02:00
parent 2ba43fb2d3
commit ac48c24a03
31 changed files with 3181 additions and 1641 deletions
+11 -3
View File
@@ -13,8 +13,17 @@ namespace KernelPanic.UI
public void Bind(VisualElement panel, string title, string hint, Action onBack)
{
// TemplateContainer is a real layout node; hiding only its child leaves a flex slot.
if (panel.parent is TemplateContainer template)
{
template.AddToClassList("screen-slot");
template.EnableInClassList("hidden", panel.ClassListContains("hidden"));
}
_titleLabel = panel.Q<Label>(className: "screen-frame-title");
_hintLabel = panel.Q<Label>(className: "screen-frame-hint");
var back = new Button(() => onBack?.Invoke()) { text = "[Esc] back" };
back.AddToClassList("screen-back");
panel.Q(className: "screen-frame-footer")?.Insert(0, back);
if (_titleLabel != null)
{
@@ -23,8 +32,7 @@ namespace KernelPanic.UI
if (_hintLabel != null)
{
_hintLabel.text = hint;
_hintLabel.RegisterCallback<ClickEvent>(_ => onBack?.Invoke());
_hintLabel.text = hint?.Replace("[esc] back", "").Trim();
}
}
@@ -32,7 +40,7 @@ namespace KernelPanic.UI
{
if (_hintLabel != null)
{
_hintLabel.text = hint;
_hintLabel.text = hint?.Replace("[esc] back", "").Trim();
}
}