mirror of
https://github.com/yairm210/Unciv.git
synced 2025-03-03 22:22:51 +07:00
Added display of Human / AI for othe civs
This commit is contained in:
parent
05e4e33a3d
commit
327eea7b13
@ -21,8 +21,8 @@ android {
|
||||
applicationId "com.unciv.app"
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 28
|
||||
versionCode 283
|
||||
versionName "2.19.2"
|
||||
versionCode 284
|
||||
versionName "2.19.3"
|
||||
}
|
||||
|
||||
// Had to add this crap for Travis to build, it wanted to sign the app
|
||||
|
@ -167,6 +167,8 @@ class CivilizationInfo {
|
||||
|
||||
fun containsBuildingUnique(unique:String) = cities.any { it.containsBuildingUnique(unique) }
|
||||
|
||||
|
||||
//region Units
|
||||
fun getCivUnits(): List<MapUnit> = units
|
||||
|
||||
fun addUnit(mapUnit: MapUnit, updateCivInfo:Boolean=true){
|
||||
@ -194,9 +196,6 @@ class CivilizationInfo {
|
||||
|
||||
fun getDueUnits() = getCivUnits().filter { it.due && it.isIdle() }
|
||||
|
||||
fun shouldOpenTechPicker() = tech.freeTechs != 0
|
||||
|| tech.currentTechnology()==null && cities.isNotEmpty()
|
||||
|
||||
fun shouldGoToDueUnit() = UnCivGame.Current.settings.checkForDueUnits && getDueUnits().isNotEmpty()
|
||||
|
||||
fun getNextDueUnit(): MapUnit? {
|
||||
@ -208,6 +207,12 @@ class CivilizationInfo {
|
||||
}
|
||||
return null
|
||||
}
|
||||
//endregion
|
||||
|
||||
fun shouldOpenTechPicker() = tech.freeTechs != 0
|
||||
|| tech.currentTechnology()==null && cities.isNotEmpty()
|
||||
|
||||
|
||||
|
||||
fun getEquivalentBuilding(buildingName:String): Building {
|
||||
val baseBuilding = GameBasics.Buildings[buildingName]!!.getBaseBuilding()
|
||||
@ -232,7 +237,7 @@ class CivilizationInfo {
|
||||
|
||||
override fun toString(): String {return civName} // for debug
|
||||
|
||||
fun isDefeated()= cities.isEmpty() && (citiesCreated > 0 || !getCivUnits().any{it.name== Constants.settler})
|
||||
fun isDefeated()= cities.isEmpty() && (citiesCreated > 0 || !getCivUnits().any {it.name== Constants.settler})
|
||||
|
||||
fun getEra(): TechEra {
|
||||
val maxEraOfTech = tech.researchedTechnologies
|
||||
@ -251,6 +256,16 @@ class CivilizationInfo {
|
||||
}
|
||||
|
||||
fun isAtWar() = diplomacy.values.any { it.diplomaticStatus== DiplomaticStatus.War && !it.otherCiv().isDefeated() }
|
||||
|
||||
fun getLeaderDisplayName(): String {
|
||||
var leaderName = getTranslatedNation().getLeaderDisplayName()
|
||||
if (playerType == PlayerType.AI)
|
||||
leaderName += " (" + "AI".tr() + ")"
|
||||
else if (gameInfo.civilizations.count { it.playerType == PlayerType.Human } > 1)
|
||||
leaderName += " (" + "Human".tr() + " - " + "Hotseat".tr() + ")"
|
||||
else leaderName += " (" + "Human".tr() + " - " + UnCivGame.Current.settings.userName + ")"
|
||||
return leaderName
|
||||
}
|
||||
//endregion
|
||||
|
||||
//region state-changing functions
|
||||
|
@ -95,7 +95,7 @@ class DiplomacyScreen:CameraStageBaseScreen() {
|
||||
|
||||
val diplomacyTable = Table()
|
||||
diplomacyTable.defaults().pad(10f)
|
||||
diplomacyTable.add(otherCiv.getNation().getLeaderDisplayName().toLabel()).row()
|
||||
diplomacyTable.add(otherCiv.getLeaderDisplayName().toLabel().setFontSize(24)).row()
|
||||
diplomacyTable.add(("Type: " + otherCiv.getCityStateType().toString()).toLabel()).row()
|
||||
diplomacyTable.add(("Influence: " + otherCivDiplomacyManager.influence.toInt() + "/30").toLabel()).row()
|
||||
|
||||
@ -161,8 +161,8 @@ class DiplomacyScreen:CameraStageBaseScreen() {
|
||||
val diplomacyTable = Table()
|
||||
diplomacyTable.defaults().pad(10f)
|
||||
|
||||
diplomacyTable.add(otherCiv.getLeaderDisplayName().toLabel().setFontSize(24)).row()
|
||||
val translatedNation = otherCiv.getTranslatedNation()
|
||||
diplomacyTable.add(translatedNation.getLeaderDisplayName().toLabel().setFontSize(24)).row()
|
||||
if(otherCivDiplomacyManager.relationshipLevel()<=RelationshipLevel.Enemy)
|
||||
diplomacyTable.add(translatedNation.hateHello.toLabel()).row()
|
||||
else
|
||||
@ -328,7 +328,7 @@ class DiplomacyScreen:CameraStageBaseScreen() {
|
||||
private fun setRightSideFlavorText(otherCiv: CivilizationInfo, flavorText:String, response: String){
|
||||
val diplomacyTable = Table()
|
||||
diplomacyTable.defaults().pad(10f)
|
||||
diplomacyTable.add(otherCiv.getNation().getLeaderDisplayName().toLabel())
|
||||
diplomacyTable.add(otherCiv.getLeaderDisplayName().toLabel())
|
||||
diplomacyTable.addSeparator()
|
||||
diplomacyTable.add(flavorText.toLabel()).row()
|
||||
|
||||
|
@ -3,8 +3,8 @@ package com.unciv.ui.worldscreen
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
|
||||
import com.unciv.logic.civilization.AlertType
|
||||
import com.unciv.logic.civilization.CivilizationInfo
|
||||
import com.unciv.logic.civilization.PopupAlert
|
||||
import com.unciv.models.gamebasics.Nation
|
||||
import com.unciv.models.gamebasics.tr
|
||||
import com.unciv.ui.utils.addSeparator
|
||||
import com.unciv.ui.utils.onClick
|
||||
@ -22,8 +22,8 @@ class AlertPopup(val worldScreen: WorldScreen, val popupAlert: PopupAlert): Popu
|
||||
return button
|
||||
}
|
||||
|
||||
fun addLeaderName(translatedNation: Nation){
|
||||
val otherCivLeaderName = translatedNation.getLeaderDisplayName()
|
||||
fun addLeaderName(civInfo : CivilizationInfo){
|
||||
val otherCivLeaderName = civInfo.getLeaderDisplayName()
|
||||
add(otherCivLeaderName.toLabel())
|
||||
addSeparator()
|
||||
}
|
||||
@ -32,29 +32,29 @@ class AlertPopup(val worldScreen: WorldScreen, val popupAlert: PopupAlert): Popu
|
||||
|
||||
when(popupAlert.type){
|
||||
AlertType.WarDeclaration -> {
|
||||
val translatedNation = worldScreen.gameInfo.getCivilization(popupAlert.value).getTranslatedNation()
|
||||
addLeaderName(translatedNation)
|
||||
addGoodSizedLabel(translatedNation.declaringWar).row()
|
||||
val civInfo = worldScreen.gameInfo.getCivilization(popupAlert.value)
|
||||
addLeaderName(civInfo)
|
||||
addGoodSizedLabel(civInfo.getTranslatedNation().declaringWar).row()
|
||||
val responseTable = Table()
|
||||
responseTable.add(getCloseButton("You'll pay for this!"))
|
||||
responseTable.add(getCloseButton("Very well."))
|
||||
add(responseTable)
|
||||
}
|
||||
AlertType.Defeated -> {
|
||||
val translatedNation = worldScreen.gameInfo.getCivilization(popupAlert.value).getTranslatedNation()
|
||||
addLeaderName(translatedNation)
|
||||
addGoodSizedLabel(translatedNation.defeated).row()
|
||||
val civInfo = worldScreen.gameInfo.getCivilization(popupAlert.value)
|
||||
addLeaderName(civInfo)
|
||||
addGoodSizedLabel(civInfo.getTranslatedNation().defeated).row()
|
||||
add(getCloseButton("Farewell."))
|
||||
}
|
||||
AlertType.FirstContact -> {
|
||||
val civ = worldScreen.gameInfo.getCivilization(popupAlert.value)
|
||||
val translatedNation = civ.getTranslatedNation()
|
||||
if (civ.isCityState()) {
|
||||
addLeaderName(translatedNation)
|
||||
val civInfo = worldScreen.gameInfo.getCivilization(popupAlert.value)
|
||||
val translatedNation = civInfo.getTranslatedNation()
|
||||
if (civInfo.isCityState()) {
|
||||
addLeaderName(civInfo)
|
||||
addGoodSizedLabel("We have encountered the City-State of [${translatedNation.getNameTranslation()}]!").row()
|
||||
add(getCloseButton("Excellent!"))
|
||||
} else {
|
||||
addLeaderName(translatedNation)
|
||||
addLeaderName(civInfo)
|
||||
addGoodSizedLabel(translatedNation.introduction).row()
|
||||
add(getCloseButton("A pleasure to meet you."))
|
||||
}
|
||||
@ -69,8 +69,8 @@ class AlertPopup(val worldScreen: WorldScreen, val popupAlert: PopupAlert): Popu
|
||||
})
|
||||
}
|
||||
AlertType.BorderConflict -> {
|
||||
val translatedNation = worldScreen.gameInfo.getCivilization(popupAlert.value).getTranslatedNation()
|
||||
addLeaderName(translatedNation)
|
||||
val civInfo = worldScreen.gameInfo.getCivilization(popupAlert.value)
|
||||
addLeaderName(civInfo)
|
||||
addGoodSizedLabel("Remove your troops in our border immediately!").row()
|
||||
val responseTable = Table()
|
||||
responseTable.add(getCloseButton("Sorry."))
|
||||
@ -81,7 +81,7 @@ class AlertPopup(val worldScreen: WorldScreen, val popupAlert: PopupAlert): Popu
|
||||
val otherciv= worldScreen.gameInfo.getCivilization(popupAlert.value)
|
||||
val playerDiploManager = worldScreen.viewingCiv.getDiplomacyManager(otherciv)
|
||||
val translatedNation = otherciv.getTranslatedNation()
|
||||
addLeaderName(translatedNation)
|
||||
addLeaderName(otherciv)
|
||||
addGoodSizedLabel("Please don't settle new cities near us.").row()
|
||||
add(getCloseButton("Very well, we shall look for new lands to settle."){
|
||||
playerDiploManager.agreeNotToSettleNear()
|
||||
@ -92,8 +92,7 @@ class AlertPopup(val worldScreen: WorldScreen, val popupAlert: PopupAlert): Popu
|
||||
}
|
||||
AlertType.CitySettledNearOtherCivDespiteOurPromise -> {
|
||||
val otherciv= worldScreen.gameInfo.getCivilization(popupAlert.value)
|
||||
val translatedNation = otherciv.getTranslatedNation()
|
||||
addLeaderName(translatedNation)
|
||||
addLeaderName(otherciv)
|
||||
addGoodSizedLabel("We noticed your new city near our borders, despite your promise. This will have....implications.").row()
|
||||
add(getCloseButton("Very well."))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user