mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-01 10:25:57 +07:00
City attack notifications show icon
This commit is contained in:
parent
eda9ceb140
commit
51125b68a8
@ -14,6 +14,7 @@ import com.unciv.logic.map.TileInfo
|
||||
import com.unciv.models.AttackableTile
|
||||
import com.unciv.models.ruleset.Unique
|
||||
import com.unciv.models.ruleset.unit.UnitType
|
||||
import com.unciv.ui.utils.ImageGetter
|
||||
import java.util.*
|
||||
import kotlin.math.max
|
||||
|
||||
@ -174,7 +175,10 @@ object Battle {
|
||||
else " [" + defender.getName() + "]"
|
||||
else " our [" + defender.getName() + "]"
|
||||
val notificationString = attackerString + whatHappenedString + defenderString
|
||||
defender.getCivInfo().addNotification(notificationString, attackedTile.position, attacker.getName(), NotificationIcon.War, defender.getName())
|
||||
val cityIcon = "ImprovementIcons/Citadel"
|
||||
val attackerIcon = if (attacker is CityCombatant) cityIcon else attacker.getName()
|
||||
val defenderIcon = if (defender is CityCombatant) cityIcon else defender.getName()
|
||||
defender.getCivInfo().addNotification(notificationString, attackedTile.position, attackerIcon, NotificationIcon.War, defenderIcon)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ object NotificationIcon {
|
||||
val Trade = "StatIcons/Acquire"
|
||||
val Science = "StatIcons/Science"
|
||||
val Gold = "StatIcons/Gold"
|
||||
val Death = "OtherIcons/DisbandUnit"
|
||||
val Dehas ath = "OtherIcons/DisbandUnit"
|
||||
val Diplomacy = "OtherIcons/Diplomacy"
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@ class NotificationsScroll(internal val worldScreen: WorldScreen) : ScrollPane(nu
|
||||
init {
|
||||
actor = notificationsTable.right()
|
||||
touchable = Touchable.childrenOnly
|
||||
setScale(.5f)
|
||||
}
|
||||
|
||||
internal fun update(notifications: MutableList<Notification>) {
|
||||
@ -49,7 +50,7 @@ class NotificationsScroll(internal val worldScreen: WorldScreen) : ScrollPane(nu
|
||||
}
|
||||
else if(notification.color!=null) listItem.add(ImageGetter.getCircle()
|
||||
.apply { color = notification.color }).size(iconSize).padRight(5f)
|
||||
listItem.background = ImageGetter.getRoundedEdgeTableBackground().apply { setScale(0.5f) }
|
||||
listItem.background = ImageGetter.getRoundedEdgeTableBackground()
|
||||
listItem.add(label)
|
||||
|
||||
// using a large click area with no gap in between each message item.
|
||||
@ -57,9 +58,7 @@ class NotificationsScroll(internal val worldScreen: WorldScreen) : ScrollPane(nu
|
||||
val clickArea = Table().apply {
|
||||
add(listItem).pad(3f)
|
||||
touchable = Touchable.enabled
|
||||
onClick {
|
||||
notification.action?.execute(worldScreen)
|
||||
}
|
||||
onClick { notification.action?.execute(worldScreen) }
|
||||
}
|
||||
|
||||
notificationsTable.add(clickArea).right().row()
|
||||
|
Loading…
Reference in New Issue
Block a user