Add a state that allows changing the controls bar
This commit is contained in:
parent
4c318a9aeb
commit
0045cd4184
1 changed files with 11 additions and 2 deletions
|
|
@ -1,8 +1,11 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import ShipsMoving from "../components/ShipsMoving.svelte";
|
||||||
import PlayerHand from "../components/PlayerHand.svelte";
|
import PlayerHand from "../components/PlayerHand.svelte";
|
||||||
import Board from "../components/Board.svelte";
|
import Board from "../components/Board.svelte";
|
||||||
import { board } from "../stores";
|
import { board } from "../stores";
|
||||||
|
|
||||||
|
const controlsState: string = "player-order";
|
||||||
|
|
||||||
const notice = {
|
const notice = {
|
||||||
visible: false,
|
visible: false,
|
||||||
message: null,
|
message: null,
|
||||||
|
|
@ -48,11 +51,17 @@ function previewBoard(e: any) {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<div id="player-hand">
|
{#if controlsState == "player-hand"}
|
||||||
|
<div id="player-controls">
|
||||||
<PlayerHand
|
<PlayerHand
|
||||||
on:hover="{previewBoard}"
|
on:hover="{previewBoard}"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
{:else if controlsState == "player-order"}
|
||||||
|
<div id="player-controls">
|
||||||
|
<ShipsMoving />
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -106,7 +115,7 @@ main {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#player-hand {
|
#player-controls {
|
||||||
grid-column: 2 / 3;
|
grid-column: 2 / 3;
|
||||||
grid-row: 4 / 5;
|
grid-row: 4 / 5;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue