Notification scroll categories improved

This commit is contained in:
Yair Morgenstern 2023-01-12 18:01:19 +02:00
parent d9a51fc566
commit 5c4798442d
8 changed files with 23 additions and 16 deletions

View File

@ -171,7 +171,7 @@ class CityExpansionManager : IsPartOfGameInfoSerialization {
val location = addNewTileWithCulture()
if (location != null) {
val locations = LocationAction(location, cityInfo.location)
cityInfo.civInfo.addNotification("[" + cityInfo.name + "] has expanded its borders!", locations, NotificationCategory.City, NotificationIcon.Culture)
cityInfo.civInfo.addNotification("[" + cityInfo.name + "] has expanded its borders!", locations, NotificationCategory.Cities, NotificationIcon.Culture)
}
}
}

View File

@ -72,7 +72,7 @@ class PopulationManager : IsPartOfGameInfoSerialization {
foodStored += food
if (food < 0)
cityInfo.civInfo.addNotification("[${cityInfo.name}] is starving!",
cityInfo.location, NotificationCategory.City, NotificationIcon.Growth, NotificationIcon.Death)
cityInfo.location, NotificationCategory.Cities, NotificationIcon.Growth, NotificationIcon.Death)
if (foodStored < 0) { // starvation!
if (population > 1) addPopulation(-1)
foodStored = 0
@ -89,7 +89,7 @@ class PopulationManager : IsPartOfGameInfoSerialization {
addPopulation(1)
cityInfo.updateCitizens = true
cityInfo.civInfo.addNotification("[${cityInfo.name}] has grown!", cityInfo.location,
NotificationCategory.City, NotificationIcon.Growth)
NotificationCategory.Cities, NotificationIcon.Growth)
}
}

View File

@ -165,13 +165,13 @@ class CivInfoTransientUpdater(val civInfo: CivilizationInfo) {
for (city in citiesReachedToMediums.keys)
if (city !in civInfo.citiesConnectedToCapitalToMediums && city.civInfo == civInfo && city != civInfo.getCapital()!!)
civInfo.addNotification("[${city.name}] has been connected to your capital!",
city.location, NotificationCategory.City, NotificationIcon.Gold)
city.location, NotificationCategory.Cities, NotificationIcon.Gold)
// This may still contain cities that have just been destroyed by razing - thus the population test
for (city in civInfo.citiesConnectedToCapitalToMediums.keys)
if (!citiesReachedToMediums.containsKey(city) && city.civInfo == civInfo && city.population.population > 0)
civInfo.addNotification("[${city.name}] has been disconnected from your capital!",
city.location, NotificationCategory.City, NotificationIcon.Gold)
city.location, NotificationCategory.Cities, NotificationIcon.Gold)
}
civInfo.citiesConnectedToCapitalToMediums = citiesReachedToMediums

View File

@ -48,7 +48,7 @@ enum class NotificationCategory{
Units,
War,
Religion,
City
Cities
}
/**

View File

@ -223,7 +223,7 @@ object UniqueTriggerActivation {
civInfo.addNotification(
notification,
LocationAction(applicableCities.map { it.location }),
NotificationCategory.City,
NotificationCategory.Cities,
NotificationIcon.Population
)
return applicableCities.any()
@ -240,7 +240,7 @@ object UniqueTriggerActivation {
civInfo.addNotification(
notificationText,
LocationAction(randomCity.location, tile?.position),
NotificationCategory.City,
NotificationCategory.Cities,
NotificationIcon.Population
)
}

View File

@ -82,7 +82,8 @@ class NotificationsOverviewTable(
val categoryNotifications = notifications.filter { it.category == category.name }
if (categoryNotifications.isEmpty()) continue
turnTable.add(category.name.toLabel()).pad(3f).row()
if (category != NotificationCategory.General)
turnTable.add(category.name.toLabel()).pad(3f).row()
for (notification in categoryNotifications) {
val notificationTable = Table(BaseScreen.skin)

View File

@ -78,15 +78,21 @@ class NotificationsScroll(
val categoryNotifications = reversedNotifications.filter { it.category == category.name }
if (categoryNotifications.isEmpty()) continue
notificationsTable.add(Table().apply {
add(ImageGetter.getWhiteDot()).minHeight(2f).width(worldScreen.stage.width/8)
add(category.name.toLabel(fontSize = 20)).pad(3f)
add(ImageGetter.getWhiteDot()).minHeight(2f).width(worldScreen.stage.width/8)
}).row()
val backgroundDrawable = BaseScreen.skinStrings.getUiBackground("WorldScreen/Notification", BaseScreen.skinStrings.roundedEdgeRectangleShape)
if (category != NotificationCategory.General)
notificationsTable.add(Table().apply {
add(ImageGetter.getWhiteDot()).minHeight(2f).width(worldScreen.stage.width/8)
add(Table().apply {
background = backgroundDrawable
add(category.name.toLabel(fontSize = 30, fontColor = Color.BLACK))
}).pad(3f)
add(ImageGetter.getWhiteDot()).minHeight(2f).width(worldScreen.stage.width/8)
}).row()
for (notification in categoryNotifications) {
val listItem = Table()
listItem.background = BaseScreen.skinStrings.getUiBackground("WorldScreen/Notification", BaseScreen.skinStrings.roundedEdgeRectangleShape)
listItem.background = backgroundDrawable
val labelWidth = maxEntryWidth - iconSize * notification.icons.size - 10f
val label = WrappableLabel(notification.text, labelWidth, Color.BLACK, 30)

View File

@ -828,7 +828,7 @@ object UnitActions {
for (otherCiv in civsToNotify)
otherCiv.addNotification("Your territory has been stolen by [${unit.civInfo}]!",
unit.currentTile.position, NotificationCategory.City, unit.civInfo.civName, NotificationIcon.War)
unit.currentTile.position, NotificationCategory.Cities, unit.civInfo.civName, NotificationIcon.War)
}
private fun addFortifyActions(actionList: ArrayList<UnitAction>, unit: MapUnit, showingAdditionalActions: Boolean) {