| | |
| | | import ConfirmButton from "../page/components/ConfirmButton"; |
| | | import { FitScreen } from '@mui/icons-material'; |
| | | import MapSearch from "./header/MapSearch"; |
| | | import { startupOrShutdown } from "./http"; |
| | | |
| | | let player; |
| | | let websocket; |
| | |
| | | const prevCurSpriteRef = useRef(); |
| | | const [batchSprites, setBatchSprites] = useState([]); |
| | | |
| | | const [rcsStatus, setRcsStatus] = useState(null); |
| | | const [curZone, setCurZone] = useState(() => { |
| | | const storedValue = localStorage.getItem('curZone'); |
| | | return storedValue !== null ? JSON.parse(storedValue) : null; |
| | |
| | | Http.setMapContainer(player.mapContainer); |
| | | websocket = new WebSocketClient('/ws/map/websocket'); |
| | | |
| | | await Http.fetchMapData(); |
| | | await Http.fetchMapData(curZone, setRcsStatus); |
| | | websocket.connect(); |
| | | websocket.onMessage = (wsMsg) => { |
| | | Tool.generateDynamicGraphic(curZone, JSON.parse(wsMsg), setCurSprite); |
| | |
| | | <> |
| | | <Button |
| | | variant="contained" |
| | | color="primary" |
| | | color={rcsStatus ? 'inherit' : 'primary'} |
| | | sx={{ mr: 2 }} |
| | | onClick={() => { |
| | | startupOrShutdown(() => { |
| | | setRcsStatus(!rcsStatus); |
| | | }); |
| | | }} |
| | | > |
| | | {translate('page.map.action.startup')} |
| | | {rcsStatus ? translate('page.map.action.shutdown') : translate('page.map.action.startup')} |
| | | </Button> |
| | | <Button variant="contained" color="primary"> |
| | | {translate('page.map.action.monitor')} |