import { observer } from "mobx-react-lite"; import { ChangeEvent, useState } from "react"; import { GameClock } from "../utils/gameClock"; import { game } from "../model/game"; export const DebugView = observer(function () { const [skipTime, setSkipTime] = useState(5); const isDebugMode = location.hostname === "localhost" || location.hostname === "127.0.0.1" || location.hostname === "[::1]"; function handleTimeScaleChange(event: ChangeEvent): void { game.school.time.setTimeScale(Number(event.target.value)); } function handleSkipTime(): void { GameClock.skipTime(skipTime); } function handleRestartClick(): void { game.restart(); } function handleSaveClick(): void { game.save(); } function handleLoadClick(): void { game.school.time.pause(); game.load(); game.school.time.resume(); } function handleTickClick(): void { GameClock.pause(); GameClock.tick(0.1); } return
Время { isDebugMode ?
Масштаб x{game.school.time.timeScale}
: <> } { game.school.time.paused ? : } { isDebugMode ? : <> }
TPS: {game.school.tps}
});