mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-04 15:27:50 +07:00
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:
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
Reference in New Issue
Block a user