Resolved #803 - Heal Instantly didn't update health in unit icon

This commit is contained in:
Yair Morgenstern 2019-05-26 16:16:42 +03:00
parent 408dfcfc7e
commit f78f9c2fad
2 changed files with 10 additions and 2 deletions

View file

@ -28,6 +28,7 @@ class PromotionPickerScreen(mapUnit: MapUnit) : PickerScreen() {
if(mapUnit.promotions.canBePromoted()) game.screen = PromotionPickerScreen(mapUnit)
else game.setWorldScreen()
dispose()
game.worldScreen.shouldUpdate=true
}
rightSideButton.setText("Pick promotion".tr())

View file

@ -2,7 +2,10 @@ package com.unciv.ui.worldscreen.unit
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.scenes.scene2d.Touchable
import com.badlogic.gdx.scenes.scene2d.ui.*
import com.badlogic.gdx.scenes.scene2d.ui.Image
import com.badlogic.gdx.scenes.scene2d.ui.Label
import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup
import com.unciv.UnCivGame
import com.unciv.logic.battle.CityCombatant
import com.unciv.logic.city.CityInfo
@ -108,7 +111,11 @@ class UnitTable(val worldScreen: WorldScreen) : Table(){
val unit = selectedUnit!!
var nameLabelText = unit.name.tr()
if(unit.health<100) nameLabelText+=" ("+unit.health+")"
unitNameLabel.setText(nameLabelText)
if(nameLabelText!=unitNameLabel.text.toString()){
unitNameLabel.setText(nameLabelText)
selectedUnitHasChanged=true // We need to reload the health bar of the unit in the icon - happens e.g. when picking the Heal Instantly promotion
}
unitDescriptionTable.clear()
unitDescriptionTable.defaults().pad(2f)