companion pictures store
This commit is contained in:
parent
5efa17651c
commit
8eaacdf2e5
6 changed files with 110 additions and 7 deletions
39
front/src/Components/Companion/Companion.svelte
Normal file
39
front/src/Components/Companion/Companion.svelte
Normal file
|
@ -0,0 +1,39 @@
|
|||
<script lang="typescript">
|
||||
import { onDestroy } from "svelte";
|
||||
|
||||
import { gameManager } from "../../Phaser/Game/GameManager";
|
||||
|
||||
export let userId: number;
|
||||
export let placeholderSrc: string;
|
||||
export let width: string = "62px";
|
||||
export let height: string = "62px";
|
||||
|
||||
const gameScene = gameManager.getCurrentGameScene();
|
||||
const playerWokaPictureStore = gameScene.getUserCompanionPictureStore(userId);
|
||||
|
||||
let src = placeholderSrc;
|
||||
const unsubscribe = playerWokaPictureStore.picture.subscribe((source) => {
|
||||
src = source ?? placeholderSrc;
|
||||
});
|
||||
|
||||
onDestroy(unsubscribe);
|
||||
</script>
|
||||
|
||||
<img {src} alt="" class="nes-pointer" style="--theme-width: {width}; --theme-height: {height}" />
|
||||
|
||||
<style>
|
||||
img {
|
||||
display: inline-block;
|
||||
pointer-events: auto;
|
||||
width: var(--theme-width);
|
||||
height: var(--theme-height);
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
position: static;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
image-rendering: pixelated;
|
||||
}
|
||||
</style>
|
|
@ -16,6 +16,7 @@
|
|||
import btnProfileSubMenuIdentity from "../images/btn-menu-profile-identity.svg";
|
||||
import btnProfileSubMenuCompanion from "../images/btn-menu-profile-companion.svg";
|
||||
import Woka from "../Woka/Woka.svelte";
|
||||
import Companion from "../Companion/Companion.svelte";
|
||||
|
||||
function disableMenuStores() {
|
||||
menuVisiblilityStore.set(false);
|
||||
|
@ -65,14 +66,11 @@
|
|||
<span class="btn-hover">Edit your name</span>
|
||||
</button>
|
||||
<button type="button" class="nes-btn" on:click|preventDefault={openEditSkinScene}>
|
||||
<!-- <div class="woka-icon">
|
||||
</div> -->
|
||||
<Woka userId={-1} placeholderSrc="" width="26px" height="26px" />
|
||||
<!-- <img src={btnProfileSubMenuWoka} alt="Edit your WOKA" /> -->
|
||||
<span class="btn-hover">Edit your WOKA</span>
|
||||
</button>
|
||||
<button type="button" class="nes-btn" on:click|preventDefault={openEditCompanionScene}>
|
||||
<img src={btnProfileSubMenuCompanion} alt="Edit your companion" />
|
||||
<Companion userId={-1} placeholderSrc={btnProfileSubMenuCompanion} width="26px" height="26px" />
|
||||
<span class="btn-hover">Edit your companion</span>
|
||||
</button>
|
||||
<button type="button" class="nes-btn" on:click|preventDefault={openEnableCameraScene}>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue