fallback if avatar could not be loaded

This commit is contained in:
Hanusiak Piotr 2021-12-01 11:14:54 +01:00
parent ed8d6855b1
commit a62cfe1cd8
3 changed files with 8 additions and 6 deletions

View file

@ -2,22 +2,22 @@
import { onDestroy } from 'svelte';
import { gameManager } from '../../Phaser/Game/GameManager';
import logoWA from "../images/logo-WA-pixel.png"; // placeholder
export let userId: number;
export let placeholderSrc: string;
const gameScene = gameManager.getCurrentGameScene();
const playerWokaPictureStore = gameScene.getUserWokaPictureStore(userId);
let src = logoWA;
let src = placeholderSrc;
const unsubscribe = playerWokaPictureStore.picture.subscribe((htmlElement) => {
src = htmlElement?.src ?? logoWA;
src = htmlElement?.src ?? placeholderSrc;
});
onDestroy(unsubscribe);
</script>
<img src={src} alt="woka" class="nes-pointer">
<img src={src} alt="" class="nes-pointer">
<style>
img {