Added icons to improvement picker screen

This commit is contained in:
Yair Morgenstern 2018-05-25 12:01:06 +03:00
parent 53ff1290e8
commit 389c489faf
4 changed files with 13 additions and 9 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@ -1,12 +1,15 @@
package com.unciv.ui.pickerscreens
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.scenes.scene2d.ui.Button
import com.badlogic.gdx.scenes.scene2d.ui.Label
import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup
import com.unciv.logic.map.TileInfo
import com.unciv.models.gamebasics.GameBasics
import com.unciv.models.gamebasics.TileImprovement
import com.unciv.ui.cityscreen.addClickListener
import com.unciv.ui.utils.CameraStageBaseScreen
import com.unciv.ui.utils.ImageGetter
import com.unciv.ui.utils.setFontColor
class ImprovementPickerScreen(tileInfo: TileInfo) : PickerScreen() {
private var selectedImprovement: TileImprovement? = null
@ -25,17 +28,18 @@ class ImprovementPickerScreen(tileInfo: TileInfo) : PickerScreen() {
regularImprovements.space(10f)
for (improvement in GameBasics.TileImprovements.values) {
if (!tileInfo.canBuildImprovement(improvement, civInfo) || improvement.name == tileInfo.improvement) continue
val improvementTextButton = TextButton(
improvement.name + "\r\n" + improvement.getTurnsToBuild(civInfo) + " turns",
CameraStageBaseScreen.skin
)
val improvementButton = Button(skin)
improvementTextButton.addClickListener {
improvementButton.add(ImageGetter.getImprovementIcon(improvement.name)).size(30f).pad(10f)
improvementButton.add(Label(improvement.name + " - " + improvement.getTurnsToBuild(civInfo) + " turns",skin)
.setFontColor(Color.WHITE)).pad(10f)
improvementButton.addClickListener {
selectedImprovement = improvement
pick(improvement.name)
descriptionLabel.setText(improvement.description)
}
regularImprovements.addActor(improvementTextButton)
regularImprovements.addActor(improvementButton)
}
topTable.add(regularImprovements)
}

View File

@ -17,7 +17,7 @@ class WorldScreenTopBar(val screen: WorldScreen) : Table() {
val labelSkin = CameraStageBaseScreen.skin
private val turnsLabel = Label("Turns: 0/400",labelSkin)
private val turnsLabel = Label("Turns: 0/400",labelSkin).setFontColor(Color.WHITE)
private val goldLabel = Label("Gold:", labelSkin).setFontColor(colorFromRGB(225, 217, 71) )
private val scienceLabel = Label("Science:", labelSkin).setFontColor(colorFromRGB(78, 140, 151) )
private val happinessLabel = Label("Happiness:", labelSkin)