| | |
| | | import Settings from "./settings"; |
| | | import * as Http from './http'; |
| | | import WebSocketClient from './websocket' |
| | | import ConfirmButton from "../page/components/ConfirmButton"; |
| | | |
| | | let player; |
| | | let websocket; |
| | |
| | | const [settingsVisible, setSettingsVisible] = useState(false); |
| | | |
| | | const [spriteSettings, setSpriteSettings] = useState(null); |
| | | const prevSpriteSettingsRef = React.useRef(); |
| | | const prevSpriteSettingsRef = useRef(); |
| | | |
| | | const [curZone, setCurZone] = useState(() => { |
| | | const storedValue = localStorage.getItem('curZone'); |
| | | return storedValue !== null ? JSON.parse(storedValue) : null; |
| | | }); |
| | | |
| | | useEffect(() => { |
| | | Tool.patchRaLayout('0px'); |
| | |
| | | Tool.setMapContainer(player.mapContainer); |
| | | Tool.setThemeMode(themeMode); |
| | | Http.setNotify(notify); |
| | | Http.setMapContainer(player.mapContainer); |
| | | // websocket = new WebSocketClient('/ws/map/websocket'); |
| | | |
| | | await Http.fetchMapData(0); |
| | | await Http.fetchMapData(); |
| | | // websocket.connect(); |
| | | // websocket.onMessage = (data) => { |
| | | // Tool.updateMapStatusInRealTime(data, () => curFloorRef.current, setCurSPrite); |
| | |
| | | {mode === MapMode.MOVABLE_MODE && ( |
| | | <> |
| | | <Button |
| | | variant="outlined" |
| | | sx={{ mr: 2 }} |
| | | onClick={() => { |
| | | Tool.clearMapData(); |
| | | }} |
| | | > |
| | | {translate('page.map.action.clear')} |
| | | </Button> |
| | | <ConfirmButton |
| | | label="page.map.action.save" |
| | | variant="contained" |
| | | sx={{ mr: 2 }} |
| | | onConfirm={() => { |
| | | Http.saveMapData(curZone); |
| | | }} |
| | | /> |
| | | <Button |
| | | variant="contained" |
| | | color="primary" |
| | | sx={{ mr: 1 }} |
| | |
| | | |
| | | {mode === MapMode.SETTINGS_MODE && ( |
| | | <> |
| | | <Button |
| | | variant="outlined" |
| | | sx={{ mr: 2 }} |
| | | onClick={() => { |
| | | Tool.clearMapData(); |
| | | }} |
| | | > |
| | | {translate('page.map.action.clear')} |
| | | </Button> |
| | | <ConfirmButton |
| | | label="page.map.action.save" |
| | | variant="contained" |
| | | onConfirm={() => { |
| | | Http.saveMapData(curZone); |
| | | }} |
| | | /> |
| | | </> |
| | | )} |
| | | |