mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 05:46:43 -04: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:
parent
6a8f88f202
commit
f7b99541a1
@ -2,6 +2,7 @@ package com.unciv.ui.pickerscreens
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.badlogic.gdx.scenes.scene2d.Touchable
|
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.scenes.scene2d.ui.Table
|
||||||
import com.badlogic.gdx.utils.Align
|
import com.badlogic.gdx.utils.Align
|
||||||
import com.unciv.logic.civilization.TechManager
|
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) {
|
class TechButton(techName:String, private val techManager: TechManager, isWorldScreen: Boolean = true) : Table(BaseScreen.skin) {
|
||||||
val text = "".toLabel().apply { setAlignment(Align.center) }
|
val text = "".toLabel().apply { setAlignment(Align.center) }
|
||||||
|
var orderIndicator: IconCircleGroup? = null
|
||||||
|
|
||||||
init {
|
init {
|
||||||
touchable = Touchable.enabled
|
touchable = Touchable.enabled
|
||||||
@ -86,4 +88,13 @@ class TechButton(techName:String, private val techManager: TechManager, isWorldS
|
|||||||
else rightSide.add(techEnabledIcons)
|
else rightSide.add(techEnabledIcons)
|
||||||
.minWidth(225f)
|
.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()
|
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.color = techButton.color.cpy().lerp(Color.BLACK, 0.5f)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
techButton.orderIndicator?.remove()
|
||||||
if (tempTechsToResearch.contains(techName) && tempTechsToResearch.size > 1) {
|
if (tempTechsToResearch.contains(techName) && tempTechsToResearch.size > 1) {
|
||||||
text += " (" + tempTechsToResearch.indexOf(techName) + ")"
|
techButton.addOrderIndicator(tempTechsToResearch.indexOf(techName) + 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!civTech.isResearched(techName) || techName == Constants.futureTech)
|
if (!civTech.isResearched(techName) || techName == Constants.futureTech)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user