| | |
| | | sprite.destroy({ children: true, texture: false, baseTexture: false }); |
| | | }; |
| | | |
| | | export const loadAreas = (curZone, setCurSprite) => { |
| | | export const loadAreas = (curZone, setCurSprite, callback) => { |
| | | if (!mapContainer) return; |
| | | clearAreas(); |
| | | fetchAreaList(curZone).then((areas) => { |
| | |
| | | mapContainer.addChild(graphics); |
| | | } |
| | | }); |
| | | if (callback) { |
| | | callback(areas); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | |
| | | areaDrawingCleanup(); |
| | | } |
| | | }; |
| | | |
| | | export const showAreas = (curZone, setShowAreas, setLoading) => { |
| | | setLoading(true); |
| | | loadAreas(curZone, null, (areas) => { |
| | | setLoading(false); |
| | | setShowAreas(true); |
| | | }) |
| | | }; |
| | | |
| | | export const hideAreas = (curZone, setShowAreas) => { |
| | | clearAreas(); |
| | | if (setShowAreas) { |
| | | setShowAreas(false); |
| | | } |
| | | }; |