From 9e6e157835846974df8188517f2efd960cc28513 Mon Sep 17 00:00:00 2001 From: Oskar Niesen Date: Tue, 4 Jun 2024 10:02:01 -0500 Subject: [PATCH] Added an option to disable move by long press (#11681) * Added an option to disable move by long press * Moved setting check to tileGroup.onActivation and changed it to check for longTapMove * Added translation --- android/assets/jsons/translations/template.properties | 1 + core/src/com/unciv/models/metadata/GameSettings.kt | 1 + core/src/com/unciv/ui/popups/options/GameplayTab.kt | 1 + core/src/com/unciv/ui/screens/worldscreen/WorldMapHolder.kt | 1 + 4 files changed, 4 insertions(+) diff --git a/android/assets/jsons/translations/template.properties b/android/assets/jsons/translations/template.properties index 4b2661756a..db9e7542e7 100644 --- a/android/assets/jsons/translations/template.properties +++ b/android/assets/jsons/translations/template.properties @@ -801,6 +801,7 @@ Gameplay = Check for idle units = Auto Unit Cycle = Move units with a single tap = +Move units with a long tap = Auto-assign city production = Auto-build roads = Automated workers replace improvements = diff --git a/core/src/com/unciv/models/metadata/GameSettings.kt b/core/src/com/unciv/models/metadata/GameSettings.kt index a1d473b5dc..e069176690 100644 --- a/core/src/com/unciv/models/metadata/GameSettings.kt +++ b/core/src/com/unciv/models/metadata/GameSettings.kt @@ -36,6 +36,7 @@ class GameSettings { var checkForDueUnits: Boolean = true var autoUnitCycle: Boolean = true var singleTapMove: Boolean = false + var longTapMove: Boolean = true var language: String = Constants.english @Transient var locale: Locale? = null diff --git a/core/src/com/unciv/ui/popups/options/GameplayTab.kt b/core/src/com/unciv/ui/popups/options/GameplayTab.kt index dad150db6a..0ced8386f7 100644 --- a/core/src/com/unciv/ui/popups/options/GameplayTab.kt +++ b/core/src/com/unciv/ui/popups/options/GameplayTab.kt @@ -19,6 +19,7 @@ fun gameplayTab( optionsPopup.addCheckbox(this, "Check for idle units", settings.checkForDueUnits, true) { settings.checkForDueUnits = it } optionsPopup.addCheckbox(this, "Auto Unit Cycle", settings.autoUnitCycle, true) { settings.autoUnitCycle = it } optionsPopup.addCheckbox(this, "Move units with a single tap", settings.singleTapMove) { settings.singleTapMove = it } + optionsPopup.addCheckbox(this, "Move units with a long tap", settings.longTapMove) { settings.longTapMove = it } optionsPopup.addCheckbox(this, "Auto-assign city production", settings.autoAssignCityProduction, true) { shouldAutoAssignCityProduction -> settings.autoAssignCityProduction = shouldAutoAssignCityProduction val worldScreen = GUI.getWorldScreenIfActive() diff --git a/core/src/com/unciv/ui/screens/worldscreen/WorldMapHolder.kt b/core/src/com/unciv/ui/screens/worldscreen/WorldMapHolder.kt index f316a599d1..f1c78e82d1 100644 --- a/core/src/com/unciv/ui/screens/worldscreen/WorldMapHolder.kt +++ b/core/src/com/unciv/ui/screens/worldscreen/WorldMapHolder.kt @@ -149,6 +149,7 @@ class WorldMapHolder( ActivationTypes.Longpress else ActivationTypes.RightClick, noEquivalence = true ) { + if (!UncivGame.Current.settings.longTapMove) return@onActivation val unit = worldScreen.bottomUnitTable.selectedUnit ?: return@onActivation Concurrency.run("WorldScreenClick") {