Skip to content

Commit

Permalink
Revert "Add small Skip/Cycle Button (#12845)" (#12924)
Browse files Browse the repository at this point in the history
This reverts commit 26c2a8c.
  • Loading branch information
yairm210 authored Feb 7, 2025
1 parent f90551e commit c0b1baa
Show file tree
Hide file tree
Showing 18 changed files with 63 additions and 129 deletions.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed android/Images.Icons/OtherIcons/Skip.png
Binary file not shown.
Binary file added android/Images.Icons/OtherIcons/Wait.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 8 additions & 12 deletions android/assets/jsons/Tutorials.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
{"text": "Cities will house Citizens, which can work tiles up to 3 tiles away from the city. This means you don’t have to settle cities right on or next to good tiles. Let’s say, for example, that you want access to some Iron – but the resource is in a desert area. You don’t have to settle your city in the desert. You can settle a few tiles away in more prosperous lands. Your city will grow and eventually gain access to the resource. You only need to settle right on top of resources if you need them immediately."},
{},
{"text": "The first thing coming out of your city depends on the strategy you want to follow, but the 'classic' build order is to build first two Scouts, then a Shrine, and three Settlers, and adopt Tradition, to explore the map quickly (Scouts ignore terrain cost), and to get an early Pantheon (if you're playing with religion enabled)."},
{"text": "But feel free to experiment with your own build orders!", "color": "#fa0"}
{"text": "But feel free to experiment with your own build orders!", "color": "#fa0"},
]
},
{
Expand Down Expand Up @@ -129,7 +129,7 @@
{"text":"This greatly improves the speed you can get Units around the map."},
{"text":"Until you research the technology that removes it, Roads do not cross Rivers"},
{"text":"Connecting your cities to the capital by Roads and/or Railroads will generate Gold via the Trade Route.","link":"Tutorials/Trade Route"},
{"text":"However, since each Road and Railroad have a Maintenance Cost, it may be more economical to wait until the cities grow and only place where needed."}
{"text":"However, since each Road and Railroad have a Maintenance Cost, it may be more economical to wait until the cities grow and only place where needed."},
]
},
{
Expand Down Expand Up @@ -233,11 +233,7 @@
{
"name": "Idle Units",
"steps": [
"Clicking 'Next unit' move to the next unit in the queue.",
"If you don't want to move a unit this turn, you can skip it by clicking 'Next unit' again, or command the unit to 'Skip turn'.",
"If you want to disable the 'Next unit' feature entirely, you can toggle it in Menu -> Check for idle units.",
"If you'd rather 'Next unit' cycle the units and not mark them as Done, you can change it in the Options -> Gameplay menu.",
"You can also cycle through the idle units using the left and right triangles on the Unit Table in the lower left of the screen."
"If you don't want to move a unit this turn, you can skip it by clicking 'Next unit' again, or command the unit to 'Wait'.\nIf you won't be moving it for a while, you can have the unit enter Fortify or Sleep mode - \n units in Fortify or Sleep are not considered idle units.\nIf you want to disable the 'Next unit' feature entirely, you can toggle it in Menu -> Check for idle units."
]
},
{
Expand Down Expand Up @@ -352,7 +348,7 @@
"⑥: Unit Action Buttons - while a unit is selected its possible actions appear here.",
"⑦: The unit/city info pane - shows information about a selected unit or city.",
"⑧: The name (and unit icon) of the selected unit or city, with current health if wounded. Clicking a unit name or icon will open its civilopedia entry.",
"⑨: The arrow buttons allow jumping to the next/previous idle unit.",
"⑨: The arrow buttons allow jumping to the next/previous unit.",
"⑩: For a selected unit, its promotions appear here, and clicking leads to the promotions screen for that unit.",
"⑪: Remaining/per turn movement points, strength and experience / XP needed for promotion. For cities, you get its combat strength.",
"⑫: This button closes the selected unit/city info pane.",
Expand Down Expand Up @@ -498,7 +494,7 @@
{"text":"The Intercepting Unit rolls to see if it hits. Whether it hits or not costs an Attack, and most units (without Promotions) can only Attack Once per Nation's Turn. It does NOT cost Movement Points, but Air Units that have used their Movement cannot Intercept between turns."},
{"text":"If the Intercepting Unit Hits, it deals damage according to the Combat Strength calculation to the Attacking Air Unit, potentially with any Strength Bonuses that apply to Interception. It does not receive damage from the Attacking Air Unit."},
{"text":"After Interception resolves, the Attacking Air Unit and the Defending Unit in the targeted tile do Combat as normal, with damage dealt to both sides."},
{"text":"To help deal with Interceptions, see Air Sweeps.","link": "Tutorials/Air Sweeps"}
{"text":"To help deal with Interceptions, see Air Sweeps.","link": "Tutorials/Air Sweeps"},
]
},
{
Expand Down Expand Up @@ -549,7 +545,7 @@
{"text":"Spies at a higher rank have a higher chance of success. The max rank a spy can reach is rank 3. After a spy is killed it will revive after a certain amount of turns back at rank 1."},
{"text":"Building buildings like the constabulary and police station will reduce the technology steal rate of spies in that city."},
{},
{"text":"Espionage is available using the Gods and Kings ruleset. To enable it in a new game click advanced settings, then click on the Enable Espionage option."}
{"text":"Espionage is available using the Gods and Kings ruleset. To enable it in a new game click advanced settings, then click on the Enable Espionage option."},
]
},
{
Expand Down Expand Up @@ -675,15 +671,15 @@
{},
{"text":"Tile improvements\nIn Civilzation V, workers start working on an improvement-under-construction at the beginning of movement. Unciv changes this, to allow players to assign workers to tiles, and then reconsider and change improvement or move them elsewhere."},
{},
{"text":"Forest and Jungle Visibility\nIn Unciv, forests and jungles are visible 1 tile outside visibility range. In Civilization V, this is the behaviour of hills and mountains, but not of forests and jungles, yet jungle and forest can block hills, and hill + forest can block mountain, indicating they're on the same elevation. This is considered to be a bug in the otherwise well-structured visibility logic in Civilization V."}
{"text":"Forest and Jungle Visibility\nIn Unciv, forests and jungles are visible 1 tile outside visibility range. In Civilization V, this is the behaviour of hills and mountains, but not of forests and jungles, yet jungle and forest can block hills, and hill + forest can block mountain, indicating they're on the same elevation. This is considered to be a bug in the otherwise well-structured visibility logic in Civilization V."},
]
},
{
"name": "Settler",
"civilopediaText": [
{"text": "Founding Cities\nThe Settler is a unit that can found a new city. You can build a Settler unit in a city with at least 2 population, and then move them to a good location to found a new city. This will usually be your main way of acquiring more cities."},
{},
{"text": "Food conversion to Production\nDuring the construction of a Settler, the city will not grow. Instead, the 1st, 2nd, 4th, and from there on every 4th, excess Food (Growth) is converted into Production, with the rest of the excess Food being lost."}
{"text": "Food conversion to Production\nDuring the construction of a Settler, the city will not grow. Instead, the 1st, 2nd, 4th, and from there on every 4th, excess Food (Growth) is converted into Production, with the rest of the excess Food being lost."},
]
}
]
6 changes: 2 additions & 4 deletions android/assets/jsons/translations/template.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1176,8 +1176,7 @@ turn =
Next unit =
[amount] units idle =
[idleCount] idle =
[skipCount] skipping =
Cycle =
[waitingCount] waiting =
Fog of War =
Pick a policy =
Move Spies =
Expand Down Expand Up @@ -1227,8 +1226,7 @@ Pillage =
Pillage [improvement] =
[improvement] (Pillaged!) =
Repair [improvement] - [turns] =
Skip =
Skip turn =
Wait =
Are you sure you want to pillage this [improvement]? =
We have looted [amount] from a [improvement] =
We have looted [amount] from a [improvement] which has been sent to [cityName] =
Expand Down
4 changes: 2 additions & 2 deletions core/src/com/unciv/models/UnitAction.kt
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ enum class UnitActionType(
{ ImageGetter.getUnitActionPortrait("DisbandUnit") }, false, defaultPage = 1),
GiftUnit("Gift unit",
{ ImageGetter.getUnitActionPortrait("Present") }, UncivSound.Silent, defaultPage = 1),
Skip("Skip turn",
{ ImageGetter.getUnitActionPortrait("Skip") }, UncivSound.Silent, defaultPage = 0),
Wait("Wait",
{ ImageGetter.getUnitActionPortrait("Wait") }, UncivSound.Silent),
ShowAdditionalActions("Show more",
{ ImageGetter.getUnitActionPortrait("ShowMore") }, false),
HideAdditionalActions("Back",
Expand Down
1 change: 0 additions & 1 deletion core/src/com/unciv/models/metadata/GameSettings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class GameSettings {
var checkForDueUnits: Boolean = true
var checkForDueUnitsCycles: Boolean = false
var autoUnitCycle: Boolean = true
var smallUnitButton: Boolean = true
var singleTapMove: Boolean = false
var longTapMove: Boolean = true
var language: String = Constants.english
Expand Down
3 changes: 1 addition & 2 deletions core/src/com/unciv/ui/components/input/KeyboardBinding.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ enum class KeyboardBinding(
DeveloperConsole(Category.WorldScreen, '`'),
PrevIdleButton(Category.WorldScreen, "Idle Prev",','),
NextIdleButton(Category.WorldScreen, "Idle Next", '.'),
Cycle(Category.WorldScreen, ';'),

/*
* These try to be faithful to default Civ5 key bindings as found in several places online
Expand Down Expand Up @@ -137,7 +136,7 @@ enum class KeyboardBinding(
EnhanceReligion(Category.UnitActions,"Enhance a Religion", 'g'),
DisbandUnit(Category.UnitActions,"Disband unit", KeyCharAndCode.DEL),
GiftUnit(Category.UnitActions,"Gift unit", KeyCharAndCode.UNKNOWN),
Skip(Category.UnitActions, 'z'),
Wait(Category.UnitActions, 'z'),
ShowAdditionalActions(Category.UnitActions,"Show more", Input.Keys.PAGE_DOWN),
HideAdditionalActions(Category.UnitActions,"Back", Input.Keys.PAGE_UP),
AddInCapital(Category.UnitActions, "Add in capital", 'g'),
Expand Down
1 change: 0 additions & 1 deletion core/src/com/unciv/ui/popups/options/GameplayTab.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ fun gameplayTab(

optionsPopup.addCheckbox(this, "Check for idle units", settings.checkForDueUnits, true) { settings.checkForDueUnits = it }
optionsPopup.addCheckbox(this, "'Next unit' button cycles idle units", settings.checkForDueUnitsCycles, true) { settings.checkForDueUnitsCycles = it }
optionsPopup.addCheckbox(this, "Show Small Skip/Cycle Unit Button", settings.smallUnitButton, true) { settings.smallUnitButton = it }
optionsPopup.addCheckbox(this, "Auto Unit Cycle", settings.autoUnitCycle, true) { settings.autoUnitCycle = it }
optionsPopup.addCheckbox(this, "Move units with a single tap", settings.singleTapMove) { settings.singleTapMove = it }
optionsPopup.addCheckbox(this, "Move units with a long tap", settings.longTapMove) { settings.longTapMove = it }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class NotificationsScroll(
* The 'covered' parameters are used to make sure we can scroll up or down far enough so the bottom or top entry is visible.
*
* @param notifications Data to display
* @param coveredNotificationsTop Height of the portion that may be covered on the top w/o any padding
* @param coveredNotificationsTop Height of the portion that may be covered on the bottom w/o any padding
* @param coveredNotificationsBottom Height of the portion that may be covered on the bottom w/o any padding
*/
internal fun update(
Expand All @@ -170,8 +170,11 @@ class NotificationsScroll(

restoreButton.block() // For the update, since ScrollPane may layout and change scrollX
val contentChanged = updateContent(notifications, coveredNotificationsTop, coveredNotificationsBottom)
updateSpacers(coveredNotificationsTop, coveredNotificationsBottom)
updateLayout()
if (contentChanged) {
updateLayout()
} else {
updateSpacers(coveredNotificationsTop, coveredNotificationsBottom)
}

scrollX = maxX - previousScrollXinv
scrollY = if (selectedCell == null) {
Expand Down
9 changes: 5 additions & 4 deletions core/src/com/unciv/ui/screens/worldscreen/WorldScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ import com.unciv.ui.screens.worldscreen.status.MultiplayerStatusButton
import com.unciv.ui.screens.worldscreen.status.NextTurnButton
import com.unciv.ui.screens.worldscreen.status.NextTurnProgress
import com.unciv.ui.screens.worldscreen.status.StatusButtons
import com.unciv.ui.screens.worldscreen.status.SmallUnitButton
import com.unciv.ui.screens.worldscreen.topbar.WorldScreenTopBar
import com.unciv.ui.screens.worldscreen.unit.AutoPlay
import com.unciv.ui.screens.worldscreen.unit.UnitTable
Expand Down Expand Up @@ -122,7 +121,6 @@ class WorldScreen(
internal val notificationsScroll = NotificationsScroll(this)
internal val nextTurnButton = NextTurnButton(this)
private val statusButtons = StatusButtons(nextTurnButton)
internal val smallUnitButton = SmallUnitButton(this, statusButtons)
private val tutorialTaskTable = Table().apply {
background = skinStrings.getUiBackground("WorldScreen/TutorialTaskTable", tintColor = skinStrings.skinConfig.baseColor.darken(0.5f))
}
Expand Down Expand Up @@ -671,10 +669,13 @@ class WorldScreen(
updateAutoPlayStatusButton()
updateMultiplayerStatusButton()

statusButtons.update(false)
statusButtons.wrap(false)
statusButtons.pack()
val maxWidth = stage.width - techPolicyAndDiplomacy.width - 25f
if(statusButtons.width > maxWidth) {
statusButtons.update(true)
statusButtons.width = maxWidth
statusButtons.wrap()
statusButtons.pack()
}
statusButtons.setPosition(stage.width - statusButtons.width - 10f, topBar.y - statusButtons.height - 10f)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ class NextTurnButton(
|| (!worldScreen.hasOpenPopups() && worldScreen.isPlayersTurn
&& !worldScreen.waitingForAutosave && !worldScreen.isNextTurnUpdateRunning())
if (isEnabled) addTooltip(KeyboardBinding.NextTurn) else addTooltip("")

worldScreen.smallUnitButton.update()
}

internal fun updateButton(nextTurnAction: NextTurnAction) {
Expand All @@ -78,7 +76,4 @@ class NextTurnButton(
private fun getNextTurnAction(worldScreen: WorldScreen) =
// Guaranteed to return a non-null NextTurnAction because the last isChoice always returns true
NextTurnAction.entries.first { it.isChoice(worldScreen) }

fun isNextUnitAction(): Boolean = nextTurnAction == NextTurnAction.NextUnit

}

This file was deleted.

66 changes: 33 additions & 33 deletions core/src/com/unciv/ui/screens/worldscreen/status/StatusButtons.kt
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
package com.unciv.ui.screens.worldscreen.status

import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup
import com.badlogic.gdx.utils.Disposable

class StatusButtons(
val nextTurnButton: NextTurnButton
) : Table(), Disposable {
var autoPlayStatusButton: AutoPlayStatusButton? = null
var multiplayerStatusButton: MultiplayerStatusButton? = null
var smallUnitButton: SmallUnitButton? = null
private val padXSpace = 10f
private val padYSpace = 5f

init {
add(nextTurnButton)
}

fun update(verticalWrap: Boolean) {
clear()
if(verticalWrap) {
add(nextTurnButton)
smallUnitButton?.let {
row()
add(it).padTop(padYSpace).right()
}
autoPlayStatusButton?.let {
row()
add(it).padTop(padYSpace).right()
nextTurnButton: NextTurnButton,
autoPlayStatusButton: AutoPlayStatusButton? = null,
multiplayerStatusButton: MultiplayerStatusButton? = null
) : HorizontalGroup(), Disposable {
var autoPlayStatusButton: AutoPlayStatusButton? = autoPlayStatusButton
set(button) {
autoPlayStatusButton?.remove()
field = button
if (button != null) {
addActorAt(0, button)
}
multiplayerStatusButton?.let {
row()
add(it).padTop(padYSpace).right()
}
var multiplayerStatusButton: MultiplayerStatusButton? = multiplayerStatusButton
set(button) {
multiplayerStatusButton?.remove()
field = button
if (button != null) {
addActorAt(0, button)
}
} else {
multiplayerStatusButton?.let { add(it).padRight(padXSpace).top() }
autoPlayStatusButton?.let { add(it).padRight(padXSpace).top() }
smallUnitButton?.let { add(it).padRight(padXSpace).top() }
add(nextTurnButton)
}
pack()


init {
space(10f)
right()
wrapReverse()
wrapSpace(10f)
rowRight()
if (autoPlayStatusButton != null) {
addActor(autoPlayStatusButton)
}
if (multiplayerStatusButton != null) {
addActor(multiplayerStatusButton)
}
addActor(nextTurnButton)
}

override fun dispose() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ object UnitActions {

addExplorationActions(unit)

addSkipAction(unit)
addWaitAction(unit)

// From here we have actions defaulting to the second page
if (unit.isMoving()) {
Expand Down Expand Up @@ -377,11 +377,10 @@ object UnitActions {
))
}

// Skip one turn: marks a unit as due=false and doesn't cycle back in the queue
private suspend fun SequenceScope<UnitAction>.addSkipAction(unit: MapUnit) {
private suspend fun SequenceScope<UnitAction>.addWaitAction(unit: MapUnit) {
yield(UnitAction(
type = UnitActionType.Skip,
useFrequency = 0f, // Last on first page (defaultPage=0)
type = UnitActionType.Wait,
useFrequency = 65f, // Preferably have this on the first page
action = {
unit.due = !unit.due
// If it's on, skips to next unit due to worldScreen.switchToNextUnit() in activateAction
Expand Down
Loading

0 comments on commit c0b1baa

Please sign in to comment.