Allow Space Key to close PlayerReadyScreen (#10155)

This commit is contained in:
SomeTroglodyte 2023-09-21 13:59:34 +02:00 committed by GitHub
parent 5a8f18f726
commit b6db8df484
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,9 +3,11 @@ package com.unciv.ui.screens.worldscreen
import com.badlogic.gdx.scenes.scene2d.Touchable import com.badlogic.gdx.scenes.scene2d.Touchable
import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.unciv.Constants import com.unciv.Constants
import com.unciv.ui.screens.basescreen.BaseScreen
import com.unciv.ui.components.input.onClick
import com.unciv.ui.components.extensions.toLabel import com.unciv.ui.components.extensions.toLabel
import com.unciv.ui.components.input.KeyboardBinding
import com.unciv.ui.components.input.keyShortcuts
import com.unciv.ui.components.input.onActivation
import com.unciv.ui.screens.basescreen.BaseScreen
class PlayerReadyScreen(worldScreen: WorldScreen) : BaseScreen() { class PlayerReadyScreen(worldScreen: WorldScreen) : BaseScreen() {
init { init {
@ -19,9 +21,11 @@ class PlayerReadyScreen(worldScreen: WorldScreen) : BaseScreen() {
table.add("[$curCiv] ready?".toLabel(curCiv.nation.getInnerColor(), Constants.headingFontSize)) table.add("[$curCiv] ready?".toLabel(curCiv.nation.getInnerColor(), Constants.headingFontSize))
table.onClick { table.onActivation {
game.replaceCurrentScreen(worldScreen) game.replaceCurrentScreen(worldScreen)
} }
// Doing this separately instead of passing the binding to onActivation avoids the tooltip
table.keyShortcuts.add(KeyboardBinding.NextTurnAlternate)
table.setFillParent(true) table.setFillParent(true)
stage.addActor(table) stage.addActor(table)
} }