| | |
| | | import Device from "./Device"; |
| | | import Settings from "./settings"; |
| | | import * as Http from './http'; |
| | | import WebSocketClient from './websocket' |
| | | |
| | | let player; |
| | | let websocket; |
| | | |
| | | const Map = () => { |
| | | const notify = useNotification(); |
| | |
| | | Tool.setMapContainer(player.mapContainer); |
| | | Tool.setThemeMode(themeMode); |
| | | Http.setNotify(notify); |
| | | // websocket = new WebSocketClient('/ws/map/websocket'); |
| | | |
| | | await Http.fetchMapData(0); |
| | | // websocket.connect(); |
| | | // websocket.onMessage = (data) => { |
| | | // Tool.updateMapStatusInRealTime(data, () => curFloorRef.current, setCurSPrite); |
| | | // } |
| | | |
| | | } |
| | | initialize(); |
| | |
| | | handleResize(); |
| | | window.addEventListener('resize', handleResize); |
| | | |
| | | notify('Welcome to Rcs', 'info'); |
| | | notify.info('Welcome to Rcs'); |
| | | |
| | | return () => { |
| | | if (websocket) { |
| | | websocket.onMessage = () => { } |
| | | websocket.close(); |
| | | } |
| | | player.destroy(); |
| | | window.removeEventListener('resize', handleResize); |
| | | Tool.patchRaLayout(''); |
| | |
| | | switch (mode) { |
| | | case MapMode.OBSERVER_MODE: |
| | | player.hideGridLines(); |
| | | player.hideStarryBackground(); |
| | | |
| | | player.activateMapMultiSelect((selectedSprites, restartFn) => { |
| | | console.log(selectedSprites); |
| | |
| | | break |
| | | case MapMode.MOVABLE_MODE: |
| | | player.showGridLines(); |
| | | player.hideStarryBackground(); |
| | | |
| | | player.activateMapMultiSelect((selectedSprites, restartFn) => { |
| | | Tool.spriteListBeMovable(selectedSprites, () => { |
| | |
| | | break |
| | | case MapMode.SETTINGS_MODE: |
| | | player.hideGridLines(); |
| | | player.showStarryBackground(); // 0x2f68ac |
| | | |
| | | player.activateMapMultiSelect((selectedSprites, restartFn) => { |
| | | console.log(selectedSprites); |
| | |
| | | onCancel={() => { |
| | | setInsightVisible(false); |
| | | }} |
| | | width={378} |
| | | /> |
| | | |
| | | <Device |
| | |
| | | <Settings |
| | | open={settingsVisible} |
| | | onCancel={() => { |
| | | setSpriteSettings(null); |
| | | setSettingsVisible(false); |
| | | }} |
| | | sprite={spriteSettings} |
| | | setSpriteSettings={setSpriteSettings} |
| | | width={570} |
| | | /> |
| | | |
| | | </Box> |