mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-09 23:39:40 +07:00
Unit Overview: Improving a tile is also "what the unit is doing" (#9482)
* Unit Overview: Improving a tile is also "what the unit is doing" * Unit Overview automated worker actions
This commit is contained in:
BIN
android/Images/EmojiIcons/Automate.png
Normal file
BIN
android/Images/EmojiIcons/Automate.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
@ -39,100 +39,107 @@ CityStateIcons/Religious
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
EmojiIcons/Culture
|
||||
EmojiIcons/Automate
|
||||
rotate: false
|
||||
xy: 436, 316
|
||||
xy: 436, 432
|
||||
size: 50, 50
|
||||
orig: 50, 50
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
EmojiIcons/Death
|
||||
EmojiIcons/Culture
|
||||
rotate: false
|
||||
xy: 436, 258
|
||||
size: 50, 50
|
||||
orig: 50, 50
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
EmojiIcons/Faith
|
||||
EmojiIcons/Death
|
||||
rotate: false
|
||||
xy: 436, 200
|
||||
size: 50, 50
|
||||
orig: 50, 50
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
EmojiIcons/Food
|
||||
EmojiIcons/Faith
|
||||
rotate: false
|
||||
xy: 436, 142
|
||||
size: 50, 50
|
||||
orig: 50, 50
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
EmojiIcons/Gold
|
||||
EmojiIcons/Food
|
||||
rotate: false
|
||||
xy: 436, 26
|
||||
xy: 436, 84
|
||||
size: 50, 50
|
||||
orig: 50, 50
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
EmojiIcons/Great Artist
|
||||
EmojiIcons/Gold
|
||||
rotate: false
|
||||
xy: 494, 432
|
||||
size: 50, 50
|
||||
orig: 50, 50
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
EmojiIcons/Great Engineer
|
||||
EmojiIcons/Great Artist
|
||||
rotate: false
|
||||
xy: 494, 374
|
||||
size: 50, 50
|
||||
orig: 50, 50
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
EmojiIcons/Great General
|
||||
EmojiIcons/Great Engineer
|
||||
rotate: false
|
||||
xy: 494, 316
|
||||
size: 50, 50
|
||||
orig: 50, 50
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
EmojiIcons/Great Merchant
|
||||
EmojiIcons/Great General
|
||||
rotate: false
|
||||
xy: 494, 258
|
||||
size: 50, 50
|
||||
orig: 50, 50
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
EmojiIcons/Great Scientist
|
||||
EmojiIcons/Great Merchant
|
||||
rotate: false
|
||||
xy: 494, 200
|
||||
size: 50, 50
|
||||
orig: 50, 50
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
EmojiIcons/Happiness
|
||||
EmojiIcons/Great Scientist
|
||||
rotate: false
|
||||
xy: 494, 142
|
||||
size: 50, 50
|
||||
orig: 50, 50
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
EmojiIcons/Happiness
|
||||
rotate: false
|
||||
xy: 494, 84
|
||||
size: 50, 50
|
||||
orig: 50, 50
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
EmojiIcons/Production
|
||||
rotate: false
|
||||
xy: 552, 273
|
||||
xy: 552, 215
|
||||
size: 50, 50
|
||||
orig: 50, 50
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
EmojiIcons/Science
|
||||
rotate: false
|
||||
xy: 552, 99
|
||||
xy: 552, 41
|
||||
size: 50, 50
|
||||
orig: 50, 50
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
EmojiIcons/Turn
|
||||
rotate: false
|
||||
xy: 544, 1087
|
||||
xy: 544, 1029
|
||||
size: 50, 50
|
||||
orig: 50, 50
|
||||
offset: 0, 0
|
||||
@ -503,7 +510,7 @@ StatIcons/Movement
|
||||
index: -1
|
||||
OtherIcons/BackArrow
|
||||
rotate: false
|
||||
xy: 436, 432
|
||||
xy: 436, 374
|
||||
size: 50, 50
|
||||
orig: 50, 50
|
||||
offset: 0, 0
|
||||
@ -580,7 +587,7 @@ OtherIcons/Cities
|
||||
index: -1
|
||||
OtherIcons/CityState
|
||||
rotate: false
|
||||
xy: 436, 374
|
||||
xy: 436, 316
|
||||
size: 50, 50
|
||||
orig: 50, 50
|
||||
offset: 0, 0
|
||||
@ -636,7 +643,7 @@ OtherIcons/Fire
|
||||
index: -1
|
||||
OtherIcons/ForwardArrow
|
||||
rotate: false
|
||||
xy: 436, 84
|
||||
xy: 436, 26
|
||||
size: 50, 50
|
||||
orig: 50, 50
|
||||
offset: 0, 0
|
||||
@ -657,7 +664,7 @@ OtherIcons/HexagonOutline
|
||||
index: -1
|
||||
OtherIcons/Improvements
|
||||
rotate: false
|
||||
xy: 494, 84
|
||||
xy: 494, 26
|
||||
size: 50, 50
|
||||
orig: 50, 50
|
||||
offset: 0, 0
|
||||
@ -671,7 +678,7 @@ OtherIcons/Keyboard
|
||||
index: -1
|
||||
OtherIcons/Link
|
||||
rotate: false
|
||||
xy: 527, 505
|
||||
xy: 552, 447
|
||||
size: 50, 50
|
||||
orig: 50, 50
|
||||
offset: 0, 0
|
||||
@ -706,7 +713,7 @@ NotificationIcons/Working
|
||||
index: -1
|
||||
OtherIcons/LockSmall
|
||||
rotate: false
|
||||
xy: 552, 447
|
||||
xy: 552, 389
|
||||
size: 50, 50
|
||||
orig: 50, 50
|
||||
offset: 0, 0
|
||||
@ -748,7 +755,7 @@ OtherIcons/NationSwap
|
||||
index: -1
|
||||
OtherIcons/Nations
|
||||
rotate: false
|
||||
xy: 552, 389
|
||||
xy: 552, 331
|
||||
size: 50, 50
|
||||
orig: 50, 50
|
||||
offset: 0, 0
|
||||
@ -776,7 +783,7 @@ OtherIcons/Options
|
||||
index: -1
|
||||
OtherIcons/Pause
|
||||
rotate: false
|
||||
xy: 552, 331
|
||||
xy: 552, 273
|
||||
size: 50, 50
|
||||
orig: 50, 50
|
||||
offset: 0, 0
|
||||
@ -1287,7 +1294,7 @@ StatIcons/Happiness
|
||||
index: -1
|
||||
StatIcons/InterceptRange
|
||||
rotate: false
|
||||
xy: 494, 26
|
||||
xy: 527, 505
|
||||
size: 50, 50
|
||||
orig: 50, 50
|
||||
offset: 0, 0
|
||||
@ -1315,14 +1322,14 @@ TileIcons/Worked
|
||||
index: -1
|
||||
StatIcons/Range
|
||||
rotate: false
|
||||
xy: 552, 215
|
||||
xy: 552, 157
|
||||
size: 50, 50
|
||||
orig: 50, 50
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
StatIcons/RangedStrength
|
||||
rotate: false
|
||||
xy: 552, 157
|
||||
xy: 552, 99
|
||||
size: 50, 50
|
||||
orig: 50, 50
|
||||
offset: 0, 0
|
||||
@ -1350,7 +1357,7 @@ StatIcons/Specialist
|
||||
index: -1
|
||||
StatIcons/Strength
|
||||
rotate: false
|
||||
xy: 552, 41
|
||||
xy: 544, 1087
|
||||
size: 50, 50
|
||||
orig: 50, 50
|
||||
offset: 0, 0
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 517 KiB After Width: | Height: | Size: 519 KiB |
@ -48,7 +48,7 @@ class FontFamilyData(
|
||||
val filePath: String? = null
|
||||
) {
|
||||
|
||||
// For serialization
|
||||
@Suppress("unused") // For serialization
|
||||
constructor() : this(default.localName, default.invariantName)
|
||||
|
||||
// Implement kotlin equality contract such that _only_ the invariantName field is compared.
|
||||
@ -138,29 +138,7 @@ class NativeBitmapFontData(
|
||||
private fun getPixmapFromChar(ch: Char): Pixmap {
|
||||
// Images must be 50*50px so they're rendered at the same height as the text - see Fonts.ORIGINAL_FONT_SIZE
|
||||
return when (ch) {
|
||||
Fonts.strength -> getPixmap("StatIcons/Strength")
|
||||
Fonts.rangedStrength -> getPixmap("StatIcons/RangedStrength")
|
||||
Fonts.range -> getPixmap("StatIcons/Range")
|
||||
Fonts.movement -> getPixmap("StatIcons/Movement")
|
||||
Fonts.turn -> getPixmap("EmojiIcons/Turn")
|
||||
Fonts.production -> getPixmap("EmojiIcons/Production")
|
||||
Fonts.gold -> getPixmap("EmojiIcons/Gold")
|
||||
Fonts.food -> getPixmap("EmojiIcons/Food")
|
||||
Fonts.science -> getPixmap("EmojiIcons/Science")
|
||||
Fonts.culture -> getPixmap("EmojiIcons/Culture")
|
||||
Fonts.faith -> getPixmap("EmojiIcons/Faith")
|
||||
Fonts.happiness -> getPixmap("EmojiIcons/Happiness")
|
||||
Fonts.greatArtist -> getPixmap("EmojiIcons/Great Artist")
|
||||
Fonts.greatEngineer -> getPixmap("EmojiIcons/Great Engineer")
|
||||
Fonts.greatGeneral -> getPixmap("EmojiIcons/Great General")
|
||||
Fonts.greatMerchant -> getPixmap("EmojiIcons/Great Merchant")
|
||||
Fonts.greatScientist -> getPixmap("EmojiIcons/Great Scientist")
|
||||
Fonts.death -> getPixmap("EmojiIcons/Death")
|
||||
|
||||
MayaCalendar.tun -> getPixmap(MayaCalendar.tunIcon)
|
||||
MayaCalendar.katun -> getPixmap(MayaCalendar.katunIcon)
|
||||
MayaCalendar.baktun -> getPixmap(MayaCalendar.baktunIcon)
|
||||
in MayaCalendar.digits -> getPixmap(MayaCalendar.digitIcon(ch))
|
||||
in Fonts.allSymbols -> getPixmap(Fonts.allSymbols[ch]!!)
|
||||
in Fonts.charToRulesetImageActor ->
|
||||
try {
|
||||
// This sometimes fails with a "Frame buffer couldn't be constructed: incomplete attachment" error, unclear why
|
||||
@ -249,7 +227,7 @@ object Fonts {
|
||||
val rulesetObjectNameToChar =HashMap<String, Char>()
|
||||
val charToRulesetImageActor = HashMap<Char, Actor>()
|
||||
// See https://en.wikipedia.org/wiki/Private_Use_Areas - char encodings 57344 63743 are not assigned
|
||||
var nextUnusedCharacterNumber = 57344
|
||||
private var nextUnusedCharacterNumber = 57344
|
||||
fun addRulesetImages(ruleset:Ruleset) {
|
||||
rulesetObjectNameToChar.clear()
|
||||
charToRulesetImageActor.clear()
|
||||
@ -290,8 +268,8 @@ object Fonts {
|
||||
}
|
||||
}
|
||||
|
||||
val frameBuffer by lazy { FrameBuffer(Pixmap.Format.RGBA8888, Gdx.graphics.width, Gdx.graphics.height, false) }
|
||||
val spriteBatch by lazy { SpriteBatch() }
|
||||
private val frameBuffer by lazy { FrameBuffer(Pixmap.Format.RGBA8888, Gdx.graphics.width, Gdx.graphics.height, false) }
|
||||
private val spriteBatch by lazy { SpriteBatch() }
|
||||
|
||||
fun getPixmapFromActor(actor: Actor): Pixmap {
|
||||
|
||||
@ -336,19 +314,39 @@ object Fonts {
|
||||
const val culture = '♪' // U+266A 'eighth note' (🎵 U+1F3B5 'musical note')
|
||||
const val happiness = '⌣' // U+2323 'smile' (😀 U+1F600 'grinning face')
|
||||
const val faith = '☮' // U+262E 'peace symbol' (🕊 U+1F54A 'dove of peace')
|
||||
@Suppress("MemberVisibilityCanBePrivate") // offer for mods
|
||||
const val greatArtist = '♬' // U+266C 'sixteenth note'
|
||||
@Suppress("MemberVisibilityCanBePrivate") // offer for mods
|
||||
const val greatEngineer = '⚒' // U+2692 'hammer'
|
||||
@Suppress("MemberVisibilityCanBePrivate") // offer for mods
|
||||
const val greatGeneral = '⛤' // U+26E4 'pentagram'
|
||||
@Suppress("MemberVisibilityCanBePrivate") // offer for mods
|
||||
const val greatMerchant = '⚖' // U+2696 'scale'
|
||||
@Suppress("MemberVisibilityCanBePrivate") // offer for mods
|
||||
const val greatScientist = '⚛' // U+269B 'atom'
|
||||
const val death = '☠' // U+2620 'skull and crossbones'
|
||||
const val automate = '⛏' // U+26CF 'pick'
|
||||
|
||||
val allSymbols = arrayOf<Char>(
|
||||
turn,
|
||||
strength, rangedStrength, range, movement,
|
||||
production, gold, food, science, culture, happiness, faith,
|
||||
greatArtist, greatEngineer, greatGeneral, greatMerchant, greatScientist,
|
||||
death,
|
||||
val allSymbols = mapOf(
|
||||
turn to "EmojiIcons/Turn",
|
||||
strength to "StatIcons/Strength",
|
||||
rangedStrength to "StatIcons/RangedStrength",
|
||||
range to "StatIcons/Range",
|
||||
movement to "StatIcons/Movement",
|
||||
production to "EmojiIcons/Production",
|
||||
gold to "EmojiIcons/Gold",
|
||||
food to "EmojiIcons/Food",
|
||||
science to "EmojiIcons/Science",
|
||||
culture to "EmojiIcons/Culture",
|
||||
happiness to "EmojiIcons/Happiness",
|
||||
faith to "EmojiIcons/Faith",
|
||||
greatArtist to "EmojiIcons/Great Artist",
|
||||
greatEngineer to "EmojiIcons/Great Engineer",
|
||||
greatGeneral to "EmojiIcons/Great General",
|
||||
greatMerchant to "EmojiIcons/Great Merchant",
|
||||
greatScientist to "EmojiIcons/Great Scientist",
|
||||
death to "EmojiIcons/Death",
|
||||
automate to "EmojiIcons/Automate",
|
||||
*MayaCalendar.allSymbols
|
||||
)
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import com.unciv.ui.components.extensions.addSeparator
|
||||
import com.unciv.ui.screens.basescreen.BaseScreen
|
||||
import kotlin.math.abs
|
||||
|
||||
@Suppress("MemberVisibilityCanBePrivate") // stuff only accessed through allSymbols looks cleaner with same visibility
|
||||
object MayaCalendar {
|
||||
// Glyphs / icons
|
||||
private const val iconFolder = "MayaCalendar/"
|
||||
@ -31,12 +32,12 @@ object MayaCalendar {
|
||||
fun digitIcon(ch: Char) = iconFolder + (ch.toCode() - zero.toCode()).toString()
|
||||
|
||||
val allSymbols = sequence {
|
||||
yield(tun)
|
||||
yield(katun)
|
||||
yield(baktun)
|
||||
yieldAll(digits)
|
||||
yield(tun to tunIcon)
|
||||
yield(katun to katunIcon)
|
||||
yield(baktun to baktunIcon)
|
||||
yieldAll(digits.map {it to digitIcon(it)})
|
||||
}.iterator().run {
|
||||
Array<Char>(23) { next() }
|
||||
Array(23) { next() }
|
||||
}
|
||||
|
||||
// Calculation
|
||||
|
@ -153,7 +153,7 @@ class UnitOverviewTab(
|
||||
private fun Table.updateUnitHeaderTable(): Table {
|
||||
defaults().pad(5f)
|
||||
add("Name".toLabel())
|
||||
add()
|
||||
add() // Column: edit-name
|
||||
add("Action".toLabel())
|
||||
add(Fonts.strength.toString().toLabel())
|
||||
add(Fonts.rangedStrength.toString().toLabel())
|
||||
@ -206,13 +206,25 @@ class UnitOverviewTab(
|
||||
add(editIcon)
|
||||
|
||||
// Column: action
|
||||
fun getActionLabel(unit: MapUnit) = when {
|
||||
unit.action == null -> ""
|
||||
fun getWorkerActionText(unit: MapUnit): String? = when {
|
||||
// See UnitTurnManager.endTurn, if..workOnImprovement or UnitGroup.getActionImage: similar logic
|
||||
!unit.cache.hasUniqueToBuildImprovements -> null
|
||||
unit.currentMovement == 0f -> null
|
||||
unit.currentTile.improvementInProgress == null -> null
|
||||
!unit.canBuildImprovement(unit.getTile().getTileImprovementInProgress()!!) -> null
|
||||
else -> unit.currentTile.improvementInProgress
|
||||
}
|
||||
fun getActionText(unit: MapUnit): String? {
|
||||
val workerText by lazy { getWorkerActionText(unit) }
|
||||
return when {
|
||||
unit.action == null -> workerText
|
||||
unit.isFortified() -> UnitActionType.Fortify.value
|
||||
unit.isMoving() -> "Moving"
|
||||
else -> unit.action!!
|
||||
unit.isAutomated() && workerText != null -> "[$workerText] ${Fonts.automate}"
|
||||
else -> unit.action
|
||||
}
|
||||
if (unit.action == null) add() else add(getActionLabel(unit).toLabel())
|
||||
}
|
||||
add(getActionText(unit)?.toLabel())
|
||||
|
||||
// Columns: strength, ranged
|
||||
if (baseUnit.strength > 0) add(baseUnit.strength.toLabel()) else add()
|
||||
|
Reference in New Issue
Block a user