diff --git a/core/src/com/unciv/logic/civilization/Notification.kt b/core/src/com/unciv/logic/civilization/Notification.kt index 79f9cef221..8f083f3776 100644 --- a/core/src/com/unciv/logic/civilization/Notification.kt +++ b/core/src/com/unciv/logic/civilization/Notification.kt @@ -42,7 +42,7 @@ data class LocationAction(var locations: ArrayList = ArrayList()) : Not class TechAction(val techName: String = "") : NotificationAction { override fun execute(worldScreen: WorldScreen) { val tech = GameBasics.Technologies[techName] - worldScreen.game.screen = TechPickerScreen(worldScreen.viewingCiv, tech) + worldScreen.game.screen = TechPickerScreen(worldScreen.viewingCiv, true, tech) } } diff --git a/core/src/com/unciv/ui/VictoryScreen.kt b/core/src/com/unciv/ui/VictoryScreen.kt index f83a2cf52a..6833c0ee3c 100644 --- a/core/src/com/unciv/ui/VictoryScreen.kt +++ b/core/src/com/unciv/ui/VictoryScreen.kt @@ -204,7 +204,8 @@ class VictoryScreen : PickerScreen() { policyVictoryColumn.add(civToBranchesHaveCompleted).row() civToBranchesHaveCompleted.touchable= Touchable.enabled civToBranchesHaveCompleted.onClick { - game.screen = PolicyPickerScreen(UnCivGame.Current.worldScreen,entry.civ) + game.screen = PolicyPickerScreen(UnCivGame.Current.worldScreen,entry.civ,false) + dispose() } } return policyVictoryColumn @@ -227,7 +228,8 @@ class VictoryScreen : PickerScreen() { scientificVictoryColumn.add(civToPartsBeRemaining).row() civToPartsBeRemaining.touchable= Touchable.enabled civToPartsBeRemaining.onClick { - game.screen = TechPickerScreen(entry.civ) + game.screen = TechPickerScreen(entry.civ,false) + dispose() } } return scientificVictoryColumn diff --git a/core/src/com/unciv/ui/pickerscreens/PolicyPickerScreen.kt b/core/src/com/unciv/ui/pickerscreens/PolicyPickerScreen.kt index cae5d37337..fef067ba07 100644 --- a/core/src/com/unciv/ui/pickerscreens/PolicyPickerScreen.kt +++ b/core/src/com/unciv/ui/pickerscreens/PolicyPickerScreen.kt @@ -13,7 +13,7 @@ import com.unciv.ui.utils.* import com.unciv.ui.worldscreen.WorldScreen -class PolicyPickerScreen(val worldScreen: WorldScreen,civInfo: CivilizationInfo = worldScreen.viewingCiv) : PickerScreen() { +class PolicyPickerScreen(val worldScreen: WorldScreen, civInfo: CivilizationInfo = worldScreen.viewingCiv, switchfromWorldScreen: Boolean = true) : PickerScreen() { internal val viewingCiv: CivilizationInfo = civInfo private var pickedPolicy: Policy? = null @@ -42,6 +42,12 @@ class PolicyPickerScreen(val worldScreen: WorldScreen,civInfo: CivilizationInfo } if(!UnCivGame.Current.worldScreen.isPlayersTurn) rightSideButton.disable() + if (!switchfromWorldScreen){ + rightSideButton.apply { + disable() + setText("Policy Tree Of [${viewingCiv.civName}]".tr()) + } + } topTable.row().pad(30f) diff --git a/core/src/com/unciv/ui/pickerscreens/TechPickerScreen.kt b/core/src/com/unciv/ui/pickerscreens/TechPickerScreen.kt index 79abba5cfb..2989152ad4 100644 --- a/core/src/com/unciv/ui/pickerscreens/TechPickerScreen.kt +++ b/core/src/com/unciv/ui/pickerscreens/TechPickerScreen.kt @@ -16,7 +16,7 @@ import java.util.* import kotlin.collections.HashSet -class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Technology? = null) : PickerScreen() { +class TechPickerScreen(internal val civInfo: CivilizationInfo, switchfromWorldScreen: Boolean = true, centerOnTech: Technology? = null) : PickerScreen() { private var techNameToButton = HashMap() private var isFreeTechPick: Boolean = false @@ -93,8 +93,13 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Tec } setButtonsInfo() - - rightSideButton.setText("Pick a tech".tr()) + if (!switchfromWorldScreen){ + rightSideButton.apply { + disable() + setText("Tech Tree Of [${civInfo.civName}]".tr()) + } + } + else rightSideButton.setText("Pick a tech".tr()) rightSideButton.onClick("paper") { if (isFreeTechPick) civTech.getFreeTechnology(selectedTech!!.name) else civTech.techsToResearch = tempTechsToResearch @@ -110,7 +115,7 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Tec // and possibly select it to show description, // which is very helpful when just discovered and clicking the notification val tech = if (centerOnTech != null) centerOnTech else civInfo.tech.currentTechnology() - if (tech != null) { + if (tech != null && switchfromWorldScreen) { // select only if there it doesn't mess up tempTechsToResearch if (civInfo.tech.isResearched(tech.name) || civInfo.tech.techsToResearch.size <= 1) selectTechnology(tech, true) @@ -148,11 +153,14 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Tec } } - private fun selectTechnology(tech: Technology?, center: Boolean = false) { + private fun selectTechnology(tech: Technology?, center: Boolean = false, switchfromWorldScreen: Boolean = true) { selectedTech = tech descriptionLabel.setText(tech?.description) + if (switchfromWorldScreen) + return + if(tech==null) return