Added specific icons to certain notification types
BIN
android/Images/NotificationIcons/Construction.png
Normal file
After Width: | Height: | Size: 6.7 KiB |
BIN
android/Images/NotificationIcons/Culture.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
android/Images/NotificationIcons/Growth.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
android/Images/NotificationIcons/Science.png
Normal file
After Width: | Height: | Size: 8.4 KiB |
BIN
android/Images/NotificationIcons/Trade.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
android/Images/NotificationIcons/War.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 866 KiB After Width: | Height: | Size: 874 KiB |
@ -4,7 +4,6 @@ import java.util.*
|
|||||||
plugins {
|
plugins {
|
||||||
id("com.android.application")
|
id("com.android.application")
|
||||||
id("kotlin-android")
|
id("kotlin-android")
|
||||||
id("kotlin-android-extensions")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
@ -171,11 +171,11 @@ class GameInfo {
|
|||||||
if (tiles.size < 3) {
|
if (tiles.size < 3) {
|
||||||
for (tile in tiles) {
|
for (tile in tiles) {
|
||||||
val unitName = tile.militaryUnit!!.name
|
val unitName = tile.militaryUnit!!.name
|
||||||
thisPlayer.addNotification("An enemy [$unitName] was spotted $inOrNear our territory", tile.position, Color.RED)
|
thisPlayer.addNotification("An enemy [$unitName] was spotted $inOrNear our territory", tile.position, NotificationType.War)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val positions = tiles.map { it.position }
|
val positions = tiles.map { it.position }
|
||||||
thisPlayer.addNotification("[${positions.size}] enemy units were spotted $inOrNear our territory", Color.RED, LocationAction(positions))
|
thisPlayer.addNotification("[${positions.size}] enemy units were spotted $inOrNear our territory", NotificationType.War, LocationAction(positions))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import com.unciv.UncivGame
|
|||||||
import com.unciv.logic.city.CityConstructions
|
import com.unciv.logic.city.CityConstructions
|
||||||
import com.unciv.logic.city.PerpetualConstruction
|
import com.unciv.logic.city.PerpetualConstruction
|
||||||
import com.unciv.logic.civilization.CityAction
|
import com.unciv.logic.civilization.CityAction
|
||||||
|
import com.unciv.logic.civilization.NotificationType
|
||||||
import com.unciv.logic.civilization.PlayerType
|
import com.unciv.logic.civilization.PlayerType
|
||||||
import com.unciv.logic.map.BFS
|
import com.unciv.logic.map.BFS
|
||||||
import com.unciv.models.ruleset.Building
|
import com.unciv.models.ruleset.Building
|
||||||
@ -86,7 +87,7 @@ class ConstructionAutomation(val cityConstructions: CityConstructions){
|
|||||||
// Nobody can plan 30 turns ahead, I don't care how cost-efficient you are.
|
// Nobody can plan 30 turns ahead, I don't care how cost-efficient you are.
|
||||||
else theChosenOne = relativeCostEffectiveness.minBy { it.remainingWork }!!.choice
|
else theChosenOne = relativeCostEffectiveness.minBy { it.remainingWork }!!.choice
|
||||||
|
|
||||||
civInfo.addNotification("Work has started on [$theChosenOne]", Color.BROWN, CityAction(cityInfo.location))
|
civInfo.addNotification("Work has started on [$theChosenOne]", NotificationType.Construction, CityAction(cityInfo.location))
|
||||||
cityConstructions.currentConstructionFromQueue = theChosenOne
|
cityConstructions.currentConstructionFromQueue = theChosenOne
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import com.unciv.UncivGame
|
|||||||
import com.unciv.logic.city.CityInfo
|
import com.unciv.logic.city.CityInfo
|
||||||
import com.unciv.logic.civilization.AlertType
|
import com.unciv.logic.civilization.AlertType
|
||||||
import com.unciv.logic.civilization.CivilizationInfo
|
import com.unciv.logic.civilization.CivilizationInfo
|
||||||
|
import com.unciv.logic.civilization.NotificationType
|
||||||
import com.unciv.logic.civilization.PopupAlert
|
import com.unciv.logic.civilization.PopupAlert
|
||||||
import com.unciv.logic.civilization.diplomacy.DiplomaticModifiers
|
import com.unciv.logic.civilization.diplomacy.DiplomaticModifiers
|
||||||
import com.unciv.logic.map.RoadStatus
|
import com.unciv.logic.map.RoadStatus
|
||||||
@ -173,7 +174,7 @@ object Battle {
|
|||||||
else " [" + defender.getName() + "]"
|
else " [" + defender.getName() + "]"
|
||||||
else " our [" + defender.getName() + "]"
|
else " our [" + defender.getName() + "]"
|
||||||
val notificationString = attackerString + whatHappenedString + defenderString
|
val notificationString = attackerString + whatHappenedString + defenderString
|
||||||
defender.getCivInfo().addNotification(notificationString, attackedTile.position, Color.RED)
|
defender.getCivInfo().addNotification(notificationString, attackedTile.position, NotificationType.War)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -288,7 +289,7 @@ object Battle {
|
|||||||
private fun conquerCity(city: CityInfo, attacker: ICombatant) {
|
private fun conquerCity(city: CityInfo, attacker: ICombatant) {
|
||||||
val attackerCiv = attacker.getCivInfo()
|
val attackerCiv = attacker.getCivInfo()
|
||||||
|
|
||||||
attackerCiv.addNotification("We have conquered the city of [${city.name}]!", city.location, Color.RED)
|
attackerCiv.addNotification("We have conquered the city of [${city.name}]!", city.location, NotificationType.War)
|
||||||
|
|
||||||
city.getCenterTile().apply {
|
city.getCenterTile().apply {
|
||||||
if (militaryUnit != null) militaryUnit!!.destroy()
|
if (militaryUnit != null) militaryUnit!!.destroy()
|
||||||
@ -334,7 +335,7 @@ object Battle {
|
|||||||
|
|
||||||
val capturedUnit = defender.unit
|
val capturedUnit = defender.unit
|
||||||
capturedUnit.civInfo.addNotification("An enemy [" + attacker.getName() + "] has captured our [" + defender.getName() + "]",
|
capturedUnit.civInfo.addNotification("An enemy [" + attacker.getName() + "] has captured our [" + defender.getName() + "]",
|
||||||
defender.getTile().position, Color.RED)
|
defender.getTile().position, NotificationType.War)
|
||||||
|
|
||||||
// Apparently in Civ V, captured settlers are converted to workers.
|
// Apparently in Civ V, captured settlers are converted to workers.
|
||||||
if (capturedUnit.name == Constants.settler) {
|
if (capturedUnit.name == Constants.settler) {
|
||||||
@ -432,17 +433,17 @@ object Battle {
|
|||||||
if (attacker.isDefeated()) {
|
if (attacker.isDefeated()) {
|
||||||
attacker.getCivInfo()
|
attacker.getCivInfo()
|
||||||
.addNotification("Our [$attackerName] was destroyed by an intercepting [$interceptorName]",
|
.addNotification("Our [$attackerName] was destroyed by an intercepting [$interceptorName]",
|
||||||
Color.RED)
|
NotificationType.War)
|
||||||
defender.getCivInfo()
|
defender.getCivInfo()
|
||||||
.addNotification("Our [$interceptorName] intercepted and destroyed an enemy [$attackerName]",
|
.addNotification("Our [$interceptorName] intercepted and destroyed an enemy [$attackerName]",
|
||||||
interceptor.currentTile.position, Color.RED)
|
interceptor.currentTile.position, NotificationType.War)
|
||||||
} else {
|
} else {
|
||||||
attacker.getCivInfo()
|
attacker.getCivInfo()
|
||||||
.addNotification("Our [$attackerName] was attacked by an intercepting [$interceptorName]",
|
.addNotification("Our [$attackerName] was attacked by an intercepting [$interceptorName]",
|
||||||
Color.RED)
|
NotificationType.War)
|
||||||
defender.getCivInfo()
|
defender.getCivInfo()
|
||||||
.addNotification("Our [$interceptorName] intercepted and attacked an enemy [$attackerName]",
|
.addNotification("Our [$interceptorName] intercepted and attacked an enemy [$attackerName]",
|
||||||
interceptor.currentTile.position, Color.RED)
|
interceptor.currentTile.position, NotificationType.War)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -497,8 +498,8 @@ object Battle {
|
|||||||
// and count 1 attack for attacker but leave it in place
|
// and count 1 attack for attacker but leave it in place
|
||||||
reduceAttackerMovementPointsAndAttacks(attacker, defender)
|
reduceAttackerMovementPointsAndAttacks(attacker, defender)
|
||||||
val notificationString = "[" + defendBaseUnit.name + "] withdrew from a [" + attackBaseUnit.name + "]"
|
val notificationString = "[" + defendBaseUnit.name + "] withdrew from a [" + attackBaseUnit.name + "]"
|
||||||
defender.getCivInfo().addNotification(notificationString, toTile.position, Color.GREEN)
|
defender.getCivInfo().addNotification(notificationString, toTile.position, NotificationType.War)
|
||||||
attacker.getCivInfo().addNotification(notificationString, toTile.position, Color.RED)
|
attacker.getCivInfo().addNotification(notificationString, toTile.position, NotificationType.War)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package com.unciv.logic.city
|
|||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.unciv.logic.automation.ConstructionAutomation
|
import com.unciv.logic.automation.ConstructionAutomation
|
||||||
import com.unciv.logic.civilization.AlertType
|
import com.unciv.logic.civilization.AlertType
|
||||||
|
import com.unciv.logic.civilization.NotificationType
|
||||||
import com.unciv.logic.civilization.PopupAlert
|
import com.unciv.logic.civilization.PopupAlert
|
||||||
import com.unciv.models.ruleset.Building
|
import com.unciv.models.ruleset.Building
|
||||||
import com.unciv.models.ruleset.UniqueMap
|
import com.unciv.models.ruleset.UniqueMap
|
||||||
@ -312,7 +313,7 @@ class CityConstructions {
|
|||||||
civ.addNotification("[${construction.name}] has been built in a faraway land", null, Color.BROWN)
|
civ.addNotification("[${construction.name}] has been built in a faraway land", null, Color.BROWN)
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
cityInfo.civInfo.addNotification("[${construction.name}] has been built in [" + cityInfo.name + "]", cityInfo.location, Color.BROWN)
|
cityInfo.civInfo.addNotification("[${construction.name}] has been built in [" + cityInfo.name + "]", cityInfo.location, NotificationType.Construction)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addBuilding(buildingName: String) {
|
fun addBuilding(buildingName: String) {
|
||||||
|
@ -2,6 +2,7 @@ package com.unciv.logic.city
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.unciv.logic.automation.Automation
|
import com.unciv.logic.automation.Automation
|
||||||
|
import com.unciv.logic.civilization.NotificationType
|
||||||
import com.unciv.logic.map.TileInfo
|
import com.unciv.logic.map.TileInfo
|
||||||
import com.unciv.ui.utils.withItem
|
import com.unciv.ui.utils.withItem
|
||||||
import com.unciv.ui.utils.withoutItem
|
import com.unciv.ui.utils.withoutItem
|
||||||
@ -142,10 +143,8 @@ class CityExpansionManager {
|
|||||||
|
|
||||||
fun nextTurn(culture: Float) {
|
fun nextTurn(culture: Float) {
|
||||||
cultureStored += culture.toInt()
|
cultureStored += culture.toInt()
|
||||||
if (cultureStored >= getCultureToNextTile()) {
|
if (cultureStored >= getCultureToNextTile() && addNewTileWithCulture())
|
||||||
if (addNewTileWithCulture())
|
cityInfo.civInfo.addNotification("[" + cityInfo.name + "] has expanded its borders!", cityInfo.location, NotificationType.Culture)
|
||||||
cityInfo.civInfo.addNotification("[" + cityInfo.name + "] has expanded its borders!", cityInfo.location, Color.PURPLE)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setTransients() {
|
fun setTransients() {
|
||||||
|
@ -2,6 +2,7 @@ package com.unciv.logic.city
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.unciv.logic.automation.Automation
|
import com.unciv.logic.automation.Automation
|
||||||
|
import com.unciv.logic.civilization.NotificationType
|
||||||
import com.unciv.logic.map.TileInfo
|
import com.unciv.logic.map.TileInfo
|
||||||
import com.unciv.models.Counter
|
import com.unciv.models.Counter
|
||||||
import com.unciv.ui.utils.withItem
|
import com.unciv.ui.utils.withItem
|
||||||
@ -64,7 +65,7 @@ class PopulationManager {
|
|||||||
foodStored += (getFoodToNextPopulation() * percentOfFoodCarriedOver / 100f).toInt()
|
foodStored += (getFoodToNextPopulation() * percentOfFoodCarriedOver / 100f).toInt()
|
||||||
population++
|
population++
|
||||||
autoAssignPopulation()
|
autoAssignPopulation()
|
||||||
cityInfo.civInfo.addNotification("[${cityInfo.name}] has grown!", cityInfo.location, Color.GREEN)
|
cityInfo.civInfo.addNotification("[${cityInfo.name}] has grown!", cityInfo.location, NotificationType.Growth)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -553,11 +553,22 @@ class CivilizationInfo {
|
|||||||
addNotification(text, color, LocationAction(locations))
|
addNotification(text, color, LocationAction(locations))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun addNotification(text: String, location: Vector2?, notificationType: NotificationType) {
|
||||||
|
val locations = if (location != null) listOf(location) else emptyList()
|
||||||
|
addNotification(text, notificationType, LocationAction(locations))
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
fun addNotification(text: String, color: Color, action: NotificationAction? = null) {
|
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
|
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))
|
notifications.add(Notification(text, color, action))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun addNotification(text: String, notificationType: NotificationType, 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, notificationType, action))
|
||||||
|
}
|
||||||
|
|
||||||
fun addUnit(unitName: String, city: CityInfo? = null) {
|
fun addUnit(unitName: String, city: CityInfo? = null) {
|
||||||
if (cities.isEmpty()) return
|
if (cities.isEmpty()) return
|
||||||
val cityToAddTo = city ?: cities.random()
|
val cityToAddTo = city ?: cities.random()
|
||||||
|
@ -7,16 +7,41 @@ import com.unciv.ui.pickerscreens.TechPickerScreen
|
|||||||
import com.unciv.ui.trade.DiplomacyScreen
|
import com.unciv.ui.trade.DiplomacyScreen
|
||||||
import com.unciv.ui.worldscreen.WorldScreen
|
import com.unciv.ui.worldscreen.WorldScreen
|
||||||
|
|
||||||
|
enum class NotificationType {
|
||||||
|
Culture,
|
||||||
|
Construction,
|
||||||
|
Growth,
|
||||||
|
War,
|
||||||
|
Trade,
|
||||||
|
Science
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [action] is not realized as lambda, as it would be too easy to introduce references to objects
|
* [action] is not realized as lambda, as it would be too easy to introduce references to objects
|
||||||
* there that should not be serialized to the saved game.
|
* there that should not be serialized to the saved game.
|
||||||
*/
|
*/
|
||||||
open class Notification (
|
open class Notification() {
|
||||||
// default parameters necessary for json deserialization
|
|
||||||
var text: String = "",
|
var text: String=""
|
||||||
var color: Color = Color.BLACK,
|
var color: Color?=null
|
||||||
|
var notificationType:NotificationType?=null
|
||||||
var action: NotificationAction? = null
|
var action: NotificationAction? = null
|
||||||
)
|
|
||||||
|
// default parameters necessary for json deserialization
|
||||||
|
constructor(text: String, color: Color, action: NotificationAction?) : this() {
|
||||||
|
this.text = text
|
||||||
|
this.color = color
|
||||||
|
this.action = action
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(text: String, notificationType: NotificationType, action: NotificationAction? = null) : this() {
|
||||||
|
this.text = text
|
||||||
|
this.notificationType = notificationType
|
||||||
|
this.action = action
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/** defines what to do if the user clicks on a notification */
|
/** defines what to do if the user clicks on a notification */
|
||||||
interface NotificationAction {
|
interface NotificationAction {
|
||||||
|
@ -257,7 +257,7 @@ class TechManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (it in getRuleset().policyBranches.values.filter { it.era == currentEra }) {
|
for (it in getRuleset().policyBranches.values.filter { it.era == currentEra }) {
|
||||||
civInfo.addNotification("[" + it.name + "] policy branch unlocked!", null, Color.PURPLE)
|
civInfo.addNotification("[" + it.name + "] policy branch unlocked!", NotificationType.Culture)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,9 +68,12 @@ class DiplomacyManager() {
|
|||||||
const val MINIMUM_INFLUENCE = -60f
|
const val MINIMUM_INFLUENCE = -60f
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transient lateinit var civInfo: CivilizationInfo
|
@Transient
|
||||||
|
lateinit var civInfo: CivilizationInfo
|
||||||
|
|
||||||
// since this needs to be checked a lot during travel, putting it in a transient is a good performance booster
|
// since this needs to be checked a lot during travel, putting it in a transient is a good performance booster
|
||||||
@Transient var hasOpenBorders=false
|
@Transient
|
||||||
|
var hasOpenBorders = false
|
||||||
|
|
||||||
lateinit var otherCivName: String
|
lateinit var otherCivName: String
|
||||||
var trades = ArrayList<Trade>()
|
var trades = ArrayList<Trade>()
|
||||||
@ -89,7 +92,9 @@ class DiplomacyManager() {
|
|||||||
/** For city-states. Influence is saved in the CITY STATE -> major civ Diplomacy, NOT in the major civ -> cty state diplomacy.
|
/** For city-states. Influence is saved in the CITY STATE -> major civ Diplomacy, NOT in the major civ -> cty state diplomacy.
|
||||||
* Won't go below [MINIMUM_INFLUENCE] */
|
* Won't go below [MINIMUM_INFLUENCE] */
|
||||||
var influence = 0f
|
var influence = 0f
|
||||||
set(value) { field = max(value, MINIMUM_INFLUENCE) }
|
set(value) {
|
||||||
|
field = max(value, MINIMUM_INFLUENCE)
|
||||||
|
}
|
||||||
get() = if (civInfo.isAtWarWith(otherCiv())) MINIMUM_INFLUENCE else field
|
get() = if (civInfo.isAtWarWith(otherCiv())) MINIMUM_INFLUENCE else field
|
||||||
|
|
||||||
/** Total of each turn Science during Research Agreement */
|
/** Total of each turn Science during Research Agreement */
|
||||||
@ -227,6 +232,7 @@ class DiplomacyManager() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun canDeclareWar() = turnsToPeaceTreaty() == 0 && diplomaticStatus != DiplomaticStatus.War
|
fun canDeclareWar() = turnsToPeaceTreaty() == 0 && diplomaticStatus != DiplomaticStatus.War
|
||||||
|
|
||||||
//Used for nuke
|
//Used for nuke
|
||||||
fun canAttack() = turnsToPeaceTreaty() == 0
|
fun canAttack() = turnsToPeaceTreaty() == 0
|
||||||
|
|
||||||
@ -253,8 +259,10 @@ class DiplomacyManager() {
|
|||||||
fun resourcesFromTrade(): ResourceSupplyList {
|
fun resourcesFromTrade(): ResourceSupplyList {
|
||||||
val counter = ResourceSupplyList()
|
val counter = ResourceSupplyList()
|
||||||
val resourcesMap = civInfo.gameInfo.ruleSet.tileResources
|
val resourcesMap = civInfo.gameInfo.ruleSet.tileResources
|
||||||
val isResourceFilter: (TradeOffer) -> Boolean = { (it.type == TradeType.Strategic_Resource || it.type == TradeType.Luxury_Resource)
|
val isResourceFilter: (TradeOffer) -> Boolean = {
|
||||||
&& civInfo.gameInfo.ruleSet.tileResources.containsKey(it.name) }
|
(it.type == TradeType.Strategic_Resource || it.type == TradeType.Luxury_Resource)
|
||||||
|
&& civInfo.gameInfo.ruleSet.tileResources.containsKey(it.name)
|
||||||
|
}
|
||||||
for (trade in trades) {
|
for (trade in trades) {
|
||||||
for (offer in trade.ourOffers.filter(isResourceFilter))
|
for (offer in trade.ourOffers.filter(isResourceFilter))
|
||||||
counter.add(resourcesMap[offer.name]!!, -offer.amount, "Trade")
|
counter.add(resourcesMap[offer.name]!!, -offer.amount, "Trade")
|
||||||
@ -299,8 +307,8 @@ class DiplomacyManager() {
|
|||||||
trades.remove(trade)
|
trades.remove(trade)
|
||||||
val otherCivTrades = otherCiv().getDiplomacyManager(civInfo).trades
|
val otherCivTrades = otherCiv().getDiplomacyManager(civInfo).trades
|
||||||
otherCivTrades.removeAll { it.equals(trade.reverse()) }
|
otherCivTrades.removeAll { it.equals(trade.reverse()) }
|
||||||
civInfo.addNotification("One of our trades with [$otherCivName] has been cut short", null, Color.GOLD)
|
civInfo.addNotification("One of our trades with [$otherCivName] has been cut short", NotificationType.Trade)
|
||||||
otherCiv().addNotification("One of our trades with [${civInfo.civName}] has been cut short", null, Color.GOLD)
|
otherCiv().addNotification("One of our trades with [${civInfo.civName}] has been cut short", NotificationType.Trade)
|
||||||
civInfo.updateDetailedCivResources()
|
civInfo.updateDetailedCivResources()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -409,8 +417,8 @@ class DiplomacyManager() {
|
|||||||
trades.remove(trade)
|
trades.remove(trade)
|
||||||
for (offer in trade.ourOffers.union(trade.theirOffers).filter { it.duration == 0 }) { // this was a timed trade
|
for (offer in trade.ourOffers.union(trade.theirOffers).filter { it.duration == 0 }) { // this was a timed trade
|
||||||
if (offer in trade.theirOffers)
|
if (offer in trade.theirOffers)
|
||||||
civInfo.addNotification("[${offer.name}] from [$otherCivName] has ended", null, Color.GOLD)
|
civInfo.addNotification("[${offer.name}] from [$otherCivName] has ended", NotificationType.Trade)
|
||||||
else civInfo.addNotification("[${offer.name}] to [$otherCivName] has ended", null, Color.GOLD)
|
else civInfo.addNotification("[${offer.name}] to [$otherCivName] has ended", NotificationType.Trade)
|
||||||
|
|
||||||
civInfo.updateStatsForNextTurn() // if they were bringing us gold per turn
|
civInfo.updateStatsForNextTurn() // if they were bringing us gold per turn
|
||||||
civInfo.updateDetailedCivResources() // if they were giving us resources
|
civInfo.updateDetailedCivResources() // if they were giving us resources
|
||||||
@ -463,7 +471,7 @@ class DiplomacyManager() {
|
|||||||
// Cancel all trades.
|
// Cancel all trades.
|
||||||
for (trade in trades)
|
for (trade in trades)
|
||||||
for (offer in trade.theirOffers.filter { it.duration > 0 })
|
for (offer in trade.theirOffers.filter { it.duration > 0 })
|
||||||
civInfo.addNotification("["+offer.name+"] from [$otherCivName] has ended",null, Color.GOLD)
|
civInfo.addNotification("[" + offer.name + "] from [$otherCivName] has ended", NotificationType.Trade)
|
||||||
trades.clear()
|
trades.clear()
|
||||||
updateHasOpenBorders()
|
updateHasOpenBorders()
|
||||||
|
|
||||||
@ -479,11 +487,11 @@ class DiplomacyManager() {
|
|||||||
onWarDeclared()
|
onWarDeclared()
|
||||||
otherCivDiplomacy.onWarDeclared()
|
otherCivDiplomacy.onWarDeclared()
|
||||||
|
|
||||||
otherCiv.addNotification("[${civInfo.civName}] has declared war on us!",null, Color.RED)
|
otherCiv.addNotification("[${civInfo.civName}] has declared war on us!", NotificationType.War)
|
||||||
otherCiv.popupAlerts.add(PopupAlert(AlertType.WarDeclaration, civInfo.civName))
|
otherCiv.popupAlerts.add(PopupAlert(AlertType.WarDeclaration, civInfo.civName))
|
||||||
|
|
||||||
getCommonKnownCivs().forEach {
|
getCommonKnownCivs().forEach {
|
||||||
it.addNotification("[${civInfo.civName}] has declared war on [${otherCiv().civName}]!", null, Color.RED)
|
it.addNotification("[${civInfo.civName}] has declared war on [${otherCiv().civName}]!", NotificationType.War)
|
||||||
}
|
}
|
||||||
|
|
||||||
otherCivDiplomacy.setModifier(DiplomaticModifiers.DeclaredWarOnUs, -20f)
|
otherCivDiplomacy.setModifier(DiplomaticModifiers.DeclaredWarOnUs, -20f)
|
||||||
@ -568,9 +576,14 @@ class DiplomacyManager() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun hasFlag(flag: DiplomacyFlags) = flagsCountdown.containsKey(flag.name)
|
fun hasFlag(flag: DiplomacyFlags) = flagsCountdown.containsKey(flag.name)
|
||||||
fun setFlag(flag: DiplomacyFlags, amount: Int){ flagsCountdown[flag.name]=amount}
|
fun setFlag(flag: DiplomacyFlags, amount: Int) {
|
||||||
|
flagsCountdown[flag.name] = amount
|
||||||
|
}
|
||||||
|
|
||||||
fun getFlag(flag: DiplomacyFlags) = flagsCountdown[flag.name]!!
|
fun getFlag(flag: DiplomacyFlags) = flagsCountdown[flag.name]!!
|
||||||
fun removeFlag(flag: DiplomacyFlags){ flagsCountdown.remove(flag.name)}
|
fun removeFlag(flag: DiplomacyFlags) {
|
||||||
|
flagsCountdown.remove(flag.name)
|
||||||
|
}
|
||||||
|
|
||||||
fun addModifier(modifier: DiplomaticModifiers, amount: Float) {
|
fun addModifier(modifier: DiplomaticModifiers, amount: Float) {
|
||||||
val modifierString = modifier.name
|
val modifierString = modifier.name
|
||||||
|
@ -7,6 +7,7 @@ import com.unciv.UncivGame
|
|||||||
import com.unciv.logic.automation.UnitAutomation
|
import com.unciv.logic.automation.UnitAutomation
|
||||||
import com.unciv.logic.automation.WorkerAutomation
|
import com.unciv.logic.automation.WorkerAutomation
|
||||||
import com.unciv.logic.civilization.CivilizationInfo
|
import com.unciv.logic.civilization.CivilizationInfo
|
||||||
|
import com.unciv.logic.civilization.NotificationType
|
||||||
import com.unciv.models.ruleset.Ruleset
|
import com.unciv.models.ruleset.Ruleset
|
||||||
import com.unciv.models.ruleset.Unique
|
import com.unciv.models.ruleset.Unique
|
||||||
import com.unciv.models.ruleset.unit.BaseUnit
|
import com.unciv.models.ruleset.unit.BaseUnit
|
||||||
@ -615,7 +616,7 @@ class MapUnit {
|
|||||||
val city = civInfo.cities.random(tileBasedRandom)
|
val city = civInfo.cities.random(tileBasedRandom)
|
||||||
city.population.population++
|
city.population.population++
|
||||||
city.population.autoAssignPopulation()
|
city.population.autoAssignPopulation()
|
||||||
civInfo.addNotification("We have found survivors in the ruins - population added to [" + city.name + "]", tile.position, Color.GREEN)
|
civInfo.addNotification("We have found survivors in the ruins - population added to [" + city.name + "]", tile.position, NotificationType.Growth)
|
||||||
}
|
}
|
||||||
val researchableAncientEraTechs = tile.tileMap.gameInfo.ruleSet.technologies.values
|
val researchableAncientEraTechs = tile.tileMap.gameInfo.ruleSet.technologies.values
|
||||||
.filter {
|
.filter {
|
||||||
@ -627,7 +628,7 @@ class MapUnit {
|
|||||||
actions.add {
|
actions.add {
|
||||||
val tech = researchableAncientEraTechs.random(tileBasedRandom).name
|
val tech = researchableAncientEraTechs.random(tileBasedRandom).name
|
||||||
civInfo.tech.addTechnology(tech)
|
civInfo.tech.addTechnology(tech)
|
||||||
civInfo.addNotification("We have discovered the lost technology of [$tech] in the ruins!", tile.position, Color.BLUE)
|
civInfo.addNotification("We have discovered the lost technology of [$tech] in the ruins!", tile.position, NotificationType.Science)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -656,7 +657,7 @@ class MapUnit {
|
|||||||
|
|
||||||
actions.add {
|
actions.add {
|
||||||
civInfo.policies.addCulture(20)
|
civInfo.policies.addCulture(20)
|
||||||
civInfo.addNotification("We have discovered cultural artifacts in the ruins! (+20 Culture)", tile.position, Color.GOLD)
|
civInfo.addNotification("We have discovered cultural artifacts in the ruins! (+20 Culture)", tile.position, NotificationType.Culture)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Map of the surrounding area
|
// Map of the surrounding area
|
||||||
|
@ -33,7 +33,9 @@ class NotificationsScroll(internal val worldScreen: WorldScreen) : ScrollPane(nu
|
|||||||
val label = notification.text.toLabel(Color.BLACK, 30)
|
val label = notification.text.toLabel(Color.BLACK, 30)
|
||||||
val listItem = Table()
|
val listItem = Table()
|
||||||
|
|
||||||
listItem.add(ImageGetter.getCircle()
|
if (notification.notificationType != null)
|
||||||
|
listItem.add(ImageGetter.getImage("NotificationIcons/" + notification.notificationType!!.name)).size(20f).padRight(5f)
|
||||||
|
else listItem.add(ImageGetter.getCircle()
|
||||||
.apply { color = notification.color }).size(20f).padRight(5f)
|
.apply { color = notification.color }).size(20f).padRight(5f)
|
||||||
listItem.background = ImageGetter.getRoundedEdgeTableBackground().apply { setScale(0.5f) }
|
listItem.background = ImageGetter.getRoundedEdgeTableBackground().apply { setScale(0.5f) }
|
||||||
listItem.add(label)
|
listItem.add(label)
|
||||||
|