Integrate virtual joystick
This commit is contained in:
parent
e75fb9a6a9
commit
c3230bc2b3
10 changed files with 170 additions and 16 deletions
|
@ -291,6 +291,9 @@ export class MenuScene extends Phaser.Scene {
|
|||
case 'editGameSettingsButton':
|
||||
this.openGameSettingsMenu();
|
||||
break;
|
||||
case 'showJoystick':
|
||||
this.showJoystick();
|
||||
break;
|
||||
case 'adminConsoleButton':
|
||||
gameManager.getCurrentGameScene(this).ConsoleGlobalMessageManager.activeMessageConsole();
|
||||
break;
|
||||
|
@ -328,4 +331,21 @@ export class MenuScene extends Phaser.Scene {
|
|||
this.closeGameShare();
|
||||
this.gameReportElement.close();
|
||||
}
|
||||
|
||||
private showJoystick() {
|
||||
const gameScene = gameManager.getCurrentGameScene(this)
|
||||
if (gameScene?.virtualJoystick) {
|
||||
const joystickVisible = !gameScene.virtualJoystick.visible
|
||||
gameScene.virtualJoystick.visible = joystickVisible
|
||||
localUserStore.setJoystick(joystickVisible)
|
||||
}
|
||||
const body = document.querySelector('body')
|
||||
if (body) {
|
||||
if (document.fullscreenElement ?? document.fullscreen) {
|
||||
document.exitFullscreen()
|
||||
} else {
|
||||
body.requestFullscreen();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue