blob: ce5a59c1fdec36b762e20909300f96e815efedd0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
import { useAtom } from "jotai";
import { AudioController } from "../.client/audio/AudioController";
import { audioControllerAtom } from "../states/watch";
import GolfWatchApp, { type Props } from "./GolfWatchApp.client";
import SubmitButton from "./SubmitButton";
export default function GolfWatchAppWithAudioPlayRequest({
game,
sockToken,
}: Omit<Props, "audioController">) {
const [audioController, setAudioController] = useAtom(audioControllerAtom);
const audioPlayPermitted = audioController !== null;
if (audioPlayPermitted) {
return <GolfWatchApp game={game} sockToken={sockToken} />;
} else {
return (
<div className="min-h-screen bg-gray-100 flex items-center justify-center">
<div className="text-center">
<SubmitButton
onClick={async () => {
const audioController = new AudioController();
await audioController.loadAll();
await audioController.playDummySoundEffect();
setAudioController(audioController);
}}
>
開始
</SubmitButton>
</div>
</div>
);
}
}
|