Tech order is displayed in a much nicer, more standardized, and overall much more professional way.

This is one of the small things that's been bugging me for a while
This commit is contained in:
Yair Morgenstern
2022-01-23 19:04:23 +02:00
parent 6a8f88f202
commit f7b99541a1
2 changed files with 14 additions and 2 deletions

View File

@ -2,6 +2,7 @@ package com.unciv.ui.pickerscreens
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.scenes.scene2d.Touchable
import com.badlogic.gdx.scenes.scene2d.ui.Button
import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.badlogic.gdx.utils.Align
import com.unciv.logic.civilization.TechManager
@ -9,6 +10,7 @@ import com.unciv.ui.utils.*
class TechButton(techName:String, private val techManager: TechManager, isWorldScreen: Boolean = true) : Table(BaseScreen.skin) {
val text = "".toLabel().apply { setAlignment(Align.center) }
var orderIndicator: IconCircleGroup? = null
init {
touchable = Touchable.enabled
@ -86,4 +88,13 @@ class TechButton(techName:String, private val techManager: TechManager, isWorldS
else rightSide.add(techEnabledIcons)
.minWidth(225f)
}
fun addOrderIndicator(number:Int){
orderIndicator = number.toString().toLabel(fontSize = 18)
.apply { setAlignment(Align.center) }
.surroundWithCircle(25f, color = ImageGetter.getBlue())
.surroundWithCircle(27f,false)
orderIndicator!!.setPosition(0f, height, Align.topLeft)
addActor(orderIndicator)
}
}

View File

@ -163,12 +163,13 @@ class TechPickerScreen(
var text = techName.tr()
if (techName == selectedTech?.name) {
if (techName == selectedTech?.name && techButton.color != currentTechColor) {
techButton.color = techButton.color.cpy().lerp(Color.BLACK, 0.5f)
}
techButton.orderIndicator?.remove()
if (tempTechsToResearch.contains(techName) && tempTechsToResearch.size > 1) {
text += " (" + tempTechsToResearch.indexOf(techName) + ")"
techButton.addOrderIndicator(tempTechsToResearch.indexOf(techName) + 1)
}
if (!civTech.isResearched(techName) || techName == Constants.futureTech)