11<script lang =" ts" >
2- // client-only.
3- import { goto } from " $app/navigation" ;
42import { setup } from " @/main.ts" ;
53import type { UIInfo } from " @/public-types.ts" ;
64import type { StageDefinition } from " @/stages.ts" ;
75import Ability from " @/ui-components/Ability.svelte" ;
86import Key from " @/ui-components/Key.svelte" ;
97import { onDestroy } from " svelte" ;
8+ // client-only.
9+ import PauseMenu from " ./PauseMenu.svelte" ;
1010
1111type Props = { stageNum: string ; stage: StageDefinition };
1212const { stageNum, stage }: Props = $props ();
@@ -39,6 +39,11 @@ onDestroy(() => bindings.ondestroy());
3939 </script >
4040
4141<div bind:this ={container } class =" container" >
42+ <PauseMenu
43+ paused ={uiContext .paused }
44+ onpause ={() => bindings .onpause ()}
45+ onresume ={() => bindings .onresume ()}
46+ />
4247 <div
4348 class =" uiBackground"
4449 style =" position: fixed; left: 0; top: 0; right: 0; display: flex; align-items: baseline;"
@@ -76,22 +81,6 @@ onDestroy(() => bindings.ondestroy());
7681 <Ability key ="Z" name ="Undo" count ={uiContext .undo } />
7782 <Ability key ="Y" name ="Redo" count ={uiContext .redo } />
7883 </div >
79- {#if uiContext .paused }
80- <div class =" uiBackground menu" >
81- <span style =" font-size: 2rem;" >Paused</span >
82- <!-- todo: ボタンのスタイル -->
83- <button style ="font-size: 1.5rem;" onclick ={bindings .onresume }>
84- Resume
85- </button >
86- <button
87- style =" font-size: 1.5rem;"
88- onclick ={() => window .location .reload ()}>Restart</button
89- >
90- <button style ="font-size: 1.5rem;" onclick ={() => goto (" /" )}
91- >Back to Stage Select</button
92- >
93- </div >
94- {/if }
9584</div >
9685
9786<style >
@@ -115,19 +104,4 @@ onDestroy(() => bindings.ondestroy());
115104 border-radius : 0.5rem ;
116105 border-color : oklch(87.9% 0.169 91.605 );
117106 }
118- .menu {
119- position : fixed ;
120- left : 0 ;
121- top : 0 ;
122- right : 0 ;
123- bottom : 0 ;
124- display : flex ;
125- flex-direction : column ;
126- margin : auto ;
127- align-items : center ;
128- width : max-content ;
129- height : max-content ;
130- gap : 0.5rem ;
131- border-radius : 1rem ;
132- }
133107 </style >
0 commit comments