站台微调

This commit is contained in:
joylink_zhaoerwei 2024-01-10 16:59:12 +08:00
parent 3c3a0a2ecb
commit a08ef74550
8 changed files with 8 additions and 35 deletions

View File

@ -1,7 +1,6 @@
import { JlGraphic, VectorText } from 'jl-graphic'; import { JlGraphic, VectorText } from 'jl-graphic';
import { Container, Graphics } from 'pixi.js'; import { Container, Graphics } from 'pixi.js';
import { IPlatformData, PlatformConstsConfig } from './PlatformConfig'; import { IPlatformData, PlatformConstsConfig } from './PlatformConfig';
import { StyleType } from 'common/common';
declare class RectGraphic extends Container { declare class RectGraphic extends Container {
rect: Graphics; rect: Graphics;
stateFillColor?: string; stateFillColor?: string;
@ -34,12 +33,11 @@ declare class LozengeGraphic extends Container {
clear(): void; clear(): void;
} }
export declare class DoorCodeLozenge extends Container { export declare class DoorCodeLozenge extends Container {
private styleType;
private platformConsts; private platformConsts;
doorGraphic: DoorGraphic; doorGraphic: DoorGraphic;
lozengeGraphic: LozengeGraphic; lozengeGraphic: LozengeGraphic;
codeGraphic: CodeGraphic; codeGraphic: CodeGraphic;
constructor(styleType: StyleType); constructor(platformConsts: PlatformConstsConfig);
draw(hasDoor: boolean, direction: string): void; draw(hasDoor: boolean, direction: string): void;
} }
export declare abstract class JlPlatform extends JlGraphic { export declare abstract class JlPlatform extends JlGraphic {

View File

@ -1,6 +1,5 @@
import { calculateMirrorPoint, JlGraphic, getRectangleCenter, VectorText } from 'jl-graphic'; import { calculateMirrorPoint, JlGraphic, getRectangleCenter, VectorText } from 'jl-graphic';
import { Container, Point, Graphics, Color, Rectangle } from 'pixi.js'; import { Container, Point, Graphics, Color, Rectangle } from 'pixi.js';
import { platformConstsMap } from './PlatformConfig.js';
//子元素--矩形 //子元素--矩形
class RectGraphic extends Container { class RectGraphic extends Container {
@ -157,15 +156,13 @@ class LozengeGraphic extends Container {
} }
} }
class DoorCodeLozenge extends Container { class DoorCodeLozenge extends Container {
styleType;
platformConsts; platformConsts;
doorGraphic; doorGraphic;
lozengeGraphic; lozengeGraphic;
codeGraphic; codeGraphic;
constructor(styleType) { constructor(platformConsts) {
super(); super();
this.styleType = styleType; this.platformConsts = platformConsts;
this.platformConsts = platformConstsMap.get(this.styleType);
this.doorGraphic = new DoorGraphic(); this.doorGraphic = new DoorGraphic();
this.addChild(this.doorGraphic); this.addChild(this.doorGraphic);
this.lozengeGraphic = new LozengeGraphic(); this.lozengeGraphic = new LozengeGraphic();

View File

@ -1,4 +1,3 @@
import { StyleType } from 'common/common';
import { GraphicData } from 'jl-graphic'; import { GraphicData } from 'jl-graphic';
export interface PlatformConstsConfig { export interface PlatformConstsConfig {
width: number; width: number;
@ -69,7 +68,6 @@ export declare const THConsts: {
doorPlatformSpacing: number; doorPlatformSpacing: number;
}; };
}; };
export declare const platformConstsMap: Map<StyleType, PlatformConstsConfig>;
declare enum TypeOfPlatform { declare enum TypeOfPlatform {
Unknown = 0, Unknown = 0,
up = 1, up = 1,

View File

@ -1,5 +1,3 @@
import { StyleType } from '../../common/common.js';
const GPConsts = { const GPConsts = {
width: 90, width: 90,
height: 20, height: 20,
@ -37,10 +35,6 @@ const THConsts = {
doorPlatformSpacing: 10, doorPlatformSpacing: 10,
}, },
}; };
const platformConstsMap = new Map([
[StyleType.GP, GPConsts],
[StyleType.TH, THConsts],
]);
var TypeOfPlatform; var TypeOfPlatform;
(function (TypeOfPlatform) { (function (TypeOfPlatform) {
TypeOfPlatform[TypeOfPlatform["Unknown"] = 0] = "Unknown"; TypeOfPlatform[TypeOfPlatform["Unknown"] = 0] = "Unknown";
@ -48,4 +42,4 @@ var TypeOfPlatform;
TypeOfPlatform[TypeOfPlatform["down"] = 2] = "down"; TypeOfPlatform[TypeOfPlatform["down"] = 2] = "down";
})(TypeOfPlatform || (TypeOfPlatform = {})); })(TypeOfPlatform || (TypeOfPlatform = {}));
export { GPConsts, THConsts, platformConstsMap }; export { GPConsts, THConsts };

View File

@ -1,12 +1,11 @@
import { THConsts } from './PlatformConfig.js'; import { THConsts } from './PlatformConfig.js';
import { JlPlatform, DoorCodeLozenge } from './JlPlatform.js'; import { JlPlatform, DoorCodeLozenge } from './JlPlatform.js';
import { StyleType } from '../../common/common.js';
class THPlatform extends JlPlatform { class THPlatform extends JlPlatform {
doorCodeLozenge; doorCodeLozenge;
constructor() { constructor() {
super(THConsts); super(THConsts);
this.doorCodeLozenge = new DoorCodeLozenge(StyleType.TH); this.doorCodeLozenge = new DoorCodeLozenge(THConsts);
this.addChild(this.doorCodeLozenge); this.addChild(this.doorCodeLozenge);
} }
get states() { get states() {

View File

@ -11,9 +11,7 @@ import {
IPlatformData, IPlatformData,
LozengeConstsConfig, LozengeConstsConfig,
PlatformConstsConfig, PlatformConstsConfig,
platformConstsMap,
} from './PlatformConfig'; } from './PlatformConfig';
import { StyleType } from 'common/common';
//子元素--矩形 //子元素--矩形
class RectGraphic extends Container { class RectGraphic extends Container {
@ -193,17 +191,13 @@ class LozengeGraphic extends Container {
} }
export class DoorCodeLozenge extends Container { export class DoorCodeLozenge extends Container {
private styleType: StyleType;
private platformConsts: PlatformConstsConfig; private platformConsts: PlatformConstsConfig;
doorGraphic: DoorGraphic; doorGraphic: DoorGraphic;
lozengeGraphic: LozengeGraphic; lozengeGraphic: LozengeGraphic;
codeGraphic: CodeGraphic; codeGraphic: CodeGraphic;
constructor(styleType: StyleType) { constructor(platformConsts: PlatformConstsConfig) {
super(); super();
this.styleType = styleType; this.platformConsts = platformConsts;
this.platformConsts = platformConstsMap.get(
this.styleType,
) as PlatformConstsConfig;
this.doorGraphic = new DoorGraphic(); this.doorGraphic = new DoorGraphic();
this.addChild(this.doorGraphic); this.addChild(this.doorGraphic);
this.lozengeGraphic = new LozengeGraphic(); this.lozengeGraphic = new LozengeGraphic();

View File

@ -1,4 +1,3 @@
import { StyleType } from 'common/common';
import { GraphicData } from 'jl-graphic'; import { GraphicData } from 'jl-graphic';
export interface PlatformConstsConfig { export interface PlatformConstsConfig {
@ -76,11 +75,6 @@ export const THConsts = {
}, },
}; };
export const platformConstsMap = new Map<StyleType, PlatformConstsConfig>([
[StyleType.GP, GPConsts],
[StyleType.TH, THConsts],
]);
enum TypeOfPlatform { enum TypeOfPlatform {
Unknown = 0, Unknown = 0,
up = 1, up = 1,

View File

@ -1,7 +1,6 @@
import { GraphicState } from 'jl-graphic'; import { GraphicState } from 'jl-graphic';
import { THConsts } from './PlatformConfig'; import { THConsts } from './PlatformConfig';
import { JlPlatform, DoorCodeLozenge } from './JlPlatform'; import { JlPlatform, DoorCodeLozenge } from './JlPlatform';
import { StyleType } from 'common/common';
export interface ITHPlatformState extends GraphicState { export interface ITHPlatformState extends GraphicState {
get emergstop(): boolean; //紧急关闭 get emergstop(): boolean; //紧急关闭
@ -44,7 +43,7 @@ export class THPlatform extends JlPlatform {
doorCodeLozenge: DoorCodeLozenge; doorCodeLozenge: DoorCodeLozenge;
constructor() { constructor() {
super(THConsts); super(THConsts);
this.doorCodeLozenge = new DoorCodeLozenge(StyleType.TH); this.doorCodeLozenge = new DoorCodeLozenge(THConsts);
this.addChild(this.doorCodeLozenge); this.addChild(this.doorCodeLozenge);
} }
get states(): ITHPlatformState { get states(): ITHPlatformState {