mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 13:55:54 -04:00
Added a 'go to capital'-button in the diplomacy overview screen (#6546)
This commit is contained in:
parent
7a89c84790
commit
d3b17117da
@ -29,6 +29,7 @@ import com.unciv.models.stats.Stats
|
|||||||
import com.unciv.models.translations.tr
|
import com.unciv.models.translations.tr
|
||||||
import com.unciv.ui.utils.MayaCalendar
|
import com.unciv.ui.utils.MayaCalendar
|
||||||
import com.unciv.ui.utils.toPercent
|
import com.unciv.ui.utils.toPercent
|
||||||
|
import com.unciv.ui.utils.withItem
|
||||||
import com.unciv.ui.victoryscreen.RankingType
|
import com.unciv.ui.victoryscreen.RankingType
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.NoSuchElementException
|
import kotlin.NoSuchElementException
|
||||||
@ -548,6 +549,8 @@ class CivilizationInfo {
|
|||||||
for ((key, value) in giftAmount)
|
for ((key, value) in giftAmount)
|
||||||
otherCiv.addStat(key, value.toInt())
|
otherCiv.addStat(key, value.toInt())
|
||||||
|
|
||||||
|
otherCiv.exploredTiles = otherCiv.exploredTiles.withItem(getCapital().location)
|
||||||
|
|
||||||
questManager.justMet(otherCiv) // Include them in war with major pseudo-quest
|
questManager.justMet(otherCiv) // Include them in war with major pseudo-quest
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,6 +395,8 @@ class DiplomacyScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
diplomacyTable.add(getGoToOnMapButton(otherCiv)).row()
|
||||||
|
|
||||||
val diplomaticMarriageButton = getDiplomaticMarriageButton(otherCiv)
|
val diplomaticMarriageButton = getDiplomaticMarriageButton(otherCiv)
|
||||||
if (diplomaticMarriageButton != null) diplomacyTable.add(diplomaticMarriageButton).row()
|
if (diplomaticMarriageButton != null) diplomacyTable.add(diplomaticMarriageButton).row()
|
||||||
|
|
||||||
@ -746,6 +748,9 @@ class DiplomacyScreen(
|
|||||||
diplomacyTable.add(demandsButton).row()
|
diplomacyTable.add(demandsButton).row()
|
||||||
if (isNotPlayersTurn()) demandsButton.disable()
|
if (isNotPlayersTurn()) demandsButton.disable()
|
||||||
|
|
||||||
|
if (otherCiv.getCapital().location in viewingCiv.exploredTiles)
|
||||||
|
diplomacyTable.add(getGoToOnMapButton(otherCiv)).row()
|
||||||
|
|
||||||
if (!otherCiv.isPlayerCivilization()) { // human players make their own choices
|
if (!otherCiv.isPlayerCivilization()) { // human players make their own choices
|
||||||
diplomacyTable.add(getRelationshipTable(otherCivDiplomacyManager)).row()
|
diplomacyTable.add(getRelationshipTable(otherCivDiplomacyManager)).row()
|
||||||
diplomacyTable.add(getDiplomacyModifiersTable(otherCivDiplomacyManager)).row()
|
diplomacyTable.add(getDiplomacyModifiersTable(otherCivDiplomacyManager)).row()
|
||||||
@ -926,6 +931,15 @@ class DiplomacyScreen(
|
|||||||
rightSideTable.add(diplomacyTable)
|
rightSideTable.add(diplomacyTable)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun getGoToOnMapButton(civilization: CivilizationInfo): TextButton {
|
||||||
|
val goToOnMapButton = TextButton("Go To on Map", skin)
|
||||||
|
goToOnMapButton.onClick {
|
||||||
|
UncivGame.Current.setWorldScreen()
|
||||||
|
UncivGame.Current.worldScreen.mapHolder.setCenterPosition(civilization.getCapital().location, selectUnit = false)
|
||||||
|
}
|
||||||
|
return goToOnMapButton
|
||||||
|
}
|
||||||
|
|
||||||
override fun resize(width: Int, height: Int) {
|
override fun resize(width: Int, height: Int) {
|
||||||
super.resize(width, height)
|
super.resize(width, height)
|
||||||
positionCloseButton()
|
positionCloseButton()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user