From 3916d9c58e803e30ef6d4a24cc0a0c7c75c75b96 Mon Sep 17 00:00:00 2001 From: Lurkars Date: Sun, 19 Dec 2021 12:51:19 +0100 Subject: [PATCH] Add follow button to ui, improved flow --- front/src/Components/App.svelte | 4 +- .../Components/FollowMenu/FollowMenu.svelte | 40 +++++++++++++++++++ front/src/Components/images/follow.svg | 1 + front/src/Phaser/Player/Player.ts | 7 ++++ front/src/Stores/FollowStore.ts | 1 + 5 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 front/src/Components/images/follow.svg diff --git a/front/src/Components/App.svelte b/front/src/Components/App.svelte index 5f09beef..36f815bd 100644 --- a/front/src/Components/App.svelte +++ b/front/src/Components/App.svelte @@ -42,7 +42,7 @@ import AudioManager from "./AudioManager/AudioManager.svelte"; import { showReportScreenStore, userReportEmpty } from "../Stores/ShowReportScreenStore"; import ReportMenu from "./ReportMenu/ReportMenu.svelte"; - import { followStateStore, followStates } from "../Stores/FollowStore"; + import { followStateStore, followRoleStore, followStates, followRoles } from "../Stores/FollowStore"; import FollowMenu from "./FollowMenu/FollowMenu.svelte"; export let game: Game; @@ -104,7 +104,7 @@ {/if} - {#if $followStateStore !== followStates.off} + {#if $followStateStore !== followStates.off || $followRoleStore === followRoles.open}
diff --git a/front/src/Components/FollowMenu/FollowMenu.svelte b/front/src/Components/FollowMenu/FollowMenu.svelte index 983fc507..e26032bb 100644 --- a/front/src/Components/FollowMenu/FollowMenu.svelte +++ b/front/src/Components/FollowMenu/FollowMenu.svelte @@ -6,6 +6,7 @@ vim: ft=typescript import type { Unsubscriber } from "svelte/store"; import { get } from "svelte/store"; import { gameManager } from "../../Phaser/Game/GameManager"; + import followImg from "../images/follow.svg"; import { followStateStore, @@ -76,6 +77,11 @@ vim: ft=typescript followUsersStore.set([]); } + function request() { + followStateStore.set(followStates.requesting); + followRoleStore.set(followRoles.leader); + } + function onKeyDown(e: KeyboardEvent) { if (e.key === "Escape") { reset(); @@ -152,6 +158,33 @@ vim: ft=typescript {/if} +{#if followRole === followRoles.open} + +{/if} + +{#if followState === followStates.active || followState === followStates.ending} + {#if followRole === followRoles.follower} + + {:else if followUsers.length > 0} + + {/if} +{/if} +