测试站台

This commit is contained in:
joylink_zhaoerwei 2024-01-03 09:10:35 +08:00
parent a451a5a210
commit 50f8614df2
8 changed files with 96 additions and 83 deletions

View File

@ -1,8 +1,6 @@
import { JlGraphic, JlGraphicTemplate, VectorText } from 'jl-graphic'; import { JlGraphic, VectorText } from 'jl-graphic';
import { Container, Graphics } from 'pixi.js'; import { Container, Graphics } from 'pixi.js';
import { CategoryType, IPlatformData, PlatformConstsConfig } from './PlatformConfig'; import { CategoryType, IPlatformData, PlatformConstsConfig } from './PlatformConfig';
import { IXiAnPlatformState } from './XiAnPlatform';
import { IBeiJingPlatformState } from './BeiJingPlatform';
declare class RectGraphic extends Container { declare class RectGraphic extends Container {
categoryType: CategoryType; categoryType: CategoryType;
rect: Graphics; rect: Graphics;
@ -50,11 +48,4 @@ export declare abstract class JlPlatform extends JlGraphic {
get datas(): IPlatformData; get datas(): IPlatformData;
doRepaint(): void; doRepaint(): void;
} }
export declare class PlatformTemplate extends JlGraphicTemplate<JlPlatform> {
hasdoor?: boolean;
direction?: string;
categoryType: CategoryType;
constructor(dataTemplate: IPlatformData, stateTemplate: IXiAnPlatformState | IBeiJingPlatformState, categoryType: CategoryType);
new(): JlPlatform;
}
export {}; export {};

View File

@ -1,8 +1,6 @@
import { JlGraphic, calculateMirrorPoint, JlGraphicTemplate, getRectangleCenter, VectorText } from 'jl-graphic'; import { JlGraphic, calculateMirrorPoint, getRectangleCenter, VectorText } from 'jl-graphic';
import { Point, Container, Graphics, Color, Rectangle } from 'pixi.js'; import { Point, Container, Graphics, Color, Rectangle } from 'pixi.js';
import { platformConstsMap, CategoryType } from './PlatformConfig.js'; import { platformConstsMap } from './PlatformConfig.js';
import { XiAnPlatform } from './XiAnPlatform.js';
import { BeiJingPlatform } from './BeiJingPlatform.js';
//子元素--矩形 //子元素--矩形
class RectGraphic extends Container { class RectGraphic extends Container {
@ -241,34 +239,5 @@ class JlPlatform extends JlGraphic {
} }
} }
} }
class PlatformTemplate extends JlGraphicTemplate {
hasdoor;
direction;
categoryType;
constructor(dataTemplate, stateTemplate, categoryType) {
super(JlPlatform.Type, { dataTemplate, stateTemplate });
this.categoryType = categoryType;
switch (this.categoryType) {
case CategoryType.XiAn:
this.hasdoor = true;
this.direction = 'up';
break;
}
}
new() {
switch (this.categoryType) {
case CategoryType.BeiJing:
const BeiJing = new BeiJingPlatform(CategoryType.BeiJing);
BeiJing.loadData(this.datas);
BeiJing.loadState(this.states);
return BeiJing;
default:
const XiAn = new XiAnPlatform(CategoryType.XiAn);
XiAn.loadData(this.datas);
XiAn.loadState(this.states);
return XiAn;
}
}
}
export { JlPlatform, PlatformTemplate }; export { JlPlatform };

View File

@ -1,6 +1,7 @@
import { FederatedPointerEvent, Point } from 'pixi.js'; import { FederatedPointerEvent, Point } from 'pixi.js';
import { GraphicDrawAssistant, GraphicInteractionPlugin, IDrawApp, JlGraphic } from 'jl-graphic'; import { GraphicDrawAssistant, GraphicInteractionPlugin, IDrawApp, JlGraphic } from 'jl-graphic';
import { JlPlatform, PlatformTemplate } from './JlPlatform'; import { JlPlatform } from './JlPlatform';
import { PlatformTemplate } from './PlatformTemplate';
import { IPlatformData } from './PlatformConfig'; import { IPlatformData } from './PlatformConfig';
export interface IPlatformDrawOptions { export interface IPlatformDrawOptions {
newData: () => IPlatformData; newData: () => IPlatformData;

View File

@ -0,0 +1,12 @@
import { JlGraphicTemplate } from "jl-graphic";
import { JlPlatform } from "./JlPlatform";
import { CategoryType, IPlatformData } from "./PlatformConfig";
import { IXiAnPlatformState } from "./XiAnPlatform";
import { IBeiJingPlatformState } from "./BeiJingPlatform";
export declare class PlatformTemplate extends JlGraphicTemplate<JlPlatform> {
hasdoor?: boolean;
direction?: string;
categoryType: CategoryType;
constructor(dataTemplate: IPlatformData, stateTemplate: IXiAnPlatformState | IBeiJingPlatformState, categoryType: CategoryType);
new(): JlPlatform;
}

View File

@ -0,0 +1,37 @@
import { JlGraphicTemplate } from 'jl-graphic';
import { JlPlatform } from './JlPlatform.js';
import { CategoryType } from './PlatformConfig.js';
import { XiAnPlatform } from './XiAnPlatform.js';
import { BeiJingPlatform } from './BeiJingPlatform.js';
class PlatformTemplate extends JlGraphicTemplate {
hasdoor;
direction;
categoryType;
constructor(dataTemplate, stateTemplate, categoryType) {
super(JlPlatform.Type, { dataTemplate, stateTemplate });
this.categoryType = categoryType;
switch (this.categoryType) {
case CategoryType.XiAn:
this.hasdoor = true;
this.direction = 'up';
break;
}
}
new() {
switch (this.categoryType) {
case CategoryType.BeiJing:
const BeiJing = new BeiJingPlatform(CategoryType.BeiJing);
BeiJing.loadData(this.datas);
BeiJing.loadState(this.states);
return BeiJing;
default:
const XiAn = new XiAnPlatform(CategoryType.XiAn);
XiAn.loadData(this.datas);
XiAn.loadState(this.states);
return XiAn;
}
}
}
export { PlatformTemplate };

View File

@ -1,6 +1,5 @@
import { import {
JlGraphic, JlGraphic,
JlGraphicTemplate,
VectorText, VectorText,
calculateMirrorPoint, calculateMirrorPoint,
getRectangleCenter, getRectangleCenter,
@ -15,8 +14,6 @@ import {
PlatformConstsConfig, PlatformConstsConfig,
platformConstsMap, platformConstsMap,
} from './PlatformConfig'; } from './PlatformConfig';
import { IXiAnPlatformState, XiAnPlatform } from './XiAnPlatform';
import { BeiJingPlatform, IBeiJingPlatformState } from './BeiJingPlatform';
//子元素--矩形 //子元素--矩形
class RectGraphic extends Container { class RectGraphic extends Container {
@ -299,37 +296,3 @@ export abstract class JlPlatform extends JlGraphic {
} }
} }
} }
export class PlatformTemplate extends JlGraphicTemplate<JlPlatform> {
hasdoor?: boolean;
direction?: string;
categoryType: CategoryType;
constructor(
dataTemplate: IPlatformData,
stateTemplate: IXiAnPlatformState | IBeiJingPlatformState,
categoryType: CategoryType,
) {
super(JlPlatform.Type, { dataTemplate, stateTemplate });
this.categoryType = categoryType;
switch (this.categoryType) {
case CategoryType.XiAn:
this.hasdoor = true;
this.direction = 'up';
break;
}
}
new(): JlPlatform {
switch (this.categoryType) {
case CategoryType.BeiJing:
const BeiJing = new BeiJingPlatform(CategoryType.BeiJing);
BeiJing.loadData(this.datas);
BeiJing.loadState(this.states);
return BeiJing;
default:
const XiAn = new XiAnPlatform(CategoryType.XiAn);
XiAn.loadData(this.datas);
XiAn.loadState(this.states);
return XiAn;
}
}
}

View File

@ -8,7 +8,8 @@ import {
JlGraphic, JlGraphic,
} from 'jl-graphic'; } from 'jl-graphic';
import { JlPlatform, PlatformTemplate } from './JlPlatform'; import { JlPlatform } from './JlPlatform';
import { PlatformTemplate } from './PlatformTemplate';
import { CategoryType, IPlatformData } from './PlatformConfig'; import { CategoryType, IPlatformData } from './PlatformConfig';
export interface IPlatformDrawOptions { export interface IPlatformDrawOptions {

View File

@ -0,0 +1,39 @@
import { JlGraphicTemplate } from "jl-graphic";
import { JlPlatform } from "./JlPlatform";
import { CategoryType, IPlatformData } from "./PlatformConfig";
import { IXiAnPlatformState, XiAnPlatform } from "./XiAnPlatform";
import { BeiJingPlatform, IBeiJingPlatformState } from "./BeiJingPlatform";
export class PlatformTemplate extends JlGraphicTemplate<JlPlatform> {
hasdoor?: boolean;
direction?: string;
categoryType: CategoryType;
constructor(
dataTemplate: IPlatformData,
stateTemplate: IXiAnPlatformState | IBeiJingPlatformState,
categoryType: CategoryType,
) {
super(JlPlatform.Type, { dataTemplate, stateTemplate });
this.categoryType = categoryType;
switch (this.categoryType) {
case CategoryType.XiAn:
this.hasdoor = true;
this.direction = 'up';
break;
}
}
new(): JlPlatform {
switch (this.categoryType) {
case CategoryType.BeiJing:
const BeiJing = new BeiJingPlatform(CategoryType.BeiJing);
BeiJing.loadData(this.datas);
BeiJing.loadState(this.states);
return BeiJing;
default:
const XiAn = new XiAnPlatform(CategoryType.XiAn);
XiAn.loadData(this.datas);
XiAn.loadState(this.states);
return XiAn;
}
}
}