All 'Turn' and 'Turns' texts changed to a turns icon, much cleaner!
BIN
android/Images/EmojiIcons/Food.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
android/Images/EmojiIcons/Turn.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
android/Images/EmojiIcons/Turn2.png
Normal file
After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 869 KiB After Width: | Height: | Size: 880 KiB |
Before Width: | Height: | Size: 477 KiB After Width: | Height: | Size: 481 KiB |
|
@ -73,7 +73,7 @@ class MainMenuScreen: CameraStageBaseScreen() {
|
|||
val table = Table().apply { defaults().pad(10f) }
|
||||
val autosaveGame = GameSaver.getSave(autosave, false)
|
||||
if (autosaveGame.exists()) {
|
||||
val resumeTable = getTableBlock("Resume", "OtherIcons/Resume") { autoLoadGame() }
|
||||
val resumeTable = getTableBlock("Resume","OtherIcons/Resume") { autoLoadGame() }
|
||||
table.add(resumeTable).row()
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.unciv.Constants
|
|||
import com.unciv.logic.civilization.CivilizationInfo
|
||||
import com.unciv.models.stats.INamed
|
||||
import com.unciv.models.translations.tr
|
||||
import com.unciv.ui.utils.Fonts
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
interface IConstruction : INamed {
|
||||
|
@ -23,7 +24,7 @@ open class PerpetualConstruction(override var name: String, val description: Str
|
|||
return isBuildable(cityConstructions)
|
||||
}
|
||||
open fun getProductionTooltip(cityInfo: CityInfo) : String
|
||||
= "\r\n${(cityInfo.cityStats.currentCityStats.production / CONVERSION_RATE).roundToInt()}/${"{turn}".tr()}"
|
||||
= "\r\n${(cityInfo.cityStats.currentCityStats.production / CONVERSION_RATE).roundToInt()}/${Fonts.turn}"
|
||||
open fun getConversionRate(cityInfo: CityInfo) : Int
|
||||
= CONVERSION_RATE
|
||||
|
||||
|
@ -34,7 +35,7 @@ open class PerpetualConstruction(override var name: String, val description: Str
|
|||
return cityConstructions.cityInfo.civInfo.tech.getTechUniques().contains("Enables conversion of city production to science")
|
||||
}
|
||||
override fun getProductionTooltip(cityInfo: CityInfo): String {
|
||||
return "\r\n${(cityInfo.cityStats.currentCityStats.production / getConversionRate(cityInfo)).roundToInt()}/${"{turn}".tr()}"
|
||||
return "\r\n${(cityInfo.cityStats.currentCityStats.production / getConversionRate(cityInfo)).roundToInt()}/${Fonts.turn}"
|
||||
}
|
||||
override fun getConversionRate(cityInfo: CityInfo) = (1/cityInfo.cityStats.getScienceConversionRate()).roundToInt()
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import com.unciv.models.ruleset.Ruleset
|
|||
import com.unciv.models.ruleset.tile.*
|
||||
import com.unciv.models.stats.Stats
|
||||
import com.unciv.models.translations.tr
|
||||
import com.unciv.ui.utils.Fonts
|
||||
import kotlin.math.abs
|
||||
|
||||
open class TileInfo {
|
||||
|
@ -372,7 +373,7 @@ open class TileInfo {
|
|||
if (roadStatus !== RoadStatus.None && !isCityCenter()) lineList += roadStatus.toString().tr()
|
||||
if (improvement != null) lineList += improvement!!.tr()
|
||||
if (improvementInProgress != null && isViewableToPlayer)
|
||||
lineList += "{$improvementInProgress}\r\n $turnsToImprovement {turns}".tr() // todo change to [] translation notation
|
||||
lineList += "{$improvementInProgress}\r\n $turnsToImprovement ${Fonts.turn}".tr() // todo change to [] translation notation
|
||||
if (civilianUnit != null && isViewableToPlayer)
|
||||
lineList += civilianUnit!!.name.tr() + " - " + civilianUnit!!.civInfo.civName.tr()
|
||||
if (militaryUnit != null && isViewableToPlayer) {
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.unciv.logic.city.PerpetualConstruction
|
|||
import com.unciv.models.ruleset.Building
|
||||
import com.unciv.models.ruleset.unit.BaseUnit
|
||||
import com.unciv.models.translations.tr
|
||||
import com.unciv.ui.utils.Fonts
|
||||
import com.unciv.ui.utils.ImageGetter
|
||||
import com.unciv.ui.utils.surroundWithCircle
|
||||
import com.unciv.ui.utils.toLabel
|
||||
|
@ -80,6 +81,6 @@ class ConstructionInfoTable(val city: CityInfo): Table() {
|
|||
}
|
||||
|
||||
companion object {
|
||||
internal fun turnOrTurns(turns: Int): String = "\r\n$turns ${(if (turns > 1) " {turns}" else " {turn}").tr()}"
|
||||
internal fun turnOrTurns(turns: Int): String = "\r\n$turns ${Fonts.turn}"
|
||||
}
|
||||
}
|
|
@ -157,7 +157,7 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Tec
|
|||
}
|
||||
|
||||
if (!civTech.isResearched(techName) || techName == Constants.futureTech)
|
||||
text += "\r\n" + turnsToTech[techName] + " {turns}".tr()
|
||||
text += "\r\n" + turnsToTech[techName] + " ${Fonts.turn}".tr()
|
||||
|
||||
techButton.text.setText(text)
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ class LoadGameScreen(previousScreen:CameraStageBaseScreen) : PickerScreen() {
|
|||
val game = GameSaver.loadGameFromFile(save)
|
||||
val playerCivNames = game.civilizations.filter { it.isPlayerCivilization() }.joinToString { it.civName.tr() }
|
||||
textToSet += "\n" + playerCivNames +
|
||||
", " + game.difficulty.tr() + ", {Turn} ".tr() + game.turns
|
||||
", " + game.difficulty.tr() + ", ${Fonts.turn} ".tr() + game.turns
|
||||
} catch (ex: Exception) {
|
||||
textToSet += "\n{Could not load game}!".tr()
|
||||
}
|
||||
|
|
|
@ -3,12 +3,14 @@ package com.unciv.ui.utils
|
|||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.Pixmap
|
||||
import com.badlogic.gdx.graphics.Texture
|
||||
import com.badlogic.gdx.graphics.TextureData
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.BitmapFontData
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.Glyph
|
||||
import com.badlogic.gdx.graphics.g2d.GlyphLayout
|
||||
import com.badlogic.gdx.graphics.g2d.PixmapPacker
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Image
|
||||
import com.badlogic.gdx.utils.Array
|
||||
import com.badlogic.gdx.utils.Disposable
|
||||
import com.unciv.UncivGame
|
||||
|
@ -54,7 +56,14 @@ class NativeBitmapFontData(val fontImplementation: NativeFontImplementation) : B
|
|||
override fun getGlyph(ch: Char): Glyph {
|
||||
var glyph: Glyph? = super.getGlyph(ch)
|
||||
if (glyph == null) {
|
||||
val charPixmap = fontImplementation.getCharPixmap(ch)
|
||||
if(ch == '\uD83D' || ch == '\uD83C' ) return Glyph() // This is the 'first character' of an emoji - empty space
|
||||
val charPixmap =
|
||||
when (ch) {
|
||||
Fonts.food[1] -> Fonts.extractPixmapFromTextureRegion(ImageGetter.getDrawable("EmojiIcons/Food").region)
|
||||
Fonts.gold[1] -> Fonts.extractPixmapFromTextureRegion(ImageGetter.getDrawable("StatIcons/Gold").region)
|
||||
Fonts.turn -> Fonts.extractPixmapFromTextureRegion(ImageGetter.getDrawable("EmojiIcons/Turn").region)
|
||||
else -> fontImplementation.getCharPixmap(ch)
|
||||
}
|
||||
|
||||
glyph = Glyph()
|
||||
glyph.id = ch.toInt()
|
||||
|
@ -100,4 +109,31 @@ object Fonts {
|
|||
font.setOwnsTexture(true)
|
||||
font
|
||||
}
|
||||
|
||||
// From https://stackoverflow.com/questions/29451787/libgdx-textureregion-to-pixmap
|
||||
fun extractPixmapFromTextureRegion(textureRegion:TextureRegion):Pixmap {
|
||||
val textureData = textureRegion.texture.textureData
|
||||
if (!textureData.isPrepared) {
|
||||
textureData.prepare()
|
||||
}
|
||||
val pixmap = Pixmap(
|
||||
textureRegion.regionWidth,
|
||||
textureRegion.regionHeight,
|
||||
textureData.format
|
||||
)
|
||||
pixmap.drawPixmap(
|
||||
textureData.consumePixmap(), // The other Pixmap
|
||||
0, // The target x-coordinate (top left corner)
|
||||
0, // The target y-coordinate (top left corner)
|
||||
textureRegion.regionX, // The source x-coordinate (top left corner)
|
||||
textureRegion.regionY, // The source y-coordinate (top left corner)
|
||||
textureRegion.regionWidth, // The width of the area from the other Pixmap in pixels
|
||||
textureRegion.regionHeight // The height of the area from the other Pixmap in pixels
|
||||
)
|
||||
return pixmap
|
||||
}
|
||||
|
||||
const val food = "\uD83C\uDF4E"
|
||||
const val gold = "\uD83D\uDCB0"
|
||||
const val turn = '⏳'
|
||||
}
|
||||
|
|
|
@ -445,8 +445,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
|
|||
innerButton.color = colorFromRGB(7, 46, 43)
|
||||
techButtonHolder.add(innerButton)
|
||||
val turnsToTech = viewingCiv.tech.turnsToTech(currentTech)
|
||||
innerButton.text.setText(currentTech.tr() + "\r\n" + turnsToTech
|
||||
+ (if (turnsToTech > 1) " {turns}".tr() else " {turn}".tr()))
|
||||
innerButton.text.setText(currentTech.tr() + "\r\n" + turnsToTech + " "+ Fonts.turn)
|
||||
} else if (viewingCiv.tech.canResearchTech() || viewingCiv.tech.researchedTechnologies.any()) {
|
||||
val buttonPic = Table()
|
||||
buttonPic.background = ImageGetter.getRoundedEdgeTableBackground(colorFromRGB(7, 46, 43))
|
||||
|
|
|
@ -182,7 +182,7 @@ class WorldScreenTopBar(val worldScreen: WorldScreen) : Table() {
|
|||
val year = getYear(civInfo.gameInfo.gameParameters.gameSpeed, civInfo.gameInfo.turns).toInt()
|
||||
|
||||
val yearText = "[" + abs(year) + "] " + if (year < 0) "BC" else "AD"
|
||||
turnsLabel.setText("Turn".tr() + " " + civInfo.gameInfo.turns + " | " + yearText.tr())
|
||||
turnsLabel.setText(Fonts.turn + " " + civInfo.gameInfo.turns + " | " + yearText.tr())
|
||||
turnsLabel.onClick { worldScreen.game.setScreen(VictoryScreen(worldScreen)) }
|
||||
|
||||
val nextTurnStats = civInfo.statsForNextTurn
|
||||
|
|