import { motion, AnimatePresence } from "framer-motion"; import { useRef, useEffect, useMemo, useState } from "react"; import cls from "../index.module.css"; // import SocketContext from '../../../../../store/socket-data-provider'; import { useContext } from "react"; function FloorOneToTwo(props) { // const ctx = useContext(SocketContext); const ctx = null; const fireDir = ctx?.runState?.fireDirection || null; const [fireCanPlay, setFireCanPlay] = useState(false); const vd = useRef(null); const show = props.opacity || 0; useEffect(() => { if (show) { vd.current.play(); setTimeout(() => { console.log("开启1-2的火播放"); setFireCanPlay(true); }, 3000); } if (!show) setFireCanPlay(false); return () => { console.log("关闭1-2的火播放"); setFireCanPlay(false); }; }, [show]); return ( {show && ( {fireCanPlay && fireDir == "东火" && ( )} {fireCanPlay && fireDir == "西火" && ( // {fireCanPlay && ( )} )} ); } export default FloorOneToTwo;