| | |
| | | } |
| | | |
| | | const status = crns[i].crnStatus; |
| | | if (status === "machine-auto") { |
| | | sprite.tint = 0x21BA45; |
| | | } else if (status === "machine-un-auto") { |
| | | sprite.tint = 0xBBBBBB; |
| | | } else if (status === "machine-error") { |
| | | sprite.tint = 0xDB2828; |
| | | } else if (status === "machine-p-move") { |
| | | sprite.tint = 0xF2C037; |
| | | } else { |
| | | sprite.tint = 0xFFFFFF; |
| | | } |
| | | const statusColor = getCrnStatusColor(status); |
| | | updateCrnTextureColor(sprite, statusColor); |
| | | |
| | | let bay = parseInt(crns[i].bay, 10); |
| | | if (isNaN(bay) || bay < 1 || bay === -2) { |
| | |
| | | let graphics = new PIXI.Graphics(); |
| | | let drawBorder = true; |
| | | if (type == 'shelf') { |
| | | graphics.beginFill(0x55aaff); |
| | | graphics.beginFill(0xb6e2e2); |
| | | } else if (type == 'devp') { |
| | | graphics.beginFill(0x00ff7f); |
| | | graphics.visible = true; |
| | |
| | | return rt; |
| | | } |
| | | |
| | | function createCrnTextureColoredDevice(deviceWidth, height, color) { |
| | | 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(deviceWidth - 5, yTop, 3, height - yTop - 2); |
| | | g.endFill(); |
| | | g.beginFill(0x999999); |
| | | g.drawRect(0, yTop, deviceWidth, 3); |
| | | g.endFill(); |
| | | const cabW = Math.round(deviceWidth * 0.68); |
| | | const cabH = Math.round(height * 0.38); |
| | | const cabX = Math.round((deviceWidth - cabW) / 2); |
| | | const cabY = Math.round(height * 0.52 - cabH / 2); |
| | | g.beginFill(color); |
| | | 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(deviceWidth * 0.8); |
| | | const forkH = Math.max(2, Math.round(height * 0.08)); |
| | | const forkX = Math.round((deviceWidth - forkW) / 2); |
| | | const forkY = cabY + cabH; |
| | | g.beginFill(0x666666); |
| | | g.drawRect(forkX, forkY, forkW, forkH); |
| | | g.endFill(); |
| | | const rt = PIXI.RenderTexture.create({ width: deviceWidth, height: height }); |
| | | pixiApp.renderer.render(g, rt); |
| | | return rt; |
| | | } |
| | | |
| | | function updateCrnTextureColor(sprite, color) { |
| | | const tex = createCrnTextureColoredDevice(sprite.width, sprite.height, color); |
| | | sprite.texture = tex; |
| | | } |
| | | |
| | | function getCrnStatusColor(status) { |
| | | if (status === "machine-auto") { return 0x21BA45; } |
| | | if (status === "machine-un-auto") { return 0xBBBBBB; } |
| | | if (status === "machine-error") { return 0xDB2828; } |
| | | if (status === "machine-pakin") { return 0x30bffc; } |
| | | if (status === "machine-pakout") { return 0x97b400; } |
| | | return 0xBBBBBB; |
| | | } |
| | | |
| | | function getGraphics(color, width, height, x, y) { |
| | | let graphics = new PIXI.Graphics(); |
| | | graphics.beginFill(color); |