车站和站台微调
This commit is contained in:
parent
dec41e623b
commit
3cb9513b41
@ -1,4 +1,4 @@
|
||||
import { Color, Graphics, Rectangle } from 'pixi.js';
|
||||
import { Color, Container, Graphics, Rectangle } from 'pixi.js';
|
||||
import {
|
||||
GraphicData,
|
||||
JlGraphic,
|
||||
@ -44,20 +44,21 @@ const platformConsts = {
|
||||
besideSpacing: 10,
|
||||
};
|
||||
|
||||
export interface childJlGraphic extends JlGraphic {
|
||||
export interface childJlGraphic extends Container {
|
||||
clear(): void;
|
||||
draw(): void;
|
||||
}
|
||||
|
||||
//子元素--矩形
|
||||
export class rectGraphic extends JlGraphic {
|
||||
export class rectGraphic extends Container {
|
||||
static Type = 'RectPlatForm';
|
||||
rectGraphic: Graphics;
|
||||
constructor() {
|
||||
super(Platform.Type);
|
||||
super();
|
||||
this.rectGraphic = new Graphics();
|
||||
this.addChild(this.rectGraphic);
|
||||
}
|
||||
doRepaint(): void {
|
||||
draw(): void {
|
||||
const rectGraphic = this.rectGraphic;
|
||||
rectGraphic.clear();
|
||||
rectGraphic.lineStyle(
|
||||
@ -84,18 +85,18 @@ export class rectGraphic extends JlGraphic {
|
||||
}
|
||||
}
|
||||
//子元素--门
|
||||
export class doorGraphic extends JlGraphic {
|
||||
export class doorGraphic extends Container {
|
||||
static Type = 'Door';
|
||||
doorGraphic: Graphics;
|
||||
doorCloseGraphic: Graphics;
|
||||
constructor() {
|
||||
super(doorGraphic.Type);
|
||||
super();
|
||||
this.doorGraphic = new Graphics();
|
||||
this.doorCloseGraphic = new Graphics();
|
||||
this.addChild(this.doorGraphic);
|
||||
this.addChild(this.doorCloseGraphic);
|
||||
}
|
||||
doRepaint(): void {
|
||||
draw(): void {
|
||||
const doorGraphic = this.doorGraphic;
|
||||
const doorCloseGraphic = this.doorCloseGraphic;
|
||||
doorGraphic.clear();
|
||||
@ -139,18 +140,18 @@ export class doorGraphic extends JlGraphic {
|
||||
}
|
||||
}
|
||||
//子元素--字符
|
||||
class codeGraph extends JlGraphic {
|
||||
class codeGraph extends Container {
|
||||
static Type = 'Code';
|
||||
character: VectorText = new VectorText(''); //站台旁字符H或P
|
||||
characterN: VectorText = new VectorText(''); //站台旁数字
|
||||
constructor() {
|
||||
super(codeGraph.Type);
|
||||
super();
|
||||
this.addChild(this.character);
|
||||
this.addChild(this.characterN);
|
||||
this.character.setVectorFontSize(platformConsts.besideFontSize);
|
||||
this.characterN.setVectorFontSize(platformConsts.besideFontSize);
|
||||
}
|
||||
doRepaint(): void {
|
||||
draw(): void {
|
||||
const character = this.character;
|
||||
character.text = 'H';
|
||||
character.anchor.set(0.5);
|
||||
@ -172,17 +173,20 @@ class codeGraph extends JlGraphic {
|
||||
);
|
||||
characterN.style.fill = PlatformColorEnum.HCharYellow;
|
||||
}
|
||||
clear(): void {
|
||||
this.character.destroy();
|
||||
}
|
||||
}
|
||||
//子元素--站台旁菱形图标
|
||||
class besideGraphic extends JlGraphic {
|
||||
class besideGraphic extends Container {
|
||||
static Type = 'BesideGraphic';
|
||||
besideGraphic: Graphics;
|
||||
constructor() {
|
||||
super(Platform.Type);
|
||||
super();
|
||||
this.besideGraphic = new Graphics();
|
||||
this.addChild(this.besideGraphic);
|
||||
}
|
||||
doRepaint(): void {
|
||||
draw(): void {
|
||||
const besideGraphic = this.besideGraphic;
|
||||
besideGraphic.clear();
|
||||
besideGraphic.lineStyle(1, new Color(PlatformColorEnum.lozengeRed));
|
||||
@ -207,14 +211,17 @@ class besideGraphic extends JlGraphic {
|
||||
0
|
||||
);
|
||||
}
|
||||
clear(): void {
|
||||
this.besideGraphic.clear();
|
||||
}
|
||||
}
|
||||
|
||||
export class Platform extends JlGraphic {
|
||||
static Type = 'Platform';
|
||||
platformGraphic: childJlGraphic;
|
||||
doorGraphic: childJlGraphic;
|
||||
besideGraphic: JlGraphic;
|
||||
codeGraph: JlGraphic;
|
||||
besideGraphic: childJlGraphic;
|
||||
codeGraph: childJlGraphic;
|
||||
constructor() {
|
||||
super(Platform.Type);
|
||||
this.platformGraphic = new rectGraphic();
|
||||
@ -233,11 +240,11 @@ export class Platform extends JlGraphic {
|
||||
doRepaint(): void {
|
||||
this.doorGraphic.clear();
|
||||
if (this.datas.hasdoor) {
|
||||
this.doorGraphic.doRepaint();
|
||||
this.doorGraphic.draw();
|
||||
}
|
||||
this.platformGraphic.doRepaint();
|
||||
this.besideGraphic.doRepaint();
|
||||
this.codeGraph.doRepaint();
|
||||
this.platformGraphic.draw();
|
||||
this.besideGraphic.draw();
|
||||
this.codeGraph.draw();
|
||||
this.doorGraphic.position.set(0, 0);
|
||||
this.besideGraphic.position.set(0, 0);
|
||||
this.codeGraph.position.set(0, 0);
|
||||
|
@ -43,6 +43,8 @@ export class PlatformDraw extends GraphicDrawAssistant<
|
||||
|
||||
bind(): void {
|
||||
super.bind();
|
||||
this.platformGraphic.draw();
|
||||
this.doorGraphic.draw();
|
||||
}
|
||||
unbind(): void {
|
||||
super.unbind();
|
||||
@ -60,10 +62,8 @@ export class PlatformDraw extends GraphicDrawAssistant<
|
||||
}
|
||||
|
||||
redraw(p: Point): void {
|
||||
this.platformGraphic.repaint();
|
||||
this.doorGraphic.repaint();
|
||||
this.doorGraphic.position.set(p.x, p.y);
|
||||
this.platformGraphic.position.set(p.x, p.y);
|
||||
this.doorGraphic.position.copyFrom(p);
|
||||
this.platformGraphic.position.copyFrom(p);
|
||||
}
|
||||
|
||||
prepareData(data: IPlatformData): boolean {
|
||||
|
@ -34,6 +34,11 @@ export class StationDraw extends GraphicDrawAssistant<
|
||||
|
||||
bind(): void {
|
||||
super.bind();
|
||||
const codeGraph = this.codeGraph;
|
||||
codeGraph.text = '车站Station';
|
||||
codeGraph.anchor.set(0.5);
|
||||
codeGraph.style.fill = '0xf48815';
|
||||
codeGraph.setVectorFontSize(22);
|
||||
}
|
||||
unbind(): void {
|
||||
super.unbind();
|
||||
@ -50,12 +55,7 @@ export class StationDraw extends GraphicDrawAssistant<
|
||||
}
|
||||
|
||||
redraw(p: Point): void {
|
||||
const codeGraph = this.codeGraph;
|
||||
codeGraph.text = '车站Station';
|
||||
codeGraph.anchor.set(0.5);
|
||||
codeGraph.style.fill = '0xf48815';
|
||||
codeGraph.position.set(p.x, p.y);
|
||||
codeGraph.setVectorFontSize(22);
|
||||
this.codeGraph.position.copyFrom(p);
|
||||
}
|
||||
prepareData(data: IStationData): boolean {
|
||||
const template = this.graphicTemplate;
|
||||
|
Loading…
Reference in New Issue
Block a user