mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-24 03:53:12 -04:00
Minor ImprovementPicker linting (#10862)
This commit is contained in:
parent
665b5aa87c
commit
8573aaf8d1
@ -17,7 +17,9 @@ import com.unciv.ui.components.extensions.disable
|
||||
import com.unciv.ui.components.extensions.toLabel
|
||||
import com.unciv.ui.components.extensions.toTextButton
|
||||
import com.unciv.ui.components.fonts.Fonts
|
||||
import com.unciv.ui.components.input.ActivationTypes
|
||||
import com.unciv.ui.components.input.keyShortcuts
|
||||
import com.unciv.ui.components.input.onActivation
|
||||
import com.unciv.ui.components.input.onClick
|
||||
import com.unciv.ui.components.input.onDoubleClick
|
||||
import com.unciv.ui.images.ImageGetter
|
||||
@ -175,7 +177,8 @@ class ImprovementPickerScreen(
|
||||
regularImprovements.add(statIcons).align(Align.right)
|
||||
|
||||
val improvementButton = PickerPane.getPickerOptionButton(image, labelText)
|
||||
improvementButton.onClick {
|
||||
// This is onClick without ActivationTypes.Keystroke equivalence - keys should select *and* close:
|
||||
improvementButton.onActivation(type = ActivationTypes.Tap, noEquivalence = true) {
|
||||
selectedImprovement = improvement
|
||||
pick(improvement.name.tr())
|
||||
descriptionLabel.setText(improvement.getDescription(ruleSet))
|
||||
@ -187,7 +190,7 @@ class ImprovementPickerScreen(
|
||||
if (proposedSolutions.isNotEmpty() || tileMarkedForCreatesOneImprovement) {
|
||||
improvementButton.disable()
|
||||
} else if (shortcutKey != null) {
|
||||
// FIXME: Different compared to onClick() and therefore no onActivation() here, to preserve pre-existing behavior. Reconsider this?
|
||||
// Shortcut keys trigger what onDoubleClick does, not equivalent to single Click:
|
||||
improvementButton.keyShortcuts.add(shortcutKey) { accept(improvement) }
|
||||
improvementButton.addTooltip(shortcutKey)
|
||||
}
|
||||
@ -203,7 +206,7 @@ class ImprovementPickerScreen(
|
||||
} else if (tile.getOwner()!!.isCurrentPlayer()) {
|
||||
val button = tile.getCity()!!.name.toTextButton(hideIcons = true)
|
||||
button.onClick {
|
||||
this.game.pushScreen(CityScreen(tile.getCity()!!,null,tile))
|
||||
this.game.pushScreen(CityScreen(tile.getCity()!!, null, tile))
|
||||
}
|
||||
ownerTable.add("Tile owned by [${tile.getOwner()!!.civName}] (You)".toLabel()).padLeft(10f)
|
||||
ownerTable.add(button).padLeft(20f)
|
||||
|
Loading…
x
Reference in New Issue
Block a user