Add setting for gamepad support
parent
0692a343a0
commit
1ff206287a
|
@ -128,6 +128,7 @@ export default class BattleScene extends SceneBase {
|
||||||
public moveAnimations: boolean = true;
|
public moveAnimations: boolean = true;
|
||||||
public hpBarSpeed: integer = 0;
|
public hpBarSpeed: integer = 0;
|
||||||
public fusionPaletteSwaps: boolean = true;
|
public fusionPaletteSwaps: boolean = true;
|
||||||
|
public gamepadSupport: boolean = true;
|
||||||
public enableTouchControls: boolean = false;
|
public enableTouchControls: boolean = false;
|
||||||
public enableVibration: boolean = false;
|
public enableVibration: boolean = false;
|
||||||
|
|
||||||
|
@ -1299,7 +1300,7 @@ export default class BattleScene extends SceneBase {
|
||||||
* again.
|
* again.
|
||||||
*/
|
*/
|
||||||
gamepadButtonJustDown(button: Phaser.Input.Gamepad.Button) : boolean {
|
gamepadButtonJustDown(button: Phaser.Input.Gamepad.Button) : boolean {
|
||||||
if (!button)
|
if (!button || !this.gamepadSupport)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
let ret = false;
|
let ret = false;
|
||||||
|
|
|
@ -19,6 +19,7 @@ export enum Setting {
|
||||||
HP_Bar_Speed = "HP_BAR_SPEED",
|
HP_Bar_Speed = "HP_BAR_SPEED",
|
||||||
Fusion_Palette_Swaps = "FUSION_PALETTE_SWAPS",
|
Fusion_Palette_Swaps = "FUSION_PALETTE_SWAPS",
|
||||||
Player_Gender = "PLAYER_GENDER",
|
Player_Gender = "PLAYER_GENDER",
|
||||||
|
Gamepad_Support = "GAMEPAD_SUPPORT",
|
||||||
Touch_Controls = "TOUCH_CONTROLS",
|
Touch_Controls = "TOUCH_CONTROLS",
|
||||||
Vibration = "VIBRATION"
|
Vibration = "VIBRATION"
|
||||||
}
|
}
|
||||||
|
@ -47,6 +48,7 @@ export const settingOptions: SettingOptions = {
|
||||||
[Setting.HP_Bar_Speed]: [ 'Normal', 'Fast', 'Faster', 'Instant' ],
|
[Setting.HP_Bar_Speed]: [ 'Normal', 'Fast', 'Faster', 'Instant' ],
|
||||||
[Setting.Fusion_Palette_Swaps]: [ 'Off', 'On' ],
|
[Setting.Fusion_Palette_Swaps]: [ 'Off', 'On' ],
|
||||||
[Setting.Player_Gender]: [ 'Boy', 'Girl' ],
|
[Setting.Player_Gender]: [ 'Boy', 'Girl' ],
|
||||||
|
[Setting.Gamepad_Support]: [ 'Auto', 'Disabled' ],
|
||||||
[Setting.Touch_Controls]: [ 'Auto', 'Disabled' ],
|
[Setting.Touch_Controls]: [ 'Auto', 'Disabled' ],
|
||||||
[Setting.Vibration]: [ 'Auto', 'Disabled' ]
|
[Setting.Vibration]: [ 'Auto', 'Disabled' ]
|
||||||
};
|
};
|
||||||
|
@ -130,6 +132,9 @@ export function setSetting(scene: BattleScene, setting: Setting, value: integer)
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
|
case Setting.Gamepad_Support:
|
||||||
|
scene.gamepadSupport = settingOptions[setting][value] !== 'Disabled';
|
||||||
|
break;
|
||||||
case Setting.Touch_Controls:
|
case Setting.Touch_Controls:
|
||||||
scene.enableTouchControls = settingOptions[setting][value] !== 'Disabled' && hasTouchscreen();
|
scene.enableTouchControls = settingOptions[setting][value] !== 'Disabled' && hasTouchscreen();
|
||||||
const touchControls = document.getElementById('touchControls');
|
const touchControls = document.getElementById('touchControls');
|
||||||
|
|
Loading…
Reference in New Issue