refactoring
This commit is contained in:
parent
b445a1e2cd
commit
e6118b4df0
|
|
@ -8,12 +8,11 @@ import Help from "../../components/game/Help.jsx";
|
||||||
import SoundControl from "../../components/game/SoundControl.jsx";
|
import SoundControl from "../../components/game/SoundControl.jsx";
|
||||||
import ExtraControls from "../../components/game/ExtraControls.jsx";
|
import ExtraControls from "../../components/game/ExtraControls.jsx";
|
||||||
import { useUser } from "../../hooks/useUser.jsx";
|
import { useUser } from "../../hooks/useUser.jsx";
|
||||||
|
import Loading from "../../components/animations/Loading.jsx";
|
||||||
|
|
||||||
export default function GameContainer({ gameId }) {
|
export default function GameContainer({ gameId }) {
|
||||||
const gameDatas = useWordpressCustomData(`/screen/play/${gameId}`);
|
const gameDatas = useWordpressCustomData(`/screen/play/${gameId}`);
|
||||||
console.log(gameDatas);
|
|
||||||
|
|
||||||
const [currentTime, setCurrentTime] = useState(0);
|
|
||||||
const [isDragging, setIsDragging] = useState(false);
|
const [isDragging, setIsDragging] = useState(false);
|
||||||
const [startX, setStartX] = useState(0);
|
const [startX, setStartX] = useState(0);
|
||||||
|
|
||||||
|
|
@ -27,18 +26,6 @@ export default function GameContainer({ gameId }) {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isGameComplete) return;
|
if (!isGameComplete) return;
|
||||||
// console.log(contextGameDatas);
|
|
||||||
// const datas = {
|
|
||||||
// user_locale: language,
|
|
||||||
// user_country: country,
|
|
||||||
// level_post_id: contextGameDatas.gameId,
|
|
||||||
// level_score: score,
|
|
||||||
// level_completion_time: currentTime,
|
|
||||||
// };
|
|
||||||
// postWordpressStatisticsData(datas);
|
|
||||||
console.log("##############");
|
|
||||||
// console.log(datas);
|
|
||||||
console.log("##############");
|
|
||||||
}, [isGameComplete]);
|
}, [isGameComplete]);
|
||||||
|
|
||||||
// HANDLE CANVAS DRAGGING INTERACTIONS
|
// HANDLE CANVAS DRAGGING INTERACTIONS
|
||||||
|
|
@ -59,7 +46,7 @@ export default function GameContainer({ gameId }) {
|
||||||
setIsDragging(false);
|
setIsDragging(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!contextGameDatas) return;
|
if (!contextGameDatas) return <Loading />;
|
||||||
|
|
||||||
const gameBackgroundUrl = contextGameDatas.gameBlockDatas.attrs.coverUrl;
|
const gameBackgroundUrl = contextGameDatas.gameBlockDatas.attrs.coverUrl;
|
||||||
const blocks = contextGameDatas.gameBlockDatas.innerBlocks;
|
const blocks = contextGameDatas.gameBlockDatas.innerBlocks;
|
||||||
|
|
@ -69,7 +56,7 @@ export default function GameContainer({ gameId }) {
|
||||||
<ExtraControls />
|
<ExtraControls />
|
||||||
<SoundControl />
|
<SoundControl />
|
||||||
<Score />
|
<Score />
|
||||||
<Timer currentTime={currentTime} setCurrentTime={setCurrentTime} />
|
<Timer />
|
||||||
<Help />
|
<Help />
|
||||||
<div onMouseDown={handleMouseDown} onMouseMove={handleMouseMove} onMouseUp={handleMouseUp}>
|
<div onMouseDown={handleMouseDown} onMouseMove={handleMouseMove} onMouseUp={handleMouseUp}>
|
||||||
<section className='wp-block-lhoist-blocks-search-and-find lhoist-blocks-search-and-find'>
|
<section className='wp-block-lhoist-blocks-search-and-find lhoist-blocks-search-and-find'>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user