added store with actions for actionsMenu

This commit is contained in:
Hanusiak Piotr 2022-01-25 13:42:41 +01:00
parent 69a2379e53
commit 67627637aa
4 changed files with 76 additions and 14 deletions

View file

@ -3,6 +3,7 @@ import type { PointInterface } from "../../Connexion/ConnexionModels";
import { Character } from "../Entity/Character";
import type { PlayerAnimationDirections } from "../Player/Animation";
import { requestVisitCardsStore, requestActionsMenuStore } from "../../Stores/GameStore";
import { actionsMenuStore } from '../../Stores/ActionsMenuStore';
/**
* Class representing the sprite of a remote player (a player that plays on another computer)
@ -44,7 +45,30 @@ export class RemotePlayer extends Character {
this.on("pointerdown", (event: Phaser.Input.Pointer) => {
if (event.downElement.nodeName === "CANVAS") {
// requestVisitCardsStore.set(this.visitCardUrl);
actionsMenuStore.addPossibleAction(
"visit-card",
"Visiting Card", () => {
requestVisitCardsStore.set(this.visitCardUrl);
actionsMenuStore.clearActions();
requestActionsMenuStore.set(false);
});
actionsMenuStore.addPossibleAction(
"log-hello",
"Log Hello", () => {
console.log('HELLO');
// requestActionsMenuStore.set(false);
});
actionsMenuStore.addPossibleAction(
"log-goodbye",
"Log Goodbye", () => {
console.log('GOODBYE');
// requestActionsMenuStore.set(false);
});
actionsMenuStore.addPossibleAction(
"clear",
"Clear Actions", () => {
actionsMenuStore.clearActions();
});
requestActionsMenuStore.set(true);
}
});