Merge branch 'fix/gamepad_support_disable_focus' of github.com:Greenlamp2/pokerogue into feat/mapping_setting
Conflicts: src/inputs-controller.ts src/system/settings.tspull/685/head
commit
5c9af9bb3c
|
@ -108,10 +108,13 @@ export class InputsController {
|
||||||
}
|
}
|
||||||
|
|
||||||
setGamepadSupport(value: boolean): void {
|
setGamepadSupport(value: boolean): void {
|
||||||
|
// value is true if we activate gamepad
|
||||||
|
// value is false if we deactivate gamepad
|
||||||
if (value) {
|
if (value) {
|
||||||
this.gamepadSupport = true;
|
this.gamepadSupport = true;
|
||||||
} else {
|
} else {
|
||||||
this.gamepadSupport = false;
|
this.gamepadSupport = false;
|
||||||
|
// if we disable the gamepad, we want to release every key pressed
|
||||||
this.deactivatePressedKey();
|
this.deactivatePressedKey();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,14 +128,21 @@ export class InputsController {
|
||||||
// reversed to let the cancel button have a kinda priority on the action button
|
// reversed to let the cancel button have a kinda priority on the action button
|
||||||
for (const b of Utils.getEnumValues(Button).reverse()) {
|
for (const b of Utils.getEnumValues(Button).reverse()) {
|
||||||
if (
|
if (
|
||||||
this.interactions.hasOwnProperty(b) &&
|
this.interactions.hasOwnProperty(b) && // if the button is in the interactions dict
|
||||||
this.repeatInputDurationJustPassed(b) &&
|
this.repeatInputDurationJustPassed(b) && // if we hold enough the button
|
||||||
this.interactions[b].isPressed
|
this.interactions[b].isPressed // if the button is pressed
|
||||||
) {
|
) {
|
||||||
|
// if the gamepad support is disable and the source is a gamepad
|
||||||
|
// we don't want to repeat the button
|
||||||
|
// even if we have disabled the gamepad, at the exact moment of the change in the menu
|
||||||
|
// we can be here and have an infinite loop since the code can't know we
|
||||||
|
// have released the key since the gamepad is not there anymore
|
||||||
|
// if it's an input sent by another gamepad than the chosen one, we prevent it
|
||||||
if (
|
if (
|
||||||
(!this.gamepadSupport && this.interactions[b].source === 'gamepad') ||
|
(!this.gamepadSupport && this.interactions[b].source === 'gamepad') ||
|
||||||
(this.interactions[b].sourceName !== null && this.interactions[b].sourceName !== this.chosenGamepad)
|
(this.interactions[b].sourceName !== null && this.interactions[b].sourceName !== this.chosenGamepad)
|
||||||
) {
|
) {
|
||||||
|
// we delete the latest interracted button
|
||||||
this.delLastProcessedMovementTime(b);
|
this.delLastProcessedMovementTime(b);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -353,6 +363,7 @@ export class InputsController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// added source so when we repeat the key, we can also tell from which source the key is from
|
||||||
setLastProcessedMovementTime(button: Button, source: String = 'keyboard', sourceName: String): void {
|
setLastProcessedMovementTime(button: Button, source: String = 'keyboard', sourceName: String): void {
|
||||||
if (!this.interactions.hasOwnProperty(button)) return;
|
if (!this.interactions.hasOwnProperty(button)) return;
|
||||||
this.setButtonLock(button);
|
this.setButtonLock(button);
|
||||||
|
|
Loading…
Reference in New Issue