NextTurnActions (pick tech/policy/etc) now can have icons (#8119)
* NextTurnActions (pick tech/policy/etc) now can have icons * Remove default NextTurn notification icons * Added default notification icons. "Next unit" action priority is lowered (as in Civ 5) * Added missing files Co-authored-by: tunerzinc@gmail.com <vfylfhby>
BIN
android/Images/NotificationIcons/EnhanceReligion.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
android/Images/NotificationIcons/FoundPantheon.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
android/Images/NotificationIcons/FoundReligion.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
android/Images/NotificationIcons/Loading.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
android/Images/NotificationIcons/MoveAutomatedUnits.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
android/Images/NotificationIcons/NextTurn.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
android/Images/NotificationIcons/NextUnit.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
android/Images/NotificationIcons/PickPolicy.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
android/Images/NotificationIcons/PickProduction.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
android/Images/NotificationIcons/PickTech.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
android/Images/NotificationIcons/ReformReligion.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
android/Images/NotificationIcons/Working.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
android/Images/NotificationIcons/WorldCongressVote.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
android/assets/NotificationIcons.png
Normal file
After Width: | Height: | Size: 14 KiB |
@ -1313,3 +1313,107 @@ UnitActionIcons/Upgrade
|
|||||||
orig: 100, 94
|
orig: 100, 94
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
|
|
||||||
|
NotificationIcons.png
|
||||||
|
size: 512, 64
|
||||||
|
format: RGBA8888
|
||||||
|
filter: MipMapLinearLinear, MipMapLinearLinear
|
||||||
|
repeat: none
|
||||||
|
NotificationIcons/PickConstruction
|
||||||
|
rotate: false
|
||||||
|
xy: 0, 0
|
||||||
|
size: 33, 33
|
||||||
|
orig: 33, 33
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
NotificationIcons/PickTech
|
||||||
|
rotate: false
|
||||||
|
xy: 33, 0
|
||||||
|
size: 33, 33
|
||||||
|
orig: 33, 33
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
NotificationIcons/PickPolicy
|
||||||
|
rotate: false
|
||||||
|
xy: 66, 0
|
||||||
|
size: 33, 33
|
||||||
|
orig: 33, 33
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
NotificationIcons/FoundPantheon
|
||||||
|
rotate: false
|
||||||
|
xy: 99, 0
|
||||||
|
size: 33, 33
|
||||||
|
orig: 33, 33
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
NotificationIcons/FoundReligion
|
||||||
|
rotate: false
|
||||||
|
xy: 99, 0
|
||||||
|
size: 33, 33
|
||||||
|
orig: 33, 33
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
NotificationIcons/EnhanceReligion
|
||||||
|
rotate: false
|
||||||
|
xy: 99, 0
|
||||||
|
size: 33, 33
|
||||||
|
orig: 33, 33
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
NotificationIcons/ReformReligion
|
||||||
|
rotate: false
|
||||||
|
xy: 5, 6
|
||||||
|
size: 88, 88
|
||||||
|
orig: 88, 88
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
NotificationIcons/FoundPantheon
|
||||||
|
rotate: false
|
||||||
|
xy: 99, 0
|
||||||
|
size: 33, 33
|
||||||
|
orig: 33, 33
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
NotificationIcons/WorldCongressVote
|
||||||
|
rotate: false
|
||||||
|
xy: 132, 0
|
||||||
|
size: 33, 33
|
||||||
|
orig: 33, 33
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
NotificationIcons/MoveAutomatedUnits
|
||||||
|
rotate: false
|
||||||
|
xy: 165, 0
|
||||||
|
size: 33, 33
|
||||||
|
orig: 33, 33
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
NotificationIcons/Working
|
||||||
|
rotate: false
|
||||||
|
xy: 198, 0
|
||||||
|
size: 33, 33
|
||||||
|
orig: 33, 33
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
NotificationIcons/Loading
|
||||||
|
rotate: false
|
||||||
|
xy: 231, 0
|
||||||
|
size: 33, 33
|
||||||
|
orig: 33, 33
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
NotificationIcons/NextUnit
|
||||||
|
rotate: false
|
||||||
|
xy: 165, 0
|
||||||
|
size: 33, 33
|
||||||
|
orig: 33, 33
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
NotificationIcons/NextTurn
|
||||||
|
rotate: false
|
||||||
|
xy: 198, 0
|
||||||
|
size: 33, 33
|
||||||
|
orig: 33, 33
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
@ -18,7 +18,7 @@ import com.unciv.ui.utils.extensions.toLabel
|
|||||||
* @param fontSize Text size for [String.toLabel].
|
* @param fontSize Text size for [String.toLabel].
|
||||||
* @param fontColor Text colour for [String.toLabel].
|
* @param fontColor Text colour for [String.toLabel].
|
||||||
*/
|
*/
|
||||||
class IconTextButton(
|
open class IconTextButton(
|
||||||
text: String,
|
text: String,
|
||||||
val icon: Actor? = null,
|
val icon: Actor? = null,
|
||||||
fontSize: Int = Constants.defaultFontSize,
|
fontSize: Int = Constants.defaultFontSize,
|
||||||
@ -27,13 +27,15 @@ class IconTextButton(
|
|||||||
/** [Label] instance produced by and with content and formatting as specified to [String.toLabel]. */
|
/** [Label] instance produced by and with content and formatting as specified to [String.toLabel]. */
|
||||||
val label = text.toLabel(fontColor, fontSize)
|
val label = text.toLabel(fontColor, fontSize)
|
||||||
/** Table cell containing the [icon] if any, or `null`. */
|
/** Table cell containing the [icon] if any, or `null`. */
|
||||||
val iconCell: Cell<Actor>? =
|
val iconCell: Cell<Actor> =
|
||||||
if (icon != null) {
|
if (icon != null) {
|
||||||
val size = fontSize.toFloat()
|
val size = fontSize.toFloat()
|
||||||
icon.setSize(size,size)
|
icon.setSize(size,size)
|
||||||
icon.setOrigin(Align.center)
|
icon.setOrigin(Align.center)
|
||||||
add(icon).size(size).padRight(size / 3)
|
add(icon).size(size).padRight(size / 3)
|
||||||
} else null
|
} else {
|
||||||
|
add()
|
||||||
|
}
|
||||||
/** Table cell instance containing the [label]. */
|
/** Table cell instance containing the [label]. */
|
||||||
val labelCell: Cell<Label> = add(label)
|
val labelCell: Cell<Label> = add(label)
|
||||||
}
|
}
|
||||||
|
@ -663,20 +663,20 @@ class WorldScreen(
|
|||||||
private fun getNextTurnAction(): NextTurnAction {
|
private fun getNextTurnAction(): NextTurnAction {
|
||||||
return when {
|
return when {
|
||||||
isNextTurnUpdateRunning() ->
|
isNextTurnUpdateRunning() ->
|
||||||
NextTurnAction("Working...", Color.GRAY) {}
|
NextTurnAction("Working...", Color.GRAY, "NotificationIcons/Working") {}
|
||||||
!isPlayersTurn && gameInfo.gameParameters.isOnlineMultiplayer ->
|
!isPlayersTurn && gameInfo.gameParameters.isOnlineMultiplayer ->
|
||||||
NextTurnAction("Waiting for [${gameInfo.currentPlayerCiv}]...", Color.GRAY) {}
|
NextTurnAction("Waiting for [${gameInfo.currentPlayerCiv}]...", Color.GRAY,
|
||||||
|
"NotificationIcons/Waiting") {}
|
||||||
!isPlayersTurn && !gameInfo.gameParameters.isOnlineMultiplayer ->
|
!isPlayersTurn && !gameInfo.gameParameters.isOnlineMultiplayer ->
|
||||||
NextTurnAction("Waiting for other players...",Color.GRAY) {}
|
NextTurnAction("Waiting for other players...",Color.GRAY,
|
||||||
|
"NotificationIcons/Waiting") {}
|
||||||
viewingCiv.shouldGoToDueUnit() ->
|
|
||||||
NextTurnAction("Next unit", Color.LIGHT_GRAY) { switchToNextUnit() }
|
|
||||||
|
|
||||||
viewingCiv.cities.any {
|
viewingCiv.cities.any {
|
||||||
!it.isPuppet &&
|
!it.isPuppet &&
|
||||||
it.cityConstructions.currentConstructionFromQueue == ""
|
it.cityConstructions.currentConstructionFromQueue == ""
|
||||||
} ->
|
} ->
|
||||||
NextTurnAction("Pick construction", Color.CORAL) {
|
NextTurnAction("Pick construction", Color.CORAL,
|
||||||
|
"NotificationIcons/PickConstruction") {
|
||||||
val cityWithNoProductionSet = viewingCiv.cities
|
val cityWithNoProductionSet = viewingCiv.cities
|
||||||
.firstOrNull {
|
.firstOrNull {
|
||||||
!it.isPuppet &&
|
!it.isPuppet &&
|
||||||
@ -688,14 +688,14 @@ class WorldScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
viewingCiv.shouldOpenTechPicker() ->
|
viewingCiv.shouldOpenTechPicker() ->
|
||||||
NextTurnAction("Pick a tech", Color.SKY) {
|
NextTurnAction("Pick a tech", Color.SKY, "NotificationIcons/PickTech") {
|
||||||
game.pushScreen(
|
game.pushScreen(
|
||||||
TechPickerScreen(viewingCiv, null, viewingCiv.tech.freeTechs != 0)
|
TechPickerScreen(viewingCiv, null, viewingCiv.tech.freeTechs != 0)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
viewingCiv.policies.shouldOpenPolicyPicker || (viewingCiv.policies.freePolicies > 0 && viewingCiv.policies.canAdoptPolicy()) ->
|
viewingCiv.policies.shouldOpenPolicyPicker || (viewingCiv.policies.freePolicies > 0 && viewingCiv.policies.canAdoptPolicy()) ->
|
||||||
NextTurnAction("Pick a policy", Color.VIOLET) {
|
NextTurnAction("Pick a policy", Color.VIOLET, "NotificationIcons/PickPolicy") {
|
||||||
game.pushScreen(PolicyPickerScreen(this))
|
game.pushScreen(PolicyPickerScreen(this))
|
||||||
viewingCiv.policies.shouldOpenPolicyPicker = false
|
viewingCiv.policies.shouldOpenPolicyPicker = false
|
||||||
}
|
}
|
||||||
@ -704,13 +704,15 @@ class WorldScreen(
|
|||||||
val displayString = if (viewingCiv.religionManager.religionState == ReligionState.Pantheon)
|
val displayString = if (viewingCiv.religionManager.religionState == ReligionState.Pantheon)
|
||||||
"Expand Pantheon"
|
"Expand Pantheon"
|
||||||
else "Found Pantheon"
|
else "Found Pantheon"
|
||||||
NextTurnAction(displayString, Color.valueOf(BeliefType.Pantheon.color)) {
|
NextTurnAction(displayString, Color.valueOf(BeliefType.Pantheon.color),
|
||||||
|
"NotificationIcons/FoundPantheon") {
|
||||||
game.pushScreen(PantheonPickerScreen(viewingCiv))
|
game.pushScreen(PantheonPickerScreen(viewingCiv))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
viewingCiv.religionManager.religionState == ReligionState.FoundingReligion ->
|
viewingCiv.religionManager.religionState == ReligionState.FoundingReligion ->
|
||||||
NextTurnAction("Found Religion", Color.valueOf(BeliefType.Founder.color)) {
|
NextTurnAction("Found Religion", Color.valueOf(BeliefType.Founder.color),
|
||||||
|
"NotificationIcons/FoundReligion") {
|
||||||
game.pushScreen(
|
game.pushScreen(
|
||||||
ReligiousBeliefsPickerScreen(
|
ReligiousBeliefsPickerScreen(
|
||||||
viewingCiv,
|
viewingCiv,
|
||||||
@ -721,7 +723,8 @@ class WorldScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
viewingCiv.religionManager.religionState == ReligionState.EnhancingReligion ->
|
viewingCiv.religionManager.religionState == ReligionState.EnhancingReligion ->
|
||||||
NextTurnAction("Enhance a Religion", Color.valueOf(BeliefType.Enhancer.color)) {
|
NextTurnAction("Enhance a Religion", Color.valueOf(BeliefType.Enhancer.color),
|
||||||
|
"NotificationIcons/EnhanceReligion") {
|
||||||
game.pushScreen(
|
game.pushScreen(
|
||||||
ReligiousBeliefsPickerScreen(
|
ReligiousBeliefsPickerScreen(
|
||||||
viewingCiv,
|
viewingCiv,
|
||||||
@ -732,7 +735,8 @@ class WorldScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
viewingCiv.religionManager.hasFreeBeliefs() ->
|
viewingCiv.religionManager.hasFreeBeliefs() ->
|
||||||
NextTurnAction("Reform Religion", Color.valueOf(BeliefType.Enhancer.color)) {
|
NextTurnAction("Reform Religion", Color.valueOf(BeliefType.Enhancer.color),
|
||||||
|
"NotificationIcons/ReformReligion") {
|
||||||
game.pushScreen(
|
game.pushScreen(
|
||||||
ReligiousBeliefsPickerScreen(
|
ReligiousBeliefsPickerScreen(
|
||||||
viewingCiv,
|
viewingCiv,
|
||||||
@ -743,13 +747,19 @@ class WorldScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
viewingCiv.mayVoteForDiplomaticVictory() ->
|
viewingCiv.mayVoteForDiplomaticVictory() ->
|
||||||
NextTurnAction("Vote for World Leader", Color.MAROON) {
|
NextTurnAction("Vote for World Leader", Color.MAROON,
|
||||||
|
"NotificationIcons/WorldCongressVote") {
|
||||||
game.pushScreen(DiplomaticVotePickerScreen(viewingCiv))
|
game.pushScreen(DiplomaticVotePickerScreen(viewingCiv))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
viewingCiv.shouldGoToDueUnit() ->
|
||||||
|
NextTurnAction("Next unit", Color.LIGHT_GRAY,
|
||||||
|
"NotificationIcons/NextUnit") { switchToNextUnit() }
|
||||||
|
|
||||||
!viewingCiv.hasMovedAutomatedUnits && viewingCiv.getCivUnits()
|
!viewingCiv.hasMovedAutomatedUnits && viewingCiv.getCivUnits()
|
||||||
.any { it.currentMovement > Constants.minimumMovementEpsilon && (it.isMoving() || it.isAutomated() || it.isExploring()) } ->
|
.any { it.currentMovement > Constants.minimumMovementEpsilon && (it.isMoving() || it.isAutomated() || it.isExploring()) } ->
|
||||||
NextTurnAction("Move automated units", Color.LIGHT_GRAY) {
|
NextTurnAction("Move automated units", Color.LIGHT_GRAY,
|
||||||
|
"NotificationIcons/MoveAutomatedUnits") {
|
||||||
viewingCiv.hasMovedAutomatedUnits = true
|
viewingCiv.hasMovedAutomatedUnits = true
|
||||||
isPlayersTurn = false // Disable state changes
|
isPlayersTurn = false // Disable state changes
|
||||||
nextTurnButton.disable()
|
nextTurnButton.disable()
|
||||||
@ -765,7 +775,8 @@ class WorldScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
else ->
|
else ->
|
||||||
NextTurnAction("${Fonts.turn}{Next turn}", Color.WHITE) {
|
NextTurnAction("Next turn", Color.WHITE,
|
||||||
|
"NotificationIcons/NextTurn") {
|
||||||
val action = {
|
val action = {
|
||||||
game.settings.addCompletedTutorialTask("Pass a turn")
|
game.settings.addCompletedTutorialTask("Pass a turn")
|
||||||
nextTurn()
|
nextTurn()
|
||||||
|
@ -3,17 +3,23 @@ package com.unciv.ui.worldscreen.status
|
|||||||
import com.badlogic.gdx.Input
|
import com.badlogic.gdx.Input
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
|
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
|
||||||
|
import com.badlogic.gdx.utils.Align
|
||||||
import com.unciv.models.translations.tr
|
import com.unciv.models.translations.tr
|
||||||
|
import com.unciv.ui.images.IconTextButton
|
||||||
|
import com.unciv.ui.images.ImageGetter
|
||||||
import com.unciv.ui.utils.BaseScreen
|
import com.unciv.ui.utils.BaseScreen
|
||||||
import com.unciv.ui.utils.KeyCharAndCode
|
import com.unciv.ui.utils.KeyCharAndCode
|
||||||
import com.unciv.ui.utils.KeyShortcut
|
import com.unciv.ui.utils.KeyShortcut
|
||||||
|
import com.unciv.ui.utils.extensions.center
|
||||||
|
import com.unciv.ui.utils.extensions.centerX
|
||||||
|
import com.unciv.ui.utils.extensions.centerY
|
||||||
import com.unciv.ui.utils.extensions.isEnabled
|
import com.unciv.ui.utils.extensions.isEnabled
|
||||||
import com.unciv.ui.utils.extensions.keyShortcuts
|
import com.unciv.ui.utils.extensions.keyShortcuts
|
||||||
import com.unciv.ui.utils.extensions.onActivation
|
import com.unciv.ui.utils.extensions.onActivation
|
||||||
import com.unciv.ui.utils.extensions.setFontSize
|
import com.unciv.ui.utils.extensions.setFontSize
|
||||||
|
|
||||||
class NextTurnButton(
|
class NextTurnButton(
|
||||||
) : TextButton("", BaseScreen.skin) {
|
) : IconTextButton("", null) {
|
||||||
private var nextTurnAction = NextTurnAction("", Color.BLACK) {}
|
private var nextTurnAction = NextTurnAction("", Color.BLACK) {}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
@ -33,8 +39,12 @@ class NextTurnButton(
|
|||||||
nextTurnAction: NextTurnAction? = null) {
|
nextTurnAction: NextTurnAction? = null) {
|
||||||
if (nextTurnAction != null) {
|
if (nextTurnAction != null) {
|
||||||
this.nextTurnAction = nextTurnAction
|
this.nextTurnAction = nextTurnAction
|
||||||
setText(nextTurnAction.text.tr())
|
label.setText(nextTurnAction.text.tr())
|
||||||
label.color = nextTurnAction.color
|
label.color = nextTurnAction.color
|
||||||
|
if (nextTurnAction.icon != null && ImageGetter.imageExists(nextTurnAction.icon))
|
||||||
|
iconCell.setActor(ImageGetter.getImage(nextTurnAction.icon))
|
||||||
|
else
|
||||||
|
iconCell.clearActor()
|
||||||
pack()
|
pack()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,4 +52,4 @@ class NextTurnButton(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class NextTurnAction(val text: String, val color: Color, val action: () -> Unit)
|
class NextTurnAction(val text: String, val color: Color, val icon: String? = null, val action: () -> Unit)
|
||||||
|