mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-26 05:14:32 -04:00
Many notification conversions
This commit is contained in:
parent
36131cb7c1
commit
d4b19a7bb3
BIN
android/Images/OtherIcons/Diplomacy.png
Normal file
BIN
android/Images/OtherIcons/Diplomacy.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 749 B |
@ -65,9 +65,9 @@ object NextTurnAutomation {
|
||||
civInfo.tradeRequests.remove(tradeRequest)
|
||||
if (TradeEvaluation().isTradeAcceptable(tradeLogic.currentTrade, civInfo, otherCiv)) {
|
||||
tradeLogic.acceptTrade()
|
||||
otherCiv.addNotification("[${civInfo.civName}] has accepted your trade request", Color.GOLD)
|
||||
otherCiv.addNotification("[${civInfo.civName}] has accepted your trade request", NotificationIcon.Trade, civInfo.civName)
|
||||
} else {
|
||||
otherCiv.addNotification("[${civInfo.civName}] has denied your trade request", Color.GOLD)
|
||||
otherCiv.addNotification("[${civInfo.civName}] has denied your trade request", NotificationIcon.Trade, civInfo.civName)
|
||||
}
|
||||
}
|
||||
civInfo.tradeRequests.clear()
|
||||
@ -88,8 +88,8 @@ object NextTurnAutomation {
|
||||
if (diploManager.relationshipLevel() > RelationshipLevel.Neutral
|
||||
&& !diploManager.otherCivDiplomacy().hasFlag(DiplomacyFlags.Denunceation)) {
|
||||
diploManager.signDeclarationOfFriendship()
|
||||
requestingCiv.addNotification("We have signed a Declaration of Friendship with [${civInfo.civName}]!", Color.GOLD)
|
||||
} else requestingCiv.addNotification("[${civInfo.civName}] has denied our Declaration of Friendship!", Color.GOLD)
|
||||
requestingCiv.addNotification("We have signed a Declaration of Friendship with [${civInfo.civName}]!", NotificationIcon.Diplomacy, civInfo.civName)
|
||||
} else requestingCiv.addNotification("[${civInfo.civName}] has denied our Declaration of Friendship!", NotificationIcon.Diplomacy, civInfo.civName)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ class PopulationManager {
|
||||
fun nextTurn(food: Int) {
|
||||
foodStored += food
|
||||
if (food < 0)
|
||||
cityInfo.civInfo.addNotification("[${cityInfo.name}] is starving!", cityInfo.location, NotificationIcon.Growth, "OtherIcons/DisbandUnit")
|
||||
cityInfo.civInfo.addNotification("[${cityInfo.name}] is starving!", cityInfo.location, NotificationIcon.Growth, NotificationIcon.Death)
|
||||
if (foodStored < 0) { // starvation!
|
||||
if (population > 1) population--
|
||||
foodStored = 0
|
||||
|
@ -40,8 +40,8 @@ class CivInfoTransientUpdater(val civInfo: CivilizationInfo) {
|
||||
val metCiv = entry.key
|
||||
if (metCiv == civInfo || metCiv.isBarbarian() || civInfo.diplomacy.containsKey(metCiv.civName)) continue
|
||||
civInfo.meetCivilization(metCiv)
|
||||
civInfo.addNotification("We have encountered [" + metCiv.civName + "]!", entry.value.position, Color.GOLD)
|
||||
metCiv.addNotification("We have encountered [" + civInfo.civName + "]!", entry.value.position, Color.GOLD)
|
||||
civInfo.addNotification("We have encountered [" + metCiv.civName + "]!", entry.value.position, metCiv.civName, NotificationIcon.Diplomacy)
|
||||
metCiv.addNotification("We have encountered [" + civInfo.civName + "]!", entry.value.position, civInfo.civName, NotificationIcon.Diplomacy)
|
||||
}
|
||||
|
||||
discoverNaturalWonders()
|
||||
@ -91,7 +91,7 @@ class CivInfoTransientUpdater(val civInfo: CivilizationInfo) {
|
||||
if (civInfo.naturalWonders.contains(tile.naturalWonder))
|
||||
continue
|
||||
civInfo.discoverNaturalWonder(tile.naturalWonder!!)
|
||||
civInfo.addNotification("We have discovered [" + tile.naturalWonder + "]!", tile.position, Color.GOLD)
|
||||
civInfo.addNotification("We have discovered [" + tile.naturalWonder + "]!", tile.position, "StatIcons/Happiness")
|
||||
|
||||
var goldGained = 0
|
||||
val discoveredNaturalWonders = civInfo.gameInfo.civilizations.filter { it != civInfo && it.isMajorCiv() }
|
||||
@ -109,7 +109,7 @@ class CivInfoTransientUpdater(val civInfo: CivilizationInfo) {
|
||||
|
||||
if (goldGained > 0) {
|
||||
civInfo.gold += goldGained
|
||||
civInfo.addNotification("We have received [" + goldGained + "] Gold for discovering [" + tile.naturalWonder + "]", null, Color.GOLD)
|
||||
civInfo.addNotification("We have received [" + goldGained + "] Gold for discovering [" + tile.naturalWonder + "]", NotificationIcon.Gold)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -344,7 +344,7 @@ class CivilizationInfo {
|
||||
val maxEraOfTech = tech.researchedTechnologies
|
||||
.asSequence()
|
||||
.map { it.column!! }
|
||||
.maxBy { it.columnNumber }!!
|
||||
.maxByOrNull { it.columnNumber }!!
|
||||
.era
|
||||
return maxEraOfTech
|
||||
}
|
||||
@ -484,7 +484,7 @@ class CivilizationInfo {
|
||||
if (offeringCiv.isDefeated() || !TradeEvaluation().isTradeValid(tradeRequest.trade, this, offeringCiv)) {
|
||||
tradeRequests.remove(tradeRequest)
|
||||
// Yes, this is the right direction. I checked.
|
||||
offeringCiv.addNotification("Our proposed trade is no longer relevant!", Color.GOLD)
|
||||
offeringCiv.addNotification("Our proposed trade is no longer relevant!", NotificationIcon.Trade)
|
||||
}
|
||||
}
|
||||
updateDetailedCivResources() // If you offered a trade last turn, this turn it will have been accepted/declined
|
||||
@ -509,7 +509,7 @@ class CivilizationInfo {
|
||||
unitToDisband.disband()
|
||||
civMilitaryUnits -= unitToDisband
|
||||
val unitName = unitToDisband.displayName()
|
||||
addNotification("Cannot provide unit upkeep for [$unitName] - unit has been disbanded!", null, Color.RED)
|
||||
addNotification("Cannot provide unit upkeep for [$unitName] - unit has been disbanded!", unitName, NotificationIcon.Death)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -550,19 +550,14 @@ class CivilizationInfo {
|
||||
|
||||
fun addNotification(text: String, location: Vector2?, color: Color) {
|
||||
val locations = if (location != null) listOf(location) else emptyList()
|
||||
addNotification(text, color, LocationAction(locations))
|
||||
if (playerType == PlayerType.AI) return // no point in lengthening the saved game info if no one will read it
|
||||
notifications.add(Notification(text, color, LocationAction(locations)))
|
||||
}
|
||||
|
||||
fun addNotification(text: String, location: Vector2, vararg notificationIcons: String) {
|
||||
addNotification(text, LocationAction(listOf(location)), *notificationIcons)
|
||||
}
|
||||
|
||||
|
||||
fun addNotification(text: String, color: Color, action: NotificationAction? = null) {
|
||||
if (playerType == PlayerType.AI) return // no point in lengthening the saved game info if no one will read it
|
||||
notifications.add(Notification(text, color, action))
|
||||
}
|
||||
|
||||
fun addNotification(text: String, vararg notificationIcons: String) = addNotification(text, null, *notificationIcons)
|
||||
|
||||
fun addNotification(text: String, action:NotificationAction?, vararg notificationIcons: String) {
|
||||
@ -649,7 +644,7 @@ class CivilizationInfo {
|
||||
if (!isCityState()) return
|
||||
val maxInfluence = diplomacy
|
||||
.filter { !it.value.otherCiv().isCityState() && !it.value.otherCiv().isDefeated() }
|
||||
.maxBy { it.value.influence }
|
||||
.maxByOrNull { it.value.influence }
|
||||
if (maxInfluence != null && maxInfluence.value.influence >= 60) {
|
||||
newAllyName = maxInfluence.key
|
||||
}
|
||||
|
@ -14,6 +14,9 @@ object NotificationIcon {
|
||||
val War = "OtherIcons/Pillage"
|
||||
val Trade = "StatIcons/Acquire"
|
||||
val Science = "StatIcons/Science"
|
||||
val Gold = "StatIcons/Gold"
|
||||
val Death = "OtherIcons/DisbandUnit"
|
||||
val Diplomacy = "OtherIcons/Diplomacy"
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -274,7 +274,8 @@ class QuestManager {
|
||||
newQuest.gameInfo = civInfo.gameInfo
|
||||
|
||||
assignedQuests.add(newQuest)
|
||||
assignee.addNotification("[${civInfo.civName}] assigned you a new quest: [${quest.name}].", Color.GOLD, DiplomacyAction(civInfo.civName))
|
||||
assignee.addNotification("[${civInfo.civName}] assigned you a new quest: [${quest.name}].",
|
||||
DiplomacyAction(civInfo.civName), civInfo.civName, "OtherIcons/Quest")
|
||||
|
||||
if (quest.isIndividual())
|
||||
individualQuestCountdown[assignee.civName] = UNSET
|
||||
@ -345,7 +346,8 @@ class QuestManager {
|
||||
|
||||
civInfo.getDiplomacyManager(assignedQuest.assignee).influence += rewardInfluence
|
||||
if (rewardInfluence > 0)
|
||||
assignee.addNotification("[${civInfo.civName}] rewarded you with [${rewardInfluence.toInt()}] influence for completing the [${assignedQuest.questName}] quest.", civInfo.getCapital().location, Color.GOLD)
|
||||
assignee.addNotification("[${civInfo.civName}] rewarded you with [${rewardInfluence.toInt()}] influence for completing the [${assignedQuest.questName}] quest.",
|
||||
civInfo.getCapital().location, civInfo.civName, "OtherIcons/Quest")
|
||||
}
|
||||
|
||||
/** Returns the score for the [assignedQuest] */
|
||||
|
@ -647,11 +647,11 @@ class DiplomacyManager() {
|
||||
setFlag(DiplomacyFlags.Denunceation, 30)
|
||||
otherCivDiplomacy().setFlag(DiplomacyFlags.Denunceation, 30)
|
||||
|
||||
otherCiv().addNotification("[${civInfo.civName}] has denounced us!", Color.RED)
|
||||
otherCiv().addNotification("[${civInfo.civName}] has denounced us!", NotificationIcon.Diplomacy, civInfo.civName)
|
||||
|
||||
// We, A, are denouncing B. What do other major civs (C,D, etc) think of this?
|
||||
getCommonKnownCivs().filter { it.isMajorCiv() }.forEach { thirdCiv ->
|
||||
thirdCiv.addNotification("[${civInfo.civName}] has denounced [${otherCiv().civName}]!", null, Color.RED)
|
||||
thirdCiv.addNotification("[${civInfo.civName}] has denounced [$otherCivName]!", civInfo.civName, NotificationIcon.Diplomacy, otherCivName)
|
||||
val thirdCivRelationshipWithOtherCiv = thirdCiv.getDiplomacyManager(otherCiv()).relationshipLevel()
|
||||
when (thirdCivRelationshipWithOtherCiv) {
|
||||
RelationshipLevel.Unforgivable -> addModifier(DiplomaticModifiers.DenouncedOurEnemies, 15f)
|
||||
@ -665,14 +665,14 @@ class DiplomacyManager() {
|
||||
fun agreeNotToSettleNear() {
|
||||
otherCivDiplomacy().setFlag(DiplomacyFlags.AgreedToNotSettleNearUs, 100)
|
||||
addModifier(DiplomaticModifiers.UnacceptableDemands, -10f)
|
||||
otherCiv().addNotification("[${civInfo.civName}] agreed to stop settling cities near us!", Color.MAROON)
|
||||
otherCiv().addNotification("[${civInfo.civName}] agreed to stop settling cities near us!", NotificationIcon.Diplomacy, civInfo.civName)
|
||||
}
|
||||
|
||||
fun refuseDemandNotToSettleNear() {
|
||||
addModifier(DiplomaticModifiers.UnacceptableDemands, -20f)
|
||||
otherCivDiplomacy().setFlag(DiplomacyFlags.IgnoreThemSettlingNearUs, 100)
|
||||
otherCivDiplomacy().addModifier(DiplomaticModifiers.RefusedToNotSettleCitiesNearUs, -15f)
|
||||
otherCiv().addNotification("[${civInfo.civName}] refused to stop settling cities near us!", Color.MAROON)
|
||||
otherCiv().addNotification("[${civInfo.civName}] refused to stop settling cities near us!", NotificationIcon.Diplomacy, civInfo.civName)
|
||||
}
|
||||
|
||||
|
||||
|
@ -5,6 +5,7 @@ import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.TextField
|
||||
import com.unciv.logic.GameInfo
|
||||
import com.unciv.logic.GameSaver
|
||||
import com.unciv.logic.civilization.NotificationIcon
|
||||
import com.unciv.logic.civilization.PlayerType
|
||||
import com.unciv.models.translations.tr
|
||||
import com.unciv.ui.pickerscreens.PickerScreen
|
||||
@ -99,7 +100,7 @@ class EditMultiplayerGameInfoScreen(game: GameInfo?, gameName: String, backScree
|
||||
//Add notification so everyone knows what happened
|
||||
//call for every civ cause AI players are skipped anyway
|
||||
for (civ in gameInfo.civilizations) {
|
||||
civ.addNotification("[${playerCiv.civName}] resigned and is now controlled by AI", Color.RED)
|
||||
civ.addNotification("[${playerCiv.civName}] resigned and is now controlled by AI", playerCiv.civName)
|
||||
}
|
||||
|
||||
//save game so multiplayer list stays up to date
|
||||
|
@ -4,6 +4,7 @@ import com.unciv.ui.utils.AutoScrollPane as ScrollPane
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||
import com.unciv.Constants
|
||||
import com.unciv.logic.civilization.NotificationIcon
|
||||
import com.unciv.logic.civilization.diplomacy.DiplomacyFlags
|
||||
import com.unciv.logic.trade.TradeEvaluation
|
||||
import com.unciv.logic.trade.TradeLogic
|
||||
@ -75,7 +76,7 @@ class TradePopup(worldScreen: WorldScreen): Popup(worldScreen){
|
||||
}
|
||||
open()
|
||||
}
|
||||
requestingCiv.addNotification("[${viewingCiv.civName}] has accepted your trade request", Color.GOLD)
|
||||
requestingCiv.addNotification("[${viewingCiv.civName}] has accepted your trade request", viewingCiv.civName, NotificationIcon.Trade)
|
||||
}
|
||||
|
||||
// In the meantime this became invalid, perhaps because we accepted previous trades
|
||||
@ -93,7 +94,7 @@ class TradePopup(worldScreen: WorldScreen): Popup(worldScreen){
|
||||
diplomacyManager.setFlag(DiplomacyFlags.DeclinedPeace,5)
|
||||
|
||||
close()
|
||||
requestingCiv.addNotification("[${viewingCiv.civName}] has denied your trade request", Color.GOLD)
|
||||
requestingCiv.addNotification("[${viewingCiv.civName}] has denied your trade request", viewingCiv.civName, NotificationIcon.Trade)
|
||||
|
||||
worldScreen.shouldUpdate=true
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user