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;
|
userId: number;
|
||||||
private visitCardUrl: string | null;
|
private visitCardUrl: string | null;
|
||||||
|
|
||||||
|
private actionsMenuRequested: boolean = false;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
userId: number,
|
userId: number,
|
||||||
Scene: GameScene,
|
Scene: GameScene,
|
||||||
@ -42,9 +44,16 @@ export class RemotePlayer extends Character {
|
|||||||
//set data
|
//set data
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
this.visitCardUrl = visitCardUrl;
|
this.visitCardUrl = visitCardUrl;
|
||||||
|
requestActionsMenuStore.subscribe((value: boolean) => {
|
||||||
|
this.actionsMenuRequested = value;
|
||||||
|
});
|
||||||
|
|
||||||
this.on("pointerdown", (event: Phaser.Input.Pointer) => {
|
this.on("pointerdown", (event: Phaser.Input.Pointer) => {
|
||||||
if (event.downElement.nodeName === "CANVAS") {
|
if (event.downElement.nodeName === "CANVAS") {
|
||||||
|
if (this.actionsMenuRequested) {
|
||||||
|
requestActionsMenuStore.set(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
actionsMenuStore.addPossibleAction(
|
actionsMenuStore.addPossibleAction(
|
||||||
"visit-card",
|
"visit-card",
|
||||||
"Visiting 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 { UserInputHandlerInterface } from "../../Interfaces/UserInputHandlerInterface";
|
||||||
import type { GameScene } from "../Game/GameScene";
|
import type { GameScene } from "../Game/GameScene";
|
||||||
|
|
||||||
@ -22,6 +25,12 @@ export class GameSceneUserInputHandler implements UserInputHandlerInterface {
|
|||||||
if (pointer.rightButtonReleased() || pointer.getDuration() > 250) {
|
if (pointer.rightButtonReleased() || pointer.getDuration() > 250) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
for (const object of gameObjects) {
|
||||||
|
if (object instanceof Player || object instanceof RemotePlayer) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(gameObjects);
|
||||||
const camera = this.gameScene.getCameraManager().getCamera();
|
const camera = this.gameScene.getCameraManager().getCamera();
|
||||||
const index = this.gameScene
|
const index = this.gameScene
|
||||||
.getGameMap()
|
.getGameMap()
|
||||||
|
Loading…
Reference in New Issue
Block a user