This commit is contained in:
parent
2ca2c58435
commit
910306d3bf
|
@ -42,9 +42,9 @@ class THPlatform extends JlPlatform {
|
|||
this.codeGraphic.draw();
|
||||
this.lozengeGraphic.draw();
|
||||
if (this.datas.direction == 'down') {
|
||||
this.doorGraphic.changePosition();
|
||||
this.codeGraphic.changePosition();
|
||||
this.lozengeGraphic.changePosition();
|
||||
this.doorGraphic.changePosition(this.position);
|
||||
this.codeGraphic.changePosition(this.position);
|
||||
this.lozengeGraphic.changePosition(this.position);
|
||||
}
|
||||
//门的状态
|
||||
if (this.datas.hasdoor) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { JlGraphic, VectorText } from 'jl-graphic';
|
||||
import { Container, Graphics } from 'pixi.js';
|
||||
import { Container, Graphics, IPointData } from 'pixi.js';
|
||||
import { IPlatformData, PlatformConstsConfig } from './PlatformConfig';
|
||||
declare class RectGraphic extends Container {
|
||||
platformConsts: PlatformConstsConfig;
|
||||
|
@ -16,7 +16,7 @@ export declare class DoorGraphic extends Container {
|
|||
stateFillColor?: string;
|
||||
constructor(platformConsts: PlatformConstsConfig);
|
||||
draw(): void;
|
||||
changePosition(): void;
|
||||
changePosition(platformPos: IPointData): 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(): void;
|
||||
changePosition(platformPos: IPointData): 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(): void;
|
||||
changePosition(platformPos: IPointData): void;
|
||||
clear(): void;
|
||||
}
|
||||
export declare class DoorCodeLozenge extends Container {
|
||||
|
@ -45,7 +45,7 @@ export declare class DoorCodeLozenge extends Container {
|
|||
lozengeGraphic: LozengeGraphic;
|
||||
codeGraphic: CodeGraphic;
|
||||
constructor(platformConsts: PlatformConstsConfig);
|
||||
draw(hasDoor: boolean, direction: string): void;
|
||||
draw(hasDoor: boolean, direction: string, platformPos: IPointData): void;
|
||||
}
|
||||
export declare abstract class JlPlatform extends JlGraphic {
|
||||
static Type: string;
|
||||
|
|
|
@ -64,8 +64,8 @@ class DoorGraphic extends Container {
|
|||
.lineTo(doorConsts.doorOpenSpacing, 0);
|
||||
this.position.set(0, -platformConsts.height / 2 - doorConsts.doorPlatformSpacing);
|
||||
}
|
||||
changePosition() {
|
||||
this.doorGraphic.position.copyFrom(calculateMirrorPoint(new Point(0, 0), this.position));
|
||||
changePosition(platformPos) {
|
||||
this.position.copyFrom(calculateMirrorPoint(new Point(0, 0), platformPos));
|
||||
}
|
||||
clear() {
|
||||
this.doorGraphic.clear();
|
||||
|
@ -141,7 +141,7 @@ class CodeGraphic extends Container {
|
|||
runTime.visible = false;
|
||||
this.position.set(0, 0);
|
||||
}
|
||||
changePosition() {
|
||||
changePosition(platformPos) {
|
||||
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), g.position));
|
||||
g.position.copyFrom(calculateMirrorPoint(new Point(0, 0), platformPos));
|
||||
}
|
||||
});
|
||||
this.circle.position.set(platformConsts.width / 2 +
|
||||
|
@ -191,8 +191,8 @@ class LozengeGraphic extends Container {
|
|||
LozengeConsts.doorPlatformSpacing -
|
||||
platformConsts.height / 3);
|
||||
}
|
||||
changePosition() {
|
||||
this.position.copyFrom(calculateMirrorPoint(new Point(0, 0), this.position));
|
||||
changePosition(platformPos) {
|
||||
this.position.copyFrom(calculateMirrorPoint(new Point(0, 0), platformPos));
|
||||
}
|
||||
clear() {
|
||||
this.lozenge.clear();
|
||||
|
@ -213,7 +213,7 @@ class DoorCodeLozenge extends Container {
|
|||
this.codeGraphic = new CodeGraphic(this.platformConsts);
|
||||
this.addChild(this.codeGraphic);
|
||||
}
|
||||
draw(hasDoor, direction) {
|
||||
draw(hasDoor, direction, platformPos) {
|
||||
this.doorGraphic.clear();
|
||||
if (hasDoor) {
|
||||
this.doorGraphic.draw();
|
||||
|
@ -221,9 +221,9 @@ class DoorCodeLozenge extends Container {
|
|||
this.codeGraphic.draw();
|
||||
this.lozengeGraphic.draw();
|
||||
if (direction == 'down') {
|
||||
this.doorGraphic.changePosition();
|
||||
this.codeGraphic.changePosition();
|
||||
this.lozengeGraphic.changePosition();
|
||||
this.doorGraphic.changePosition(platformPos);
|
||||
this.codeGraphic.changePosition(platformPos);
|
||||
this.lozengeGraphic.changePosition(platformPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,9 +88,9 @@ export class THPlatform extends JlPlatform {
|
|||
this.codeGraphic.draw();
|
||||
this.lozengeGraphic.draw();
|
||||
if (this.datas.direction == 'down') {
|
||||
this.doorGraphic.changePosition();
|
||||
this.codeGraphic.changePosition();
|
||||
this.lozengeGraphic.changePosition();
|
||||
this.doorGraphic.changePosition(this.position);
|
||||
this.codeGraphic.changePosition(this.position);
|
||||
this.lozengeGraphic.changePosition(this.position);
|
||||
}
|
||||
//门的状态
|
||||
if (this.datas.hasdoor) {
|
||||
|
|
|
@ -5,7 +5,14 @@ import {
|
|||
distance2,
|
||||
getRectangleCenter,
|
||||
} from 'jl-graphic';
|
||||
import { Container, Graphics, Rectangle, Color, Point } from 'pixi.js';
|
||||
import {
|
||||
Container,
|
||||
Graphics,
|
||||
Rectangle,
|
||||
Color,
|
||||
Point,
|
||||
IPointData,
|
||||
} from 'pixi.js';
|
||||
import {
|
||||
CodeConstsConfig,
|
||||
DoorConstsConfig,
|
||||
|
@ -82,10 +89,8 @@ export class DoorGraphic extends Container {
|
|||
-platformConsts.height / 2 - doorConsts.doorPlatformSpacing,
|
||||
);
|
||||
}
|
||||
changePosition() {
|
||||
this.doorGraphic.position.copyFrom(
|
||||
calculateMirrorPoint(new Point(0, 0), this.position),
|
||||
);
|
||||
changePosition(platformPos: IPointData) {
|
||||
this.position.copyFrom(calculateMirrorPoint(new Point(0, 0), platformPos));
|
||||
}
|
||||
clear(): void {
|
||||
this.doorGraphic.clear();
|
||||
|
@ -176,7 +181,7 @@ export class CodeGraphic extends Container {
|
|||
runTime.visible = false;
|
||||
this.position.set(0, 0);
|
||||
}
|
||||
changePosition() {
|
||||
changePosition(platformPos: IPointData) {
|
||||
const platformConsts = this.platformConsts;
|
||||
const codeConsts = platformConsts.codeGraphic as CodeConstsConfig;
|
||||
const psChange = [
|
||||
|
@ -187,7 +192,7 @@ export class CodeGraphic extends Container {
|
|||
];
|
||||
psChange.forEach((g) => {
|
||||
if (g) {
|
||||
g.position.copyFrom(calculateMirrorPoint(new Point(0, 0), g.position));
|
||||
g.position.copyFrom(calculateMirrorPoint(new Point(0, 0), platformPos));
|
||||
}
|
||||
});
|
||||
this.circle.position.set(
|
||||
|
@ -237,10 +242,8 @@ export class LozengeGraphic extends Container {
|
|||
platformConsts.height / 3,
|
||||
);
|
||||
}
|
||||
changePosition() {
|
||||
this.position.copyFrom(
|
||||
calculateMirrorPoint(new Point(0, 0), this.position),
|
||||
);
|
||||
changePosition(platformPos: IPointData) {
|
||||
this.position.copyFrom(calculateMirrorPoint(new Point(0, 0), platformPos));
|
||||
}
|
||||
clear(): void {
|
||||
this.lozenge.clear();
|
||||
|
@ -262,7 +265,7 @@ export class DoorCodeLozenge extends Container {
|
|||
this.codeGraphic = new CodeGraphic(this.platformConsts);
|
||||
this.addChild(this.codeGraphic);
|
||||
}
|
||||
draw(hasDoor: boolean, direction: string) {
|
||||
draw(hasDoor: boolean, direction: string, platformPos: IPointData) {
|
||||
this.doorGraphic.clear();
|
||||
if (hasDoor) {
|
||||
this.doorGraphic.draw();
|
||||
|
@ -270,9 +273,9 @@ export class DoorCodeLozenge extends Container {
|
|||
this.codeGraphic.draw();
|
||||
this.lozengeGraphic.draw();
|
||||
if (direction == 'down') {
|
||||
this.doorGraphic.changePosition();
|
||||
this.codeGraphic.changePosition();
|
||||
this.lozengeGraphic.changePosition();
|
||||
this.doorGraphic.changePosition(platformPos);
|
||||
this.codeGraphic.changePosition(platformPos);
|
||||
this.lozengeGraphic.changePosition(platformPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue