| | |
| | | let pixiShuttleMoveAdvancePathMap = new Map(); |
| | | let pixiShuttleMoveAdvancePathList = []; |
| | | let pixiStaMap = new Map(); |
| | | let pixiCrnMap = new Map(); |
| | | let objectsContainer; |
| | | let objectsContainer2; |
| | | let graphicsShelf; |
| | |
| | | // 从Graphics对象创建一个纹理 |
| | | graphicsShelf = pixiApp.renderer.generateTexture(getContainer('shelf')); |
| | | graphicsDevp = pixiApp.renderer.generateTexture(getContainer('devp')); |
| | | graphicsCrn = pixiApp.renderer.generateTexture(getContainer('crn')); |
| | | graphicsCrn = createCrnTexture(); |
| | | graphicsCrnTrack = createTrackTexture(); |
| | | |
| | | // 创建一个容器来管理大批量的显示对象 |
| | |
| | | return rt; |
| | | } |
| | | |
| | | function createCrnTexture() { |
| | | const g = new PIXI.Graphics(); |
| | | const yTop = Math.round(height * 0.1); |
| | | g.beginFill(0x999999); |
| | | g.drawRect(2, yTop, 3, height - yTop - 2); |
| | | g.drawRect(width - 5, yTop, 3, height - yTop - 2); |
| | | g.endFill(); |
| | | g.beginFill(0x999999); |
| | | g.drawRect(0, yTop, width, 3); |
| | | g.endFill(); |
| | | const cabW = Math.round(width * 0.42); |
| | | const cabH = Math.round(height * 0.38); |
| | | const cabX = Math.round((width - cabW) / 2); |
| | | const cabY = Math.round(height * 0.52 - cabH / 2); |
| | | g.beginFill(0x3a78c2); |
| | | g.drawRect(cabX, cabY, cabW, cabH); |
| | | g.endFill(); |
| | | const winW = Math.round(cabW * 0.6); |
| | | const winH = Math.round(cabH * 0.45); |
| | | const winX = cabX + Math.round((cabW - winW) / 2); |
| | | const winY = cabY + Math.round((cabH - winH) / 2); |
| | | g.beginFill(0xd0e8ff); |
| | | g.drawRect(winX, winY, winW, winH); |
| | | g.endFill(); |
| | | const forkW = Math.round(width * 0.5); |
| | | const forkH = Math.max(2, Math.round(height * 0.08)); |
| | | const forkX = Math.round((width - forkW) / 2); |
| | | const forkY = cabY + cabH; |
| | | g.beginFill(0x666666); |
| | | g.drawRect(forkX, forkY, forkW, forkH); |
| | | g.endFill(); |
| | | const rt = PIXI.RenderTexture.create({ width: width, height: height }); |
| | | pixiApp.renderer.render(g, rt); |
| | | return rt; |
| | | } |
| | | |
| | | function getContainerWithSize(value, w, h) { |
| | | let graphics = new PIXI.Graphics(); |
| | | if (value === 0) { |
| | |
| | | sprite = new PIXI.Sprite(graphicsCrnTrack); |
| | | } else { |
| | | sprite = new PIXI.Sprite(graphicsCrn); |
| | | const deviceNo = getDeviceNo(value); |
| | | const taskNo = getTaskNo(value); |
| | | const style = new PIXI.TextStyle({ fontFamily: 'Arial', fontSize: 10, fill: '#000000' }); |
| | | const txt = taskNo > 0 ? (deviceNo + "(" + taskNo + ")") : String(deviceNo); |
| | | const text = new PIXI.Text(txt, style); |
| | | text.anchor.set(0.5); |
| | | text.position.set(sprite.width / 2, sprite.height / 2); |
| | | sprite.addChild(text); |
| | | sprite.textObj = text; |
| | | pixiCrnMap.set(parseInt(deviceNo), sprite); |
| | | } |
| | | } else if (item.type == 'crnTrack') { |
| | | sprite = new PIXI.Sprite(graphicsCrnTrack); |
| | | } else { |
| | | return null; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | function getTaskNo(obj) { |
| | | if (this.isJson(obj)) { |
| | | let data = JSON.parse(obj) |
| | | if (data.taskNo == null || data.taskNo == undefined) { |
| | | return -1; |
| | | } |
| | | return data.taskNo; |
| | | } else { |
| | | return -1; |
| | | } |
| | | } |
| | | |
| | | function getStationId(obj) { |
| | | if (this.isJson(obj)) { |
| | | let data = JSON.parse(obj) |