ActionsMenu WIP
This commit is contained in:
parent
ad2dd1c8d5
commit
fd012d6c69
69
front/src/Components/ActionsMenu/ActionsMenu.svelte
Normal file
69
front/src/Components/ActionsMenu/ActionsMenu.svelte
Normal file
@ -0,0 +1,69 @@
|
||||
<script lang="typescript">
|
||||
import { fly } from "svelte/transition";
|
||||
import { requestActionsMenuStore, requestVisitCardsStore } from '../../Stores/GameStore';
|
||||
|
||||
// export parameters here to show more menu options
|
||||
|
||||
function onKeyDown(e: KeyboardEvent) {
|
||||
if (e.key === "Escape") {
|
||||
closeActionsMenu();
|
||||
}
|
||||
}
|
||||
|
||||
function closeActionsMenu() {
|
||||
requestActionsMenuStore.set(false);
|
||||
}
|
||||
|
||||
function showVisitingCard() {
|
||||
// requestVisitCardsStore.set(true);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<svelte:window on:keydown={onKeyDown} />
|
||||
|
||||
<div class="actions-menu nes-container is-rounded">
|
||||
<button type="button" class="nes-btn is-error close" on:click={closeActionsMenu}>×</button>
|
||||
<h2>Actions</h2>
|
||||
<nav>
|
||||
<button
|
||||
type="button"
|
||||
class="nes-btn"
|
||||
on:click|preventDefault={() => { console.log('clicked on button'); }}
|
||||
>
|
||||
Visiting Card
|
||||
</button>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.actions-menu {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translate(-50%, 0);
|
||||
width: 230px !important;
|
||||
height: 300px !important;
|
||||
margin-top: 200px;
|
||||
|
||||
pointer-events: auto;
|
||||
font-family: "Press Start 2P";
|
||||
background-color: #333333;
|
||||
color: whitesmoke;
|
||||
|
||||
h2 {
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
nav button {
|
||||
width: 100%;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.nes-btn.is-error.close {
|
||||
position: absolute;
|
||||
top: -20px;
|
||||
right: -20px;
|
||||
}
|
||||
}
|
||||
</style>
|
@ -17,7 +17,7 @@
|
||||
import { loginSceneVisibleStore } from "../Stores/LoginSceneStore";
|
||||
import EnableCameraScene from "./EnableCamera/EnableCameraScene.svelte";
|
||||
import VisitCard from "./VisitCard/VisitCard.svelte";
|
||||
import { requestVisitCardsStore } from "../Stores/GameStore";
|
||||
import { requestVisitCardsStore, requestActionsMenuStore } from "../Stores/GameStore";
|
||||
|
||||
import type { Game } from "../Phaser/Game/Game";
|
||||
import { chatVisibilityStore } from "../Stores/ChatStore";
|
||||
@ -48,6 +48,7 @@
|
||||
import { followStateStore } from "../Stores/FollowStore";
|
||||
import { peerStore } from "../Stores/PeerStore";
|
||||
import FollowMenu from "./FollowMenu/FollowMenu.svelte";
|
||||
import ActionsMenu from './ActionsMenu/ActionsMenu.svelte';
|
||||
|
||||
export let game: Game;
|
||||
</script>
|
||||
@ -152,6 +153,9 @@
|
||||
{#if $requestVisitCardsStore}
|
||||
<VisitCard visitCardUrl={$requestVisitCardsStore} />
|
||||
{/if}
|
||||
{#if $requestActionsMenuStore}
|
||||
<ActionsMenu />
|
||||
{/if}
|
||||
{#if $errorStore.length > 0}
|
||||
<div>
|
||||
<ErrorDialog />
|
||||
|
@ -2,7 +2,7 @@ import type { GameScene } from "../Game/GameScene";
|
||||
import type { PointInterface } from "../../Connexion/ConnexionModels";
|
||||
import { Character } from "../Entity/Character";
|
||||
import type { PlayerAnimationDirections } from "../Player/Animation";
|
||||
import { requestVisitCardsStore } from "../../Stores/GameStore";
|
||||
import { requestVisitCardsStore, requestActionsMenuStore } from "../../Stores/GameStore";
|
||||
|
||||
/**
|
||||
* Class representing the sprite of a remote player (a player that plays on another computer)
|
||||
@ -44,7 +44,8 @@ export class RemotePlayer extends Character {
|
||||
|
||||
this.on("pointerdown", (event: Phaser.Input.Pointer) => {
|
||||
if (event.downElement.nodeName === "CANVAS") {
|
||||
requestVisitCardsStore.set(this.visitCardUrl);
|
||||
// requestVisitCardsStore.set(this.visitCardUrl);
|
||||
requestActionsMenuStore.set(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1915,6 +1915,7 @@ ${escapedMessage}
|
||||
}
|
||||
|
||||
const texturesPromise = lazyLoadPlayerCharacterTextures(this.load, addPlayerData.characterLayers);
|
||||
console.log(addPlayerData);
|
||||
const player = new RemotePlayer(
|
||||
addPlayerData.userId,
|
||||
this,
|
||||
|
@ -4,6 +4,8 @@ export const userMovingStore = writable(false);
|
||||
|
||||
export const requestVisitCardsStore = writable<string | null>(null);
|
||||
|
||||
export const requestActionsMenuStore = writable(true);
|
||||
|
||||
export const userIsAdminStore = writable(false);
|
||||
|
||||
export const limitMapStore = writable(false);
|
||||
|
Loading…
Reference in New Issue
Block a user