This commit is contained in:
joylink_zhaoerwei 2024-01-12 13:14:08 +08:00
parent f45fba3005
commit ba1ba27719
5 changed files with 31 additions and 27 deletions

View File

@ -42,9 +42,9 @@ class THPlatform extends JlPlatform {
this.codeGraphic.draw();
this.lozengeGraphic.draw();
if (this.datas.direction == 'down') {
this.doorGraphic.changePosition(this.position);
this.codeGraphic.changePosition(this.position);
this.lozengeGraphic.changePosition(this.position);
this.doorGraphic.changePosition();
this.codeGraphic.changePosition();
this.lozengeGraphic.changePosition();
}
//门的状态
if (this.datas.hasdoor) {

View File

@ -16,7 +16,7 @@ export declare class DoorGraphic extends Container {
stateFillColor?: string;
constructor(platformConsts: PlatformConstsConfig);
draw(): void;
changePosition(platformPos: IPointData): void;
changePosition(): void;
clear(): void;
}
export declare class CodeGraphic extends Container {
@ -28,7 +28,7 @@ export declare class CodeGraphic extends Container {
circle: Graphics;
constructor(platformConsts: PlatformConstsConfig);
draw(): void;
changePosition(platformPos: IPointData): void;
changePosition(): void;
clear(): void;
}
export declare class LozengeGraphic extends Container {
@ -36,7 +36,7 @@ export declare class LozengeGraphic extends Container {
lozenge: Graphics;
constructor(platformConsts: PlatformConstsConfig);
draw(): void;
changePosition(platformPos: IPointData): void;
changePosition(): void;
clear(): void;
}
export declare class DoorCodeLozenge extends Container {

View File

@ -64,8 +64,8 @@ class DoorGraphic extends Container {
.lineTo(doorConsts.doorOpenSpacing, 0);
this.position.set(0, -platformConsts.height / 2 - doorConsts.doorPlatformSpacing);
}
changePosition(platformPos) {
this.position.copyFrom(calculateMirrorPoint(new Point(0, 0), platformPos));
changePosition() {
this.position.copyFrom(calculateMirrorPoint(new Point(0, 0), this.position));
}
clear() {
this.doorGraphic.clear();
@ -141,7 +141,7 @@ class CodeGraphic extends Container {
runTime.visible = false;
this.position.set(0, 0);
}
changePosition(platformPos) {
changePosition() {
const platformConsts = this.platformConsts;
const codeConsts = platformConsts.codeGraphic;
const psChange = [
@ -152,7 +152,7 @@ class CodeGraphic extends Container {
];
psChange.forEach((g) => {
if (g) {
g.position.copyFrom(calculateMirrorPoint(new Point(0, 0), platformPos));
g.position.copyFrom(calculateMirrorPoint(new Point(0, 0), g.position));
}
});
this.circle.position.set(platformConsts.width / 2 +
@ -191,8 +191,8 @@ class LozengeGraphic extends Container {
LozengeConsts.doorPlatformSpacing -
platformConsts.height / 3);
}
changePosition(platformPos) {
this.position.copyFrom(calculateMirrorPoint(new Point(0, 0), platformPos));
changePosition() {
this.position.copyFrom(calculateMirrorPoint(new Point(0, 0), this.position));
}
clear() {
this.lozenge.clear();
@ -221,9 +221,9 @@ class DoorCodeLozenge extends Container {
this.codeGraphic.draw();
this.lozengeGraphic.draw();
if (direction == 'down') {
this.doorGraphic.changePosition(platformPos);
this.codeGraphic.changePosition(platformPos);
this.lozengeGraphic.changePosition(platformPos);
this.doorGraphic.changePosition();
this.codeGraphic.changePosition();
this.lozengeGraphic.changePosition();
}
}
}

View File

@ -88,9 +88,9 @@ export class THPlatform extends JlPlatform {
this.codeGraphic.draw();
this.lozengeGraphic.draw();
if (this.datas.direction == 'down') {
this.doorGraphic.changePosition(this.position);
this.codeGraphic.changePosition(this.position);
this.lozengeGraphic.changePosition(this.position);
this.doorGraphic.changePosition();
this.codeGraphic.changePosition();
this.lozengeGraphic.changePosition();
}
//门的状态
if (this.datas.hasdoor) {

View File

@ -89,8 +89,10 @@ export class DoorGraphic extends Container {
-platformConsts.height / 2 - doorConsts.doorPlatformSpacing,
);
}
changePosition(platformPos: IPointData) {
this.position.copyFrom(calculateMirrorPoint(new Point(0, 0), platformPos));
changePosition() {
this.position.copyFrom(
calculateMirrorPoint(new Point(0, 0), this.position),
);
}
clear(): void {
this.doorGraphic.clear();
@ -181,7 +183,7 @@ export class CodeGraphic extends Container {
runTime.visible = false;
this.position.set(0, 0);
}
changePosition(platformPos: IPointData) {
changePosition() {
const platformConsts = this.platformConsts;
const codeConsts = platformConsts.codeGraphic as CodeConstsConfig;
const psChange = [
@ -192,7 +194,7 @@ export class CodeGraphic extends Container {
];
psChange.forEach((g) => {
if (g) {
g.position.copyFrom(calculateMirrorPoint(new Point(0, 0), platformPos));
g.position.copyFrom(calculateMirrorPoint(new Point(0, 0), g.position));
}
});
this.circle.position.set(
@ -242,8 +244,10 @@ export class LozengeGraphic extends Container {
platformConsts.height / 3,
);
}
changePosition(platformPos: IPointData) {
this.position.copyFrom(calculateMirrorPoint(new Point(0, 0), platformPos));
changePosition() {
this.position.copyFrom(
calculateMirrorPoint(new Point(0, 0), this.position),
);
}
clear(): void {
this.lozenge.clear();
@ -273,9 +277,9 @@ export class DoorCodeLozenge extends Container {
this.codeGraphic.draw();
this.lozengeGraphic.draw();
if (direction == 'down') {
this.doorGraphic.changePosition(platformPos);
this.codeGraphic.changePosition(platformPos);
this.lozengeGraphic.changePosition(platformPos);
this.doorGraphic.changePosition();
this.codeGraphic.changePosition();
this.lozengeGraphic.changePosition();
}
}
}