Added building icons!
There are now images of the current construction in the construction picker screen, the city screen and the world map!
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 644 KiB After Width: | Height: | Size: 627 KiB |
@ -21,8 +21,8 @@ android {
|
||||
applicationId "com.unciv.game"
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 26
|
||||
versionCode 131
|
||||
versionName "2.7.15"
|
||||
versionCode 132
|
||||
versionName "2.8.0"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
|
@ -90,7 +90,7 @@ class CityConstructions {
|
||||
internal fun getBuiltBuildings(): List<Building> = builtBuildings.map { GameBasics.Buildings[it]!! }
|
||||
|
||||
|
||||
private fun getWorkDone(constructionName: String): Int {
|
||||
fun getWorkDone(constructionName: String): Int {
|
||||
if (inProgressConstructions.containsKey(constructionName)) return inProgressConstructions[constructionName]!!
|
||||
else return 0
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.unciv.ui.cityscreen
|
||||
|
||||
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.Table
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
|
||||
@ -43,14 +45,18 @@ class CityStatsTable(val cityScreen: CityScreen) : Table(){
|
||||
row()
|
||||
}
|
||||
|
||||
|
||||
val buildingPickButton = Button(CameraStageBaseScreen.skin)
|
||||
val buildingText = city.cityConstructions.getCityProductionTextForCityButton()
|
||||
val buildingPickButton = TextButton(buildingText, CameraStageBaseScreen.skin)
|
||||
buildingPickButton.add(ImageGetter.getConstructionImage(city.cityConstructions.currentConstruction))
|
||||
.size(40f).padRight(5f)
|
||||
buildingPickButton.add(Label(buildingText , CameraStageBaseScreen.skin).setFontColor(Color.WHITE))
|
||||
buildingPickButton.addClickListener {
|
||||
UnCivGame.Current.screen = ConstructionPickerScreen(city)
|
||||
cityScreen.dispose()
|
||||
}
|
||||
buildingPickButton.pack()
|
||||
|
||||
buildingPickButton.label.setFontScale(buttonScale)
|
||||
add(buildingPickButton).colspan(2).pad(10f)
|
||||
.size(buildingPickButton.width * buttonScale, buildingPickButton.height * buttonScale)
|
||||
|
||||
@ -69,7 +75,6 @@ class CityStatsTable(val cityScreen: CityScreen) : Table(){
|
||||
if (buildingGoldCost > city.civInfo.gold) {
|
||||
buildingBuyButton.disable()
|
||||
}
|
||||
buildingBuyButton.label.setFontScale(buttonScale)
|
||||
add(buildingBuyButton).colspan(2).pad(10f)
|
||||
.size(buildingBuyButton.width * buttonScale, buildingBuyButton.height * buttonScale)
|
||||
}
|
||||
|
@ -1,21 +1,26 @@
|
||||
package com.unciv.ui.pickerscreens
|
||||
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
|
||||
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.city.CityInfo
|
||||
import com.unciv.logic.city.SpecialConstruction
|
||||
import com.unciv.models.gamebasics.GameBasics
|
||||
import com.unciv.ui.cityscreen.CityScreen
|
||||
import com.unciv.ui.utils.ImageGetter
|
||||
import com.unciv.ui.utils.addClickListener
|
||||
import com.unciv.ui.utils.setFontColor
|
||||
import com.unciv.ui.utils.tr
|
||||
|
||||
class ConstructionPickerScreen(val city: CityInfo) : PickerScreen() {
|
||||
private var selectedProduction: String? = null
|
||||
|
||||
private fun getProductionButton(production: String, buttonText: String,
|
||||
description: String?, rightSideButtonText: String): TextButton {
|
||||
val productionTextButton = TextButton(buttonText, skin)
|
||||
description: String?, rightSideButtonText: String): Button {
|
||||
val productionTextButton = Button(skin)
|
||||
productionTextButton.add(ImageGetter.getConstructionImage(production)).size(40f).padRight(5f)
|
||||
productionTextButton.add(Label(buttonText,skin).setFontColor(Color.WHITE))
|
||||
productionTextButton.addClickListener {
|
||||
selectedProduction = production
|
||||
pick(rightSideButtonText)
|
||||
|
@ -1,11 +1,15 @@
|
||||
package com.unciv.ui.tilegroups
|
||||
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.scenes.scene2d.Group
|
||||
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.city.CityConstructions
|
||||
import com.unciv.logic.city.CityInfo
|
||||
import com.unciv.logic.city.SpecialConstruction
|
||||
import com.unciv.logic.map.MapUnit
|
||||
import com.unciv.logic.map.RoadStatus
|
||||
import com.unciv.logic.map.TileInfo
|
||||
@ -109,9 +113,13 @@ class WorldTileGroup(tileInfo: TileInfo) : TileGroup(tileInfo) {
|
||||
|
||||
else{add()} // this is so the health bar is always 2 columns wide
|
||||
add(label).pad(10f)
|
||||
if(city.civInfo.isPlayerCivilization()) {
|
||||
add(getConstructionGroup(city.cityConstructions)).padRight(5f)
|
||||
}
|
||||
pack()
|
||||
setOrigin(Align.center)
|
||||
toFront()
|
||||
touchable = Touchable.enabled
|
||||
}
|
||||
|
||||
cityButton!!.center(this)
|
||||
@ -119,4 +127,37 @@ class WorldTileGroup(tileInfo: TileInfo) : TileGroup(tileInfo) {
|
||||
}
|
||||
}
|
||||
|
||||
private fun getConstructionGroup(cityConstructions: CityConstructions):Group{
|
||||
val group= Group()
|
||||
val groupHeight = 25f
|
||||
group.setSize(35f,groupHeight)
|
||||
val image = ImageGetter.getConstructionImage(cityConstructions.currentConstruction)
|
||||
image.setSize(20f,20f)
|
||||
image.centerY(group)
|
||||
image.x = group.width-image.width
|
||||
group.addActor(image)
|
||||
|
||||
if(cityConstructions.getCurrentConstruction() !is SpecialConstruction) {
|
||||
val turnsToConstruction = cityConstructions.turnsToConstruction(cityConstructions.currentConstruction)
|
||||
val label = Label(turnsToConstruction.toString(),CameraStageBaseScreen.skin)
|
||||
label.color = Color.BROWN
|
||||
label.setFont(10)
|
||||
label.pack()
|
||||
group.addActor(label)
|
||||
|
||||
val adoptedPolicies = cityConstructions.cityInfo.civInfo.policies.adoptedPolicies
|
||||
val constructionPercentage = cityConstructions.getWorkDone(cityConstructions.currentConstruction) /
|
||||
cityConstructions.getCurrentConstruction().getProductionCost(adoptedPolicies).toFloat()
|
||||
val productionBar = Table()
|
||||
val heightOfProductionBar = (constructionPercentage * groupHeight)
|
||||
productionBar.add(ImageGetter.getImage(ImageGetter.WhiteDot).apply { color = Color.BLACK}).width(2f).height(groupHeight - heightOfProductionBar).row()
|
||||
productionBar.add(ImageGetter.getImage(ImageGetter.WhiteDot).apply { color = Color.BROWN.cpy().lerp(Color.WHITE,0.5f)}).width(2f).height(heightOfProductionBar)
|
||||
productionBar.pack()
|
||||
productionBar.x = 10f
|
||||
label.x = productionBar.x - label.width - 3
|
||||
group.addActor(productionBar)
|
||||
}
|
||||
return group
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -77,6 +77,13 @@ object ImageGetter {
|
||||
return group
|
||||
}
|
||||
|
||||
fun getConstructionImage(construction: String): Image {
|
||||
if(GameBasics.Buildings.containsKey(construction)) return getImage("BuildingIcons/$construction")
|
||||
if(GameBasics.Units.containsKey(construction)) return getUnitIcon(construction)
|
||||
if(construction=="Nothing") return getImage("OtherIcons/Stop")
|
||||
return getStatIcon(construction)
|
||||
}
|
||||
|
||||
fun getPromotionIcon(promotionName:String):Image{
|
||||
return getImage("UnitPromotionIcons/" + promotionName.replace(' ', '_') + "_(Civ5)")
|
||||
}
|
||||
|
@ -2,22 +2,20 @@ package com.unciv.game.desktop;
|
||||
|
||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
|
||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.tools.texturepacker.TexturePacker;
|
||||
import com.unciv.UnCivGame;
|
||||
|
||||
class DesktopLauncher {
|
||||
public static void main (String[] arg) {
|
||||
|
||||
TexturePacker.Settings settings = new TexturePacker.Settings();
|
||||
settings.maxWidth = 2048;
|
||||
settings.maxHeight = 2048;
|
||||
settings.combineSubdirectories=true;
|
||||
|
||||
// This is so they don't look all pixelated
|
||||
settings.filterMag = Texture.TextureFilter.MipMapLinearLinear;
|
||||
settings.filterMin = Texture.TextureFilter.MipMapLinearLinear;
|
||||
TexturePacker.process(settings, "../images", ".", "game");
|
||||
// TexturePacker.Settings settings = new TexturePacker.Settings();
|
||||
// settings.maxWidth = 2048;
|
||||
// settings.maxHeight = 2048;
|
||||
// settings.combineSubdirectories=true;
|
||||
//
|
||||
// // This is so they don't look all pixelated
|
||||
// settings.filterMag = Texture.TextureFilter.MipMapLinearLinear;
|
||||
// settings.filterMin = Texture.TextureFilter.MipMapLinearLinear;
|
||||
// TexturePacker.process(settings, "../images", ".", "game");
|
||||
|
||||
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
|
||||
new LwjglApplication(new UnCivGame(), config);
|
||||
|