do not move player if clicked on Player or RemotePlayer. Close actionsMenu on second click
This commit is contained in:
parent
907026463d
commit
88f3032298
@ -12,6 +12,8 @@ export class RemotePlayer extends Character {
|
||||
userId: number;
|
||||
private visitCardUrl: string | null;
|
||||
|
||||
private actionsMenuRequested: boolean = false;
|
||||
|
||||
constructor(
|
||||
userId: number,
|
||||
Scene: GameScene,
|
||||
@ -42,9 +44,16 @@ export class RemotePlayer extends Character {
|
||||
//set data
|
||||
this.userId = userId;
|
||||
this.visitCardUrl = visitCardUrl;
|
||||
requestActionsMenuStore.subscribe((value: boolean) => {
|
||||
this.actionsMenuRequested = value;
|
||||
});
|
||||
|
||||
this.on("pointerdown", (event: Phaser.Input.Pointer) => {
|
||||
if (event.downElement.nodeName === "CANVAS") {
|
||||
if (this.actionsMenuRequested) {
|
||||
requestActionsMenuStore.set(false);
|
||||
return;
|
||||
}
|
||||
actionsMenuStore.addPossibleAction(
|
||||
"visit-card",
|
||||
"Visiting Card", () => {
|
||||
|
@ -1,3 +1,6 @@
|
||||
import { Player } from '../Player/Player';
|
||||
import { RemotePlayer } from '../Entity/RemotePlayer';
|
||||
|
||||
import type { UserInputHandlerInterface } from "../../Interfaces/UserInputHandlerInterface";
|
||||
import type { GameScene } from "../Game/GameScene";
|
||||
|
||||
@ -22,6 +25,12 @@ export class GameSceneUserInputHandler implements UserInputHandlerInterface {
|
||||
if (pointer.rightButtonReleased() || pointer.getDuration() > 250) {
|
||||
return;
|
||||
}
|
||||
for (const object of gameObjects) {
|
||||
if (object instanceof Player || object instanceof RemotePlayer) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
console.log(gameObjects);
|
||||
const camera = this.gameScene.getCameraManager().getCamera();
|
||||
const index = this.gameScene
|
||||
.getGameMap()
|
||||
|
Loading…
Reference in New Issue
Block a user