diff --git a/android/assets/skin/flat-earth-ui.json b/android/assets/skin/flat-earth-ui.json index 84a8cddcc5..afc3f4343c 100644 --- a/android/assets/skin/flat-earth-ui.json +++ b/android/assets/skin/flat-earth-ui.json @@ -18,9 +18,9 @@ com.badlogic.gdx.graphics.Color: { a: 1 } color: { - r: 0.3372549 - g: 0.7 - b: 0.44705883 + r: 0.2 + g: 0.3 + b: 0.5 a: 1 } gray: { diff --git a/core/src/com/unciv/ui/EmpireOverviewScreen.kt b/core/src/com/unciv/ui/EmpireOverviewScreen.kt index 353fe2119d..726e2d30e3 100644 --- a/core/src/com/unciv/ui/EmpireOverviewScreen.kt +++ b/core/src/com/unciv/ui/EmpireOverviewScreen.kt @@ -147,6 +147,7 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){ greatPeopleTable.defaults().pad(5f) greatPeopleTable.add(Label("Great person points".tr(), skin).setFontSize(24)).colspan(3).row() + greatPeopleTable.addSeparator() greatPeopleTable.add() greatPeopleTable.add("Current points") greatPeopleTable.add("Points per turn").row() @@ -239,6 +240,8 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){ table.add("Movement".tr()) table.add("Closest city".tr()) table.row() + table.addSeparator() + for(unit in civInfo.getCivUnits()){ val baseUnit = unit.baseUnit() table.add(unit.name.tr()) diff --git a/core/src/com/unciv/ui/tilegroups/TileGroup.kt b/core/src/com/unciv/ui/tilegroups/TileGroup.kt index 69b0b3a65d..54857769f3 100644 --- a/core/src/com/unciv/ui/tilegroups/TileGroup.kt +++ b/core/src/com/unciv/ui/tilegroups/TileGroup.kt @@ -321,7 +321,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() { } if (unit != null && isViewable) { // Tile is visible - newImage = getUnitImage(unit, 25f) + newImage = ImageGetter.getUnitImage(unit, 25f) addActor(newImage) newImage.center(this) newImage.y += yFromCenter @@ -331,37 +331,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() { return newImage } - fun getBackgroundImageForUnit(unit: MapUnit):Image{ - return when { - unit.isEmbarked() -> ImageGetter.getImage("OtherIcons/Banner") - unit.isFortified() -> ImageGetter.getImage("OtherIcons/Shield.png") - else -> ImageGetter.getImage("OtherIcons/Circle.png") - } - } - fun getUnitImage(unit: MapUnit, size: Float): Group { - val unitBaseImage = ImageGetter.getUnitIcon(unit.name, unit.civInfo.getNation().getSecondaryColor()) - .apply { setSize(size*0.75f, size*0.75f) } - - val background = getBackgroundImageForUnit(unit) - background.apply { - this.color = unit.civInfo.getNation().getColor() - setSize(size, size) - } - val group = Group().apply { - setSize(size, size) - addActor(background) - } - unitBaseImage.center(group) - group.addActor(unitBaseImage) - - - if (unit.health < 100) { // add health bar - group.addActor(ImageGetter.getHealthBar(unit.health.toFloat(),100f,size)) - } - - return group - } fun showCircle(color: Color) { diff --git a/core/src/com/unciv/ui/tilegroups/WorldTileGroup.kt b/core/src/com/unciv/ui/tilegroups/WorldTileGroup.kt index cfe0af646e..c6c6b25250 100644 --- a/core/src/com/unciv/ui/tilegroups/WorldTileGroup.kt +++ b/core/src/com/unciv/ui/tilegroups/WorldTileGroup.kt @@ -5,6 +5,7 @@ import com.unciv.logic.city.CityInfo import com.unciv.logic.map.MapUnit import com.unciv.logic.map.TileInfo import com.unciv.ui.utils.CameraStageBaseScreen +import com.unciv.ui.utils.ImageGetter import com.unciv.ui.utils.center @@ -12,7 +13,7 @@ class WorldTileGroup(tileInfo: TileInfo) : TileGroup(tileInfo) { var cityButton: CityButton? = null fun addWhiteHaloAroundUnit(unit: MapUnit) { - val whiteHalo = getBackgroundImageForUnit(unit) + val whiteHalo = ImageGetter.getBackgroundImageForUnit(unit) whiteHalo.setSize(30f,30f) val unitImage = if(unit.type.isCivilian()) civilianUnitImage else militaryUnitImage diff --git a/core/src/com/unciv/ui/utils/CameraStageBaseScreen.kt b/core/src/com/unciv/ui/utils/CameraStageBaseScreen.kt index 815e46d36e..38e2062feb 100644 --- a/core/src/com/unciv/ui/utils/CameraStageBaseScreen.kt +++ b/core/src/com/unciv/ui/utils/CameraStageBaseScreen.kt @@ -197,8 +197,10 @@ fun Image.surroundWithCircle(size:Float): IconCircleGroup { return IconCircleGroup(size,this) } -fun Table.addSeparator(): Image { +fun Table.addSeparator(): Cell { + row() val image = ImageGetter.getWhiteDot() - add(image).colspan(columns).fill().row() - return image + val cell = add(image).colspan(columns).fill() + row() + return cell } \ No newline at end of file diff --git a/core/src/com/unciv/ui/utils/ImageGetter.kt b/core/src/com/unciv/ui/utils/ImageGetter.kt index 7a39ba6cb3..ca506c0255 100644 --- a/core/src/com/unciv/ui/utils/ImageGetter.kt +++ b/core/src/com/unciv/ui/utils/ImageGetter.kt @@ -10,6 +10,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Image import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.scenes.scene2d.utils.Drawable import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable +import com.unciv.logic.map.MapUnit import com.unciv.models.gamebasics.GameBasics import com.unciv.models.gamebasics.tile.ResourceType @@ -157,4 +158,38 @@ object ImageGetter { return healthBar } + + fun getUnitImage(unit: MapUnit, size: Float): Group { + val unitBaseImage = ImageGetter.getUnitIcon(unit.name, unit.civInfo.getNation().getSecondaryColor()) + .apply { setSize(size*0.75f, size*0.75f) } + + val background = getBackgroundImageForUnit(unit) + background.apply { + this.color = unit.civInfo.getNation().getColor() + setSize(size, size) + } + val group = Group().apply { + setSize(size, size) + addActor(background) + } + unitBaseImage.center(group) + group.addActor(unitBaseImage) + + + if (unit.health < 100) { // add health bar + group.addActor(ImageGetter.getHealthBar(unit.health.toFloat(),100f,size)) + } + + return group + } + + fun getBackgroundImageForUnit(unit: MapUnit):Image{ + return when { + unit.isEmbarked() -> ImageGetter.getImage("OtherIcons/Banner") + unit.isFortified() -> ImageGetter.getImage("OtherIcons/Shield.png") + else -> ImageGetter.getImage("OtherIcons/Circle.png") + } + } + + } \ No newline at end of file diff --git a/core/src/com/unciv/ui/worldscreen/TileMapHolder.kt b/core/src/com/unciv/ui/worldscreen/TileMapHolder.kt index c2297708d5..431ec298f0 100644 --- a/core/src/com/unciv/ui/worldscreen/TileMapHolder.kt +++ b/core/src/com/unciv/ui/worldscreen/TileMapHolder.kt @@ -15,7 +15,6 @@ import com.unciv.logic.civilization.CivilizationInfo import com.unciv.logic.map.MapUnit import com.unciv.logic.map.TileInfo import com.unciv.logic.map.TileMap -import com.unciv.ui.tilegroups.TileGroup import com.unciv.ui.tilegroups.WorldTileGroup import com.unciv.ui.utils.* @@ -114,7 +113,7 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap: moveHereButton.addActor(numberCircle) moveHereButton.addActor(Label(turnsToGetThere.toString(), CameraStageBaseScreen.skin).apply { center(numberCircle); setFontColor(Color.WHITE) }) - val unitIcon = TileGroup(TileInfo()).getUnitImage(selectedUnit, size / 2) + val unitIcon = ImageGetter.getUnitImage(selectedUnit, size / 2) unitIcon.y = size - unitIcon.height moveHereButton.addActor(unitIcon) diff --git a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt index 8ea022608d..3a21027621 100644 --- a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt +++ b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt @@ -47,7 +47,7 @@ class WorldScreen : CameraStageBaseScreen() { topBar.y - nextTurnButton.height - 10f) notificationsScroll = NotificationsScroll(this) notificationsScroll.width = stage.width/3 - + val externalMinimapWrapper = Table() val internalMinimapWrapper = Table() internalMinimapWrapper.add(minimap).size(stage.width/5,stage.height/5) diff --git a/core/src/com/unciv/ui/worldscreen/bottombar/BattleTable.kt b/core/src/com/unciv/ui/worldscreen/bottombar/BattleTable.kt index 6f94012475..69b9fd3487 100644 --- a/core/src/com/unciv/ui/worldscreen/bottombar/BattleTable.kt +++ b/core/src/com/unciv/ui/worldscreen/bottombar/BattleTable.kt @@ -53,20 +53,28 @@ class BattleTable(val worldScreen: WorldScreen): Table() { fun simulateBattle(attacker: MapUnitCombatant, defender: ICombatant){ clear() - row().pad(5f) + defaults().pad(5f) + + val attackerNameWrapper = Table() val attackerLabel = Label(attacker.getName(), skin) - .setFontColor(attacker.getCivilization().getNation().getColor()) - add(attackerLabel) +// .setFontColor(attacker.getCivilization().getNation().getColor()) + attackerNameWrapper.add(ImageGetter.getUnitImage(attacker.unit,25f)).padRight(5f) + attackerNameWrapper.add(attackerLabel) + add(attackerNameWrapper) + val defenderNameWrapper = Table() val defenderLabel = Label(defender.getName(), skin) - .setFontColor(defender.getCivilization().getNation().getColor()) - add(defenderLabel) +// .setFontColor(defender.getCivilization().getNation().getColor()) + if(defender is MapUnitCombatant) + defenderNameWrapper.add(ImageGetter.getUnitImage(defender.unit,25f)).padRight(5f) - row().pad(5f) + defenderNameWrapper.add(defenderLabel) + add(defenderNameWrapper).row() + + addSeparator().pad(0f) add("{Strength}: ".tr()+attacker.getAttackingStrength(defender)) - add("{Strength}: ".tr()+defender.getDefendingStrength(attacker)) - row().pad(5f) + add("{Strength}: ".tr()+defender.getDefendingStrength(attacker)).row() val attackerModifiers = BattleDamage().getAttackModifiers(attacker,defender) .map { it.key+": "+(if(it.value>0)"+" else "")+(it.value*100).toInt()+"%" } val defenderModifiers = if (defender is MapUnitCombatant) diff --git a/core/src/com/unciv/ui/worldscreen/unit/UnitTable.kt b/core/src/com/unciv/ui/worldscreen/unit/UnitTable.kt index 4a73084919..d9b5fa8a8e 100644 --- a/core/src/com/unciv/ui/worldscreen/unit/UnitTable.kt +++ b/core/src/com/unciv/ui/worldscreen/unit/UnitTable.kt @@ -5,7 +5,6 @@ import com.badlogic.gdx.scenes.scene2d.ui.Label import com.badlogic.gdx.scenes.scene2d.ui.Table import com.unciv.logic.map.MapUnit import com.unciv.logic.map.TileInfo -import com.unciv.ui.tilegroups.TileGroup import com.unciv.ui.utils.* import com.unciv.ui.worldscreen.WorldScreen @@ -33,7 +32,7 @@ class UnitTable(val worldScreen: WorldScreen) : Table(){ add(unitNameLabel).pad(5f) add(nextIdleUnitButton) }).colspan(2).row() - separator= addSeparator() + separator= addSeparator().actor!! add(promotionsTable).colspan(2).row() add(unitDescriptionTable) } @@ -110,7 +109,7 @@ class UnitTable(val worldScreen: WorldScreen) : Table(){ unitDescriptionTable.clearListeners() if(selectedUnit!=null) { - unitIconHolder.add(TileGroup(TileInfo()).getUnitImage(selectedUnit!!,30f)).pad(5f) + unitIconHolder.add(ImageGetter.getUnitImage(selectedUnit!!,30f)).pad(5f) for(promotion in selectedUnit!!.promotions.promotions) promotionsTable.add(ImageGetter.getPromotionIcon(promotion)).size(20f)