mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-16 05:12:19 +02:00
block deletion on binding
This commit is contained in:
parent
e77163dfae
commit
f02e441266
@ -18,8 +18,9 @@ export default class GamepadBindingUiHandler extends AbstractBindingUiHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
gamepadButtonDown(pad: Phaser.Input.Gamepad.Gamepad, button: Phaser.Input.Gamepad.Button, value: number): void {
|
gamepadButtonDown(pad: Phaser.Input.Gamepad.Gamepad, button: Phaser.Input.Gamepad.Button, value: number): void {
|
||||||
|
const blacklist = [12, 13, 14, 15]; // d-pad buttons are blacklisted.
|
||||||
// Check conditions before processing the button press.
|
// Check conditions before processing the button press.
|
||||||
if (!this.listening || pad.id.toLowerCase() !== this.getSelectedDevice() || this.buttonPressed !== null) return;
|
if (!this.listening || pad.id.toLowerCase() !== this.getSelectedDevice() || blacklist.includes(button.index) || this.buttonPressed !== null) return;
|
||||||
const activeConfig = this.scene.inputController.getActiveConfig(Device.GAMEPAD);
|
const activeConfig = this.scene.inputController.getActiveConfig(Device.GAMEPAD);
|
||||||
const type = activeConfig.padType
|
const type = activeConfig.padType
|
||||||
const key = getKeyWithKeycode(activeConfig, button.index);
|
const key = getKeyWithKeycode(activeConfig, button.index);
|
||||||
|
@ -19,9 +19,19 @@ export default class KeyboardBindingUiHandler extends AbstractBindingUiHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onKeyDown(event): void {
|
onKeyDown(event): void {
|
||||||
|
const blacklist = [
|
||||||
|
Phaser.Input.Keyboard.KeyCodes.UP,
|
||||||
|
Phaser.Input.Keyboard.KeyCodes.DOWN,
|
||||||
|
Phaser.Input.Keyboard.KeyCodes.LEFT,
|
||||||
|
Phaser.Input.Keyboard.KeyCodes.RIGHT,
|
||||||
|
Phaser.Input.Keyboard.KeyCodes.HOME,
|
||||||
|
Phaser.Input.Keyboard.KeyCodes.ENTER,
|
||||||
|
Phaser.Input.Keyboard.KeyCodes.ESC,
|
||||||
|
Phaser.Input.Keyboard.KeyCodes.DELETE,
|
||||||
|
];
|
||||||
const key = event.keyCode;
|
const key = event.keyCode;
|
||||||
// // Check conditions before processing the button press.
|
// // Check conditions before processing the button press.
|
||||||
if (!this.listening || this.buttonPressed !== null) return;
|
if (!this.listening || this.buttonPressed !== null || blacklist.includes(key)) return;
|
||||||
const activeConfig = this.scene.inputController.getActiveConfig(Device.KEYBOARD);
|
const activeConfig = this.scene.inputController.getActiveConfig(Device.KEYBOARD);
|
||||||
const _key = getKeyWithKeycode(activeConfig, key);
|
const _key = getKeyWithKeycode(activeConfig, key);
|
||||||
const buttonIcon = activeConfig.icons[_key];
|
const buttonIcon = activeConfig.icons[_key];
|
||||||
|
@ -70,6 +70,7 @@ export default class SettingsKeyboardUiHandler extends AbstractSettingsUiUiHandl
|
|||||||
* Handle the delete key press event.
|
* Handle the delete key press event.
|
||||||
*/
|
*/
|
||||||
onDeleteDown(): void {
|
onDeleteDown(): void {
|
||||||
|
if (this.scene.ui.getMode() !== Mode.SETTINGS_KEYBOARD) return;
|
||||||
const cursor = this.cursor + this.scrollCursor; // Calculate the absolute cursor position.
|
const cursor = this.cursor + this.scrollCursor; // Calculate the absolute cursor position.
|
||||||
const selection = this.settingLabels[cursor].text;
|
const selection = this.settingLabels[cursor].text;
|
||||||
const key = reverseValueToKeySetting(selection);
|
const key = reverseValueToKeySetting(selection);
|
||||||
|
Loading…
Reference in New Issue
Block a user