add some additional UX to entropy exchange

This commit is contained in:
2026-07-06 23:34:13 +02:00
parent d50adb5e61
commit 99ab58b4cd
3 changed files with 64 additions and 0 deletions
+33
View File
@@ -84,6 +84,7 @@ namespace KernelPanic.UI
private Button rootCreditExchangeMaxButton;
private Button rootCreditExchangeConfirmButton;
private Button rootCreditExchangeCancelButton;
private Button rootCreditExchangeCloseButton;
private Button collectionUnitsButton;
private Button collectionLanguagesButton;
private readonly ScreenFrameController runSetupFrame = new();
@@ -214,6 +215,7 @@ namespace KernelPanic.UI
rootCreditExchangeMaxButton = root.Q<Button>("RootCreditExchangeMaxButton");
rootCreditExchangeConfirmButton = root.Q<Button>("RootCreditExchangeConfirmButton");
rootCreditExchangeCancelButton = root.Q<Button>("RootCreditExchangeCancelButton");
rootCreditExchangeCloseButton = root.Q<Button>("RootCreditExchangeCloseButton");
collectionUnitsButton = root.Q<Button>("CollectionUnitsButton");
collectionLanguagesButton = root.Q<Button>("CollectionLanguagesButton");
}
@@ -304,6 +306,16 @@ namespace KernelPanic.UI
rootCreditExchangeCancelButton.clicked += CloseRootCreditExchange;
}
if (rootCreditExchangeCloseButton != null)
{
rootCreditExchangeCloseButton.clicked += CloseRootCreditExchange;
}
if (rootCreditExchangeModal != null)
{
rootCreditExchangeModal.RegisterCallback<KeyDownEvent>(HandleRootCreditExchangeKeyDown, TrickleDown.TrickleDown);
}
collectionScreen.ViewChanged += SyncCollectionFrame;
collectionUnitsButton.RegisterCallback<ClickEvent>(HandleCollectionUnitsTabClicked);
collectionLanguagesButton.RegisterCallback<ClickEvent>(HandleCollectionLanguagesTabClicked);
@@ -363,6 +375,16 @@ namespace KernelPanic.UI
rootCreditExchangeCancelButton.clicked -= CloseRootCreditExchange;
}
if (rootCreditExchangeCloseButton != null)
{
rootCreditExchangeCloseButton.clicked -= CloseRootCreditExchange;
}
if (rootCreditExchangeModal != null)
{
rootCreditExchangeModal.UnregisterCallback<KeyDownEvent>(HandleRootCreditExchangeKeyDown, TrickleDown.TrickleDown);
}
collectionScreen.ViewChanged -= SyncCollectionFrame;
collectionUnitsButton.UnregisterCallback<ClickEvent>(HandleCollectionUnitsTabClicked);
collectionLanguagesButton.UnregisterCallback<ClickEvent>(HandleCollectionLanguagesTabClicked);
@@ -400,6 +422,17 @@ namespace KernelPanic.UI
root.Focus();
}
private void HandleRootCreditExchangeKeyDown(KeyDownEvent evt)
{
if (!rootCreditExchangeOpen || evt.keyCode != KeyCode.Escape)
{
return;
}
CloseRootCreditExchange();
evt.StopImmediatePropagation();
}
private void HandleRootCreditExchangeInputChanged(ChangeEvent<string> evt)
{
RefreshRootCreditExchange();