mirror of
https://github.com/yairm210/Unciv.git
synced 2025-03-03 22:22:51 +07:00
Resolved #9304 - Added Policy icons and solved 'icons from Image' reflection :)
This commit is contained in:
parent
ec65b7e189
commit
fab32e8c8a
@ -21,6 +21,7 @@ import com.unciv.GUI
|
||||
import com.unciv.UncivGame
|
||||
import com.unciv.models.ruleset.Ruleset
|
||||
import com.unciv.models.translations.tr
|
||||
import com.unciv.ui.components.extensions.setSize
|
||||
import com.unciv.ui.images.ImageGetter
|
||||
|
||||
|
||||
@ -281,6 +282,12 @@ object Fonts {
|
||||
|
||||
for (nation in ruleset.nations.values)
|
||||
addChar(nation.name, ImageGetter.getNationPortrait(nation, ORIGINAL_FONT_SIZE))
|
||||
|
||||
for (policy in ruleset.policies.values) {
|
||||
val fileLocation = if (policy.name in ruleset.policyBranches)
|
||||
"PolicyBranchIcons/" + policy.name else "PolicyIcons/" + policy.name
|
||||
addChar(policy.name, ImageGetter.getImage(fileLocation).apply { setSize(ORIGINAL_FONT_SIZE) })
|
||||
}
|
||||
}
|
||||
|
||||
val frameBuffer by lazy { FrameBuffer(Pixmap.Format.RGBA8888, Gdx.graphics.width, Gdx.graphics.height, false) }
|
||||
@ -305,6 +312,7 @@ object Fonts {
|
||||
|
||||
|
||||
// Pixmap is now *upside down* so we need to flip it around the y axis
|
||||
pixmap.blending = Pixmap.Blending.None
|
||||
for (i in 0..w)
|
||||
for (j in 0..h/2) {
|
||||
val topPixel = pixmap.getPixel(i,j)
|
||||
|
@ -520,10 +520,10 @@ class PolicyPickerScreen(val viewingCiv: Civilization, val canChangeState: Boole
|
||||
}.toGroup(15f) else null
|
||||
val expandIcon = ImageGetter.getImage("OtherIcons/BackArrow").apply { rotation = 90f }.toGroup(10f)
|
||||
table.add(expandIcon).minWidth(15f).expandX().left()
|
||||
table.add(branch.name.tr().uppercase().toLabel(fontSize = 14).apply { setAlignment(Align.center) }).center()
|
||||
table.add(branch.name.tr(hideIcons = true).uppercase().toLabel(fontSize = 14).apply { setAlignment(Align.center) }).center()
|
||||
table.add(icon).expandX().left().padLeft(5f)
|
||||
|
||||
header.setTouchable(Touchable.enabled)
|
||||
header.touchable = Touchable.enabled
|
||||
|
||||
header.add(table).minWidth(150f).growX()
|
||||
header.pack()
|
||||
|
Loading…
Reference in New Issue
Block a user