| | |
| | | // shuttleVo |
| | | for (const shuttleVo of mapVo.shuttleVos) { |
| | | // path |
| | | drawTravelPath(shuttleVo.travelPath, shuttleVo.shuttleNo, curFloor); |
| | | drawTravelPath(shuttleVo, curFloor); |
| | | // shuttle |
| | | showShuttle(shuttleVo.shuttleNo, shuttleVo.curLocNo, curFloor, setCurSPrite); |
| | | showShuttle(shuttleVo, curFloor, setCurSPrite); |
| | | } |
| | | } |
| | | |
| | | export const drawTravelPath = (path, shuttleNo, curFloor) => { |
| | | export const drawTravelPath = (shuttleVo, curFloor) => { |
| | | const { shuttleNo, curLocNo, travelPath: path } = shuttleVo; |
| | | if (!mapContainer) { |
| | | return; |
| | | } |
| | | const pathLineName = 'preTravelPath-' + shuttleNo; |
| | | let pathLine = mapContainer.getChildByName(pathLineName); |
| | | if (pathLine) mapContainer.removeChild(pathLine); |
| | | if (pathLine) { |
| | | mapContainer.removeChild(pathLine); |
| | | } |
| | | |
| | | pathLine = new PIXI.Graphics(); |
| | | pathLine.name = pathLineName; |
| | | pathLine.lineStyle(3 * (1 / mapContainer.scale.x), 0x3498db, 1); |
| | | pathLine.zIndex = SENSOR_ZINDEX.TRAVEL_PATH; |
| | | let firstNode = true; |
| | | for (let i = 0; i < path.length; i++) { |
| | | for (let i = path.indexOf(curLocNo) - 1; i < path.length; i++) { |
| | | const { row, bay, lev } = parseLocNo(path[i]); |
| | | if (Number(lev) !== curFloor) { continue } |
| | | const shelf = querySprite(SENSOR_TYPE.SHELF, row + '-' + bay); |
| | |
| | | mapContainer.addChild(pathLine); |
| | | } |
| | | |
| | | export const showShuttle = (shuttleNo, curLocNo, curFloor, setCurSPrite) => { |
| | | export const showShuttle = (shuttleVo, curFloor, setCurSPrite) => { |
| | | const { shuttleNo, curLocNo } = shuttleVo; |
| | | if (!curLocNo) { return } |
| | | const { row, bay, lev } = parseLocNo(curLocNo); |
| | | if (Number(lev) !== curFloor) { return } |
| | | |
| | | const shelf = querySprite(SENSOR_TYPE.SHELF, row + '-' + bay); |
| | | if (!shelf) { return } |
| | | |
| | | let shuttle = querySprite(SENSOR_TYPE.SHUTTLE, shuttleNo); |
| | | if (!shuttle) { |
| | | shuttle = generateSprite(SENSOR_TYPE.SHUTTLE); |
| | | initSprite(shuttle, SENSOR_TYPE.SHUTTLE); |
| | | shuttle.data.no = shuttleNo; |
| | | shuttle.position.set(shelf.position.x, shelf.position.y); |
| | | mapContainer.addChild(shuttle); |
| | | viewFeature(shuttle, setCurSPrite); |
| | | } |
| | | |
| | | const shelf = querySprite(SENSOR_TYPE.SHELF, row + '-' + bay); |
| | | if (!shelf) { return } |
| | | |
| | | new TWEEDLE.Tween(shuttle?.position).easing(TWEEDLE.Easing.Linear.None).to({ |
| | | x: shelf.position.x, |