Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
claustra01 committed Aug 11, 2024
1 parent b22e2ae commit f3e50e7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 22 deletions.
10 changes: 4 additions & 6 deletions src/pages/shooter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,16 @@ const Shooter = () => {
useEffect(() => {
let intervalId: number | null = null;

if (!isOpen) {
intervalId = window.setInterval(() => {
sendData(message_type.status);
}, 100);
}
intervalId = window.setInterval(() => {
sendData(message_type.status);
}, 100);

return () => {
if (intervalId !== null) {
clearInterval(intervalId);
}
};
}, [isOpen, sendData]);
}, [sendData]);

const handleClick = () => {
const audio = new Audio("/sound/cork_sound.mp3");
Expand Down
38 changes: 22 additions & 16 deletions src/pages/yatai/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ const YataiStage = React.memo(() => {
);
});

function Yatai() {
const TargetOverlay = () => {
const socketRef = useSocketRefStore((state) => state.socketRef);

useEffect(() => {
Expand Down Expand Up @@ -158,24 +158,30 @@ function Yatai() {
// setTarget(data.target);
// };

return (
<div
className={styles.target}
style={{
left: `${aim?.x}px`,
top: `${aim?.y}px`,
transform: "translate(-50%, -50%)",
}}
>
<img
src="/2D_material/target.webp"
alt="照準の表示"
width="100%"
height="100%"
/>
</div>
);
};

function Yatai() {
return (
<div className={styles.container}>
<YataiStage />
<div
className={styles.target}
style={{
left: `${aim?.x}px`,
top: `${aim?.y}px`,
transform: "translate(-50%, -50%)",
}}
>
<img
src="/2D_material/target.webp"
alt="照準の表示"
width="100%"
height="100%"
/>
</div>
<TargetOverlay />
</div>
);
}
Expand Down

0 comments on commit f3e50e7

Please sign in to comment.