mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-07 14:02:48 +07:00
The console key should be bindable? (#10952)
This commit is contained in:
parent
940cda3009
commit
4e67d9535f
@ -8,6 +8,12 @@ import com.unciv.models.stats.Stat
|
||||
private val unCamelCaseRegex = Regex("([A-Z])([A-Z])([a-z])|([a-z])([A-Z])")
|
||||
private fun unCamelCase(name: String) = unCamelCaseRegex.replace(name, """$1$4 $2$3$5""")
|
||||
|
||||
/**
|
||||
* This is the database of supported "bindable" keyboard shortcuts.
|
||||
*
|
||||
* Note a label is automatically generated from the name by inserting spaces before each uppercase letter (except the initial one),
|
||||
* and translation keys are automatically generated for all labels. This also works for [KeyboardBinding.Category].
|
||||
*/
|
||||
enum class KeyboardBinding(
|
||||
val category: Category,
|
||||
label: String? = null,
|
||||
@ -35,6 +41,7 @@ enum class KeyboardBinding(
|
||||
NextTurnAlternate(Category.WorldScreen, KeyCharAndCode.SPACE),
|
||||
EmpireOverview(Category.WorldScreen),
|
||||
MusicPlayer(Category.WorldScreen, KeyCharAndCode.ctrl('m')),
|
||||
DeveloperConsole(Category.WorldScreen, '`'),
|
||||
|
||||
/*
|
||||
* These try to be faithful to default Civ5 key bindings as found in several places online
|
||||
|
@ -192,7 +192,7 @@ class WorldScreen(
|
||||
globalShortcuts.add(KeyCharAndCode.BACK) { backButtonAndESCHandler() }
|
||||
|
||||
|
||||
globalShortcuts.add('`') {
|
||||
globalShortcuts.add(KeyboardBinding.DeveloperConsole) {
|
||||
// No cheating unless you're by yourself
|
||||
if (gameInfo.civilizations.count { it.isHuman() } > 1) return@add
|
||||
val consolePopup = DevConsolePopup(this)
|
||||
|
Loading…
Reference in New Issue
Block a user