restrict inputs to chosen controller
parent
b35af93ecb
commit
e162edf6f5
|
@ -140,7 +140,7 @@ export class InputsController {
|
||||||
}
|
}
|
||||||
|
|
||||||
setupGamepad(thisGamepad: Phaser.Input.Gamepad.Gamepad): void {
|
setupGamepad(thisGamepad: Phaser.Input.Gamepad.Gamepad): void {
|
||||||
let gamepadID = thisGamepad.id.toLowerCase();
|
let gamepadID = this.chosenGamepad?.toLowerCase() || thisGamepad.id.toLowerCase();
|
||||||
const mappedPad = this.mapGamepad(gamepadID);
|
const mappedPad = this.mapGamepad(gamepadID);
|
||||||
this.player['mapping'] = mappedPad.gamepadMapping;
|
this.player['mapping'] = mappedPad.gamepadMapping;
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,7 @@ export class InputsController {
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
||||||
if (!this.gamepadSupport) return;
|
if (!this.gamepadSupport || pad.id.toLowerCase() !== this.chosenGamepad.toLowerCase()) return;
|
||||||
const actionMapping = this.getActionGamepadMapping();
|
const actionMapping = this.getActionGamepadMapping();
|
||||||
const buttonDown = actionMapping.hasOwnProperty(button.index) && actionMapping[button.index];
|
const buttonDown = actionMapping.hasOwnProperty(button.index) && actionMapping[button.index];
|
||||||
if (buttonDown !== undefined) {
|
if (buttonDown !== undefined) {
|
||||||
|
@ -194,7 +194,7 @@ export class InputsController {
|
||||||
}
|
}
|
||||||
|
|
||||||
gamepadButtonUp(pad: Phaser.Input.Gamepad.Gamepad, button: Phaser.Input.Gamepad.Button, value: number): void {
|
gamepadButtonUp(pad: Phaser.Input.Gamepad.Gamepad, button: Phaser.Input.Gamepad.Button, value: number): void {
|
||||||
if (!this.gamepadSupport) return;
|
if (!this.gamepadSupport || pad.id.toLowerCase() !== this.chosenGamepad.toLowerCase()) return;
|
||||||
const actionMapping = this.getActionGamepadMapping();
|
const actionMapping = this.getActionGamepadMapping();
|
||||||
const buttonUp = actionMapping.hasOwnProperty(button.index) && actionMapping[button.index];
|
const buttonUp = actionMapping.hasOwnProperty(button.index) && actionMapping[button.index];
|
||||||
if (buttonUp !== undefined) {
|
if (buttonUp !== undefined) {
|
||||||
|
|
Loading…
Reference in New Issue