Fixed Ecology image

World screen now also displays icons of tech results
This commit is contained in:
Yair Morgenstern 2018-11-03 19:49:05 +02:00
parent 8b12b80f34
commit 3958ed3cdb
6 changed files with 380 additions and 378 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

File diff suppressed because it is too large Load diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 920 KiB

After

Width:  |  Height:  |  Size: 914 KiB

View file

@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.scenes.scene2d.Touchable
import com.badlogic.gdx.scenes.scene2d.ui.Label
import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.badlogic.gdx.utils.Align
import com.unciv.UnCivGame
import com.unciv.logic.civilization.CivilizationInfo
import com.unciv.logic.civilization.TechManager
@ -37,7 +38,7 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen()
}
class TechButton(techName:String, val techManager:TechManager) : Table(skin) {
val text=Label("",skin).setFontColor(Color.WHITE)
val text=Label("",skin).setFontColor(Color.WHITE).apply { setAlignment(Align.center) }
init {
touchable = Touchable.enabled
defaults().pad(10f)
@ -50,13 +51,13 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen()
val remainingTech = techManager.remainingScienceToTech(techName)
if(techCost!=remainingTech){
val percentComplete = (techCost-remainingTech)/techCost.toFloat()
add(ImageGetter.getProgressBarVertical(2f,30f,percentComplete, Color.BLUE, Color.WHITE))
add(ImageGetter.getProgressBarVertical(2f,50f,percentComplete, Color.BLUE, Color.WHITE))
}
rightSide.add(text).row()
// here we add little images of what the tech gives you
val techEnabledIcons = Table()
techEnabledIcons.defaults().pad(2.5f)
techEnabledIcons.defaults().pad(5f)
for(unit in GameBasics.Units.values.filter { it.requiredTech==techName
&& (it.uniqueTo==null || it.uniqueTo==techManager.civInfo.civName) })

View file

@ -31,7 +31,7 @@ class WorldScreen : CameraStageBaseScreen() {
val bottomBar = WorldScreenBottomBar(this)
val unitActionsTable = UnitActionsTable(this)
private val techButton = Table().apply { background=ImageGetter.getDrawable("OtherIcons/civTableBackground.png").tint(colorFromRGB(7,46,43)); defaults().pad(10f) }
private val techButton = Table()
val diplomacyButtonWrapper = Table()
private val nextTurnButton = createNextTurnButton()
@ -170,19 +170,20 @@ class WorldScreen : CameraStageBaseScreen() {
techButton.isVisible = civInfo.cities.isNotEmpty()
techButton.clearChildren()
if (civInfo.tech.currentTechnology() == null)
techButton.add(Label("{Pick a tech}!".tr(),skin).setFontColor(Color.WHITE).setFont(22))
if (civInfo.tech.currentTechnology() == null) {
val buttonPic = Table().apply { background = ImageGetter.getDrawable("OtherIcons/civTableBackground.png").tint(colorFromRGB(7, 46, 43)); defaults().pad(10f) }
buttonPic.add(Label("{Pick a tech}!".tr(), skin).setFontColor(Color.WHITE).setFont(22))
techButton.add(buttonPic)
}
else {
val tech = civInfo.tech.currentTechnology()!!
if(ImageGetter.techIconExists(tech))
techButton.add(ImageGetter.getTechIconGroup(tech))
val costOfTech = civInfo.tech.costOfTech(tech).toFloat()
val percentComplete = (costOfTech-civInfo.tech.remainingScienceToTech(tech)) / costOfTech
techButton.add(ImageGetter.getProgressBarVertical(2f,30f,percentComplete, Color.BLUE, Color.WHITE))
val turnsToTech = civInfo.tech.turnsToTech(tech)
techButton.add(Label(tech.tr() + "\r\n"
+ turnsToTech + (if(turnsToTech>1) " {turns}".tr() else " {turn}".tr()),skin)
.setFontColor(Color.WHITE).setFont(22))
val currentTech = civInfo.tech.currentTechnology()!!
val innerButton = TechPickerScreen.TechButton(currentTech,civInfo.tech)
innerButton.color = colorFromRGB(7, 46, 43)
techButton.add(innerButton)
val turnsToTech = civInfo.tech.turnsToTech(currentTech)
innerButton.text.setText(currentTech.tr() + "\r\n" + turnsToTech
+ (if(turnsToTech>1) " {turns}".tr() else " {turn}".tr()))
}
techButton.setSize(techButton.prefWidth, techButton.prefHeight)