From 19f9cba058b0713795e2ec631a8e879af88e43a2 Mon Sep 17 00:00:00 2001 From: SomeTroglodyte <63000004+SomeTroglodyte@users.noreply.github.com> Date: Mon, 11 Sep 2023 08:28:59 +0200 Subject: [PATCH] Allow the Space key to close Alert popups with no actual choice (#10085) --- core/src/com/unciv/ui/screens/worldscreen/AlertPopup.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/com/unciv/ui/screens/worldscreen/AlertPopup.kt b/core/src/com/unciv/ui/screens/worldscreen/AlertPopup.kt index 78c6f3ffdc..c52dccfe0e 100644 --- a/core/src/com/unciv/ui/screens/worldscreen/AlertPopup.kt +++ b/core/src/com/unciv/ui/screens/worldscreen/AlertPopup.kt @@ -9,7 +9,6 @@ import com.unciv.logic.battle.Battle import com.unciv.logic.city.City import com.unciv.logic.civilization.AlertType import com.unciv.logic.civilization.Civilization -import com.unciv.logic.civilization.LocationAction import com.unciv.logic.civilization.NotificationCategory import com.unciv.logic.civilization.PopupAlert import com.unciv.logic.civilization.diplomacy.DiplomaticModifiers @@ -64,6 +63,10 @@ class AlertPopup( private fun getCity(cityId: String) = gameInfo.getCities().first { it.id == cityId } //endregion + // This redirects all addCloseButton uses with only text and no action to accept the space key + private fun addCloseButton(text: String = Constants.close) = + addCloseButton(text, KeyboardBinding.NextTurnAlternate, null) + init { // This makes the buttons fill up available width. See comments in #9559. // To implement a middle ground, I would either simply replace growX() with minWidth(240f) or so,