Trigger a button sound when saving a game with enter

This commit is contained in:
Gustas
2023-07-26 13:16:31 +03:00
committed by Matthias Mailänder
parent f99db8d754
commit 54547a11d0

View File

@@ -117,17 +117,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
saveButton.IsVisible = () => true;
var saveWidgets = panel.Get("SAVE_WIDGETS");
saveTextField = saveWidgets.Get<TextFieldWidget>("SAVE_TEXTFIELD");
gameList.Bounds.Height -= saveWidgets.Bounds.Height;
saveWidgets.IsVisible = () => true;
saveTextField.OnEnterKey = _ =>
{
if (!string.IsNullOrWhiteSpace(saveTextField.Text))
Save(world);
return true;
};
saveTextField = saveWidgets.Get<TextFieldWidget>("SAVE_TEXTFIELD");
saveTextField.OnEnterKey = input => saveButton.HandleKeyPress(input);
}
else
{