From 17fabb401a57d5f528c05c05c26361c9b27f630d Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Fri, 20 Oct 2023 13:17:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B1=8F=E8=94=BD=E9=97=A8=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/graphics/platform/Platform.ts | 70 --------------------------- src/graphics/relay/Relay.ts | 9 ++-- src/graphics/screenDoor/ScreenDoor.ts | 9 +--- 3 files changed, 5 insertions(+), 83 deletions(-) diff --git a/src/graphics/platform/Platform.ts b/src/graphics/platform/Platform.ts index e5f8edc..42fc0b1 100644 --- a/src/graphics/platform/Platform.ts +++ b/src/graphics/platform/Platform.ts @@ -59,76 +59,6 @@ export class rectGraphic extends Container { this.rectGraphic.clear(); } } -//子元素--站台旁菱形图标 -/* class emergClose extends JlGraphic { - static Type = 'emergClose'; - lozenge: Graphics; - deltaTime = 0; - fillColor = PlatformColorEnum.lozengeRed; - constructor() { - super(emergClose.Type); - this.lozenge = new Graphics(); - this.addChild(this.lozenge); - } - draw(): void { - const lozenge = this.lozenge; - lozenge.clear(); - lozenge.lineStyle(1, new Color(this.fillColor)); - lozenge.beginFill(PlatformColorEnum.lozengeRed, 1); - lozenge.drawRect( - 0, - 0, - platformConsts.height / 4, - platformConsts.height / 4 - ); - lozenge.endFill(); - const rect = new Rectangle( - 0, - 0, - platformConsts.height / 4, - platformConsts.height / 4 - ); - lozenge.pivot = getRectangleCenter(rect); - lozenge.rotation = Math.PI / 4; - lozenge.visible = false; - } - doRepaint() { - // this.draw() - } - clear(): void { - this.lozenge.clear(); - } - createFlashAnmiation(name: string): GraphicAnimation { - const flashAnmiation = GraphicAnimation.init({ - name: name, - run: (dt: number) => { - this.deltaTime += dt; - if (this.deltaTime > 60) { - this.deltaTime = 0; - this.lozenge.visible = false; - } else if (this.deltaTime > 30) { - this.lozenge.visible = true; - } - }, - }); - return flashAnmiation; - } - changeState(id: string, stateData: IPlatformState): void { - let redFlash = this.animation(`${id}emergClose_red_flash`); - if (stateData.emergstop) { - if (!redFlash) { - redFlash = this.createFlashAnmiation(`${id}emergClose_red_flash`); - this.addAnimation(redFlash); - } - redFlash.resume(); - } else { - if (redFlash) { - redFlash.pause(); - } - } - } -} */ - export class Platform extends JlGraphic { static Type = 'Platform'; rectGraphic: rectGraphic = new rectGraphic(); diff --git a/src/graphics/relay/Relay.ts b/src/graphics/relay/Relay.ts index 1cd2ad6..e594416 100644 --- a/src/graphics/relay/Relay.ts +++ b/src/graphics/relay/Relay.ts @@ -56,12 +56,9 @@ export class Relay extends JlGraphic { this.labelGraphic.position.set(0, 20); this.refDevice.position.set(0, -20); const relayGraphic = this.relayGraphic; - let relayColor; - if (this.states?.xh) { - relayColor = relayConsts.closeColor; - } else { - relayColor = relayConsts.openColor; - } + const relayColor = this.states.xh + ? relayConsts.closeColor + : relayConsts.openColor; relayGraphic .clear() .lineStyle(relayConsts.lineWidth, new Color(relayColor)) diff --git a/src/graphics/screenDoor/ScreenDoor.ts b/src/graphics/screenDoor/ScreenDoor.ts index a5d3a99..14bc0c9 100644 --- a/src/graphics/screenDoor/ScreenDoor.ts +++ b/src/graphics/screenDoor/ScreenDoor.ts @@ -55,16 +55,11 @@ class smallDoorGraphic extends Container { const lineColor = open ? screenDoorConsts.doorOpen : screenDoorConsts.doorClose; - const direction = 'up'; smallDoorGraphic .lineStyle(screenDoorConsts.lineWidth, new Color(lineColor)) .moveTo(start, 0) .lineTo(start + screenDoorConsts.smallDoorWidth - 3, 0); - if (direction == 'up') { - this.labelGraphic.text = i + 1; - } else { - this.labelGraphic.text = data.sonDoorAmount - i; - } + this.labelGraphic.text = i + 1; this.labelGraphic.style.fill = 'red'; if (i % 2 == 0) { this.labelGraphic.position.set(start + 4, 7); @@ -99,7 +94,7 @@ export class ScreenDoor extends JlGraphic { this.datas.sonDoorAmount = this.datas?.sonDoorAmount || 30; for (let i = 0; i < this.datas.sonDoorAmount; i++) { const smallDoor = new smallDoorGraphic(); - smallDoor.draw(this.datas, i, this.states.openDoorCodes.includes(i)); + smallDoor.draw(this.datas, i, this.states.openDoorCodes.includes(i + 1)); doorGraphic.addChild(smallDoor); } }