子屏蔽门数量调整

This commit is contained in:
joylink_zhaoerwei 2023-10-11 10:29:38 +08:00
parent 1ab6b07f5d
commit 83bfbf1c19

View File

@ -143,9 +143,8 @@ class smallDoorGraphic extends Container {
this.addChild(this.labelGraphic);
}
draw(data: IPlatformData, stateData: IPlatformState, i: number): void {
const sonDoorAmount = data?.sonDoorAmount || 30;
const start =
(-platformConsts.smallDoorWidth * sonDoorAmount) / 2 +
(-platformConsts.smallDoorWidth * data.sonDoorAmount) / 2 +
platformConsts.smallDoorWidth * i;
const smallDoorGraphic = this.smallDoorGraphic;
const lineColor = PlatformColorEnum.doorGreen;
@ -158,7 +157,7 @@ class smallDoorGraphic extends Container {
.moveTo(start, 0)
.lineTo(start + platformConsts.smallDoorWidth - 3, 0);
if (direction == 'down') {
this.labelGraphic.text = sonDoorAmount - i;
this.labelGraphic.text = data.sonDoorAmount - i;
} else {
this.labelGraphic.text = i + 1;
}
@ -175,8 +174,7 @@ export class doorGraphic extends Container {
super();
}
draw(data: IPlatformData, stateData: IPlatformState): void {
const sonDoorAmount = data?.sonDoorAmount || 30;
for (let i = 0; i < sonDoorAmount; i++) {
for (let i = 0; i < data.sonDoorAmount; i++) {
const smallDoor = new smallDoorGraphic();
smallDoor.draw(data, stateData, i);
this.addChild(smallDoor);
@ -429,6 +427,7 @@ export class Platform extends JlGraphic {
return this.datas.index + '';
}
doRepaint(): void {
this.datas.sonDoorAmount = this.datas?.sonDoorAmount || 30;
this.doorGraphic.clear();
if (this.datas.hasdoor) {
this.doorGraphic.draw(this.datas, this.states);