mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-08 14:57:58 +07:00
The console key should be bindable? (#10952)
This commit is contained in:
@ -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 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""")
|
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(
|
enum class KeyboardBinding(
|
||||||
val category: Category,
|
val category: Category,
|
||||||
label: String? = null,
|
label: String? = null,
|
||||||
@ -35,6 +41,7 @@ enum class KeyboardBinding(
|
|||||||
NextTurnAlternate(Category.WorldScreen, KeyCharAndCode.SPACE),
|
NextTurnAlternate(Category.WorldScreen, KeyCharAndCode.SPACE),
|
||||||
EmpireOverview(Category.WorldScreen),
|
EmpireOverview(Category.WorldScreen),
|
||||||
MusicPlayer(Category.WorldScreen, KeyCharAndCode.ctrl('m')),
|
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
|
* 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(KeyCharAndCode.BACK) { backButtonAndESCHandler() }
|
||||||
|
|
||||||
|
|
||||||
globalShortcuts.add('`') {
|
globalShortcuts.add(KeyboardBinding.DeveloperConsole) {
|
||||||
// No cheating unless you're by yourself
|
// No cheating unless you're by yourself
|
||||||
if (gameInfo.civilizations.count { it.isHuman() } > 1) return@add
|
if (gameInfo.civilizations.count { it.isHuman() } > 1) return@add
|
||||||
val consolePopup = DevConsolePopup(this)
|
val consolePopup = DevConsolePopup(this)
|
||||||
|
Reference in New Issue
Block a user