mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-25 12:54:06 -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.ui.utils.MayaCalendar
|
||||
import com.unciv.ui.utils.toPercent
|
||||
import com.unciv.ui.utils.withItem
|
||||
import com.unciv.ui.victoryscreen.RankingType
|
||||
import java.util.*
|
||||
import kotlin.NoSuchElementException
|
||||
@ -548,6 +549,8 @@ class CivilizationInfo {
|
||||
for ((key, value) in giftAmount)
|
||||
otherCiv.addStat(key, value.toInt())
|
||||
|
||||
otherCiv.exploredTiles = otherCiv.exploredTiles.withItem(getCapital().location)
|
||||
|
||||
questManager.justMet(otherCiv) // Include them in war with major pseudo-quest
|
||||
}
|
||||
|
||||
|
@ -394,6 +394,8 @@ class DiplomacyScreen(
|
||||
diplomacyTable.add(declareWarButton).row()
|
||||
}
|
||||
}
|
||||
|
||||
diplomacyTable.add(getGoToOnMapButton(otherCiv)).row()
|
||||
|
||||
val diplomaticMarriageButton = getDiplomaticMarriageButton(otherCiv)
|
||||
if (diplomaticMarriageButton != null) diplomacyTable.add(diplomaticMarriageButton).row()
|
||||
@ -746,6 +748,9 @@ class DiplomacyScreen(
|
||||
diplomacyTable.add(demandsButton).row()
|
||||
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
|
||||
diplomacyTable.add(getRelationshipTable(otherCivDiplomacyManager)).row()
|
||||
diplomacyTable.add(getDiplomacyModifiersTable(otherCivDiplomacyManager)).row()
|
||||
@ -925,6 +930,15 @@ class DiplomacyScreen(
|
||||
rightSideTable.clear()
|
||||
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) {
|
||||
super.resize(width, height)
|
||||
|
Loading…
x
Reference in New Issue
Block a user