From 50f8614df2d59bdb3d7a53335a563414b2d90510 Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Wed, 3 Jan 2024 09:10:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=AB=99=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/Platform/JlPlatform.d.ts | 11 +----- components/Platform/JlPlatform.js | 37 ++---------------- .../Platform/PlatformDrawAssistant.d.ts | 3 +- components/Platform/PlatformTemplate.d.ts | 12 ++++++ components/Platform/PlatformTemplate.js | 37 ++++++++++++++++++ src/packages/Platform/JlPlatform.ts | 37 ------------------ .../Platform/PlatformDrawAssistant.ts | 3 +- src/packages/Platform/PlatformTemplate.ts | 39 +++++++++++++++++++ 8 files changed, 96 insertions(+), 83 deletions(-) create mode 100644 components/Platform/PlatformTemplate.d.ts create mode 100644 components/Platform/PlatformTemplate.js create mode 100644 src/packages/Platform/PlatformTemplate.ts diff --git a/components/Platform/JlPlatform.d.ts b/components/Platform/JlPlatform.d.ts index 1a84a5a..e0adb25 100644 --- a/components/Platform/JlPlatform.d.ts +++ b/components/Platform/JlPlatform.d.ts @@ -1,8 +1,6 @@ -import { JlGraphic, JlGraphicTemplate, VectorText } from 'jl-graphic'; +import { JlGraphic, VectorText } from 'jl-graphic'; import { Container, Graphics } from 'pixi.js'; import { CategoryType, IPlatformData, PlatformConstsConfig } from './PlatformConfig'; -import { IXiAnPlatformState } from './XiAnPlatform'; -import { IBeiJingPlatformState } from './BeiJingPlatform'; declare class RectGraphic extends Container { categoryType: CategoryType; rect: Graphics; @@ -50,11 +48,4 @@ export declare abstract class JlPlatform extends JlGraphic { get datas(): IPlatformData; doRepaint(): void; } -export declare class PlatformTemplate extends JlGraphicTemplate { - hasdoor?: boolean; - direction?: string; - categoryType: CategoryType; - constructor(dataTemplate: IPlatformData, stateTemplate: IXiAnPlatformState | IBeiJingPlatformState, categoryType: CategoryType); - new(): JlPlatform; -} export {}; diff --git a/components/Platform/JlPlatform.js b/components/Platform/JlPlatform.js index 544b9d4..fcfa18e 100644 --- a/components/Platform/JlPlatform.js +++ b/components/Platform/JlPlatform.js @@ -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 { platformConstsMap, CategoryType } from './PlatformConfig.js'; -import { XiAnPlatform } from './XiAnPlatform.js'; -import { BeiJingPlatform } from './BeiJingPlatform.js'; +import { platformConstsMap } from './PlatformConfig.js'; //子元素--矩形 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 }; diff --git a/components/Platform/PlatformDrawAssistant.d.ts b/components/Platform/PlatformDrawAssistant.d.ts index c39ad64..8b5464d 100644 --- a/components/Platform/PlatformDrawAssistant.d.ts +++ b/components/Platform/PlatformDrawAssistant.d.ts @@ -1,6 +1,7 @@ import { FederatedPointerEvent, Point } from 'pixi.js'; 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'; export interface IPlatformDrawOptions { newData: () => IPlatformData; diff --git a/components/Platform/PlatformTemplate.d.ts b/components/Platform/PlatformTemplate.d.ts new file mode 100644 index 0000000..7cef547 --- /dev/null +++ b/components/Platform/PlatformTemplate.d.ts @@ -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 { + hasdoor?: boolean; + direction?: string; + categoryType: CategoryType; + constructor(dataTemplate: IPlatformData, stateTemplate: IXiAnPlatformState | IBeiJingPlatformState, categoryType: CategoryType); + new(): JlPlatform; +} diff --git a/components/Platform/PlatformTemplate.js b/components/Platform/PlatformTemplate.js new file mode 100644 index 0000000..4f39e95 --- /dev/null +++ b/components/Platform/PlatformTemplate.js @@ -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 }; diff --git a/src/packages/Platform/JlPlatform.ts b/src/packages/Platform/JlPlatform.ts index 2c8140e..59ef262 100644 --- a/src/packages/Platform/JlPlatform.ts +++ b/src/packages/Platform/JlPlatform.ts @@ -1,6 +1,5 @@ import { JlGraphic, - JlGraphicTemplate, VectorText, calculateMirrorPoint, getRectangleCenter, @@ -15,8 +14,6 @@ import { PlatformConstsConfig, platformConstsMap, } from './PlatformConfig'; -import { IXiAnPlatformState, XiAnPlatform } from './XiAnPlatform'; -import { BeiJingPlatform, IBeiJingPlatformState } from './BeiJingPlatform'; //子元素--矩形 class RectGraphic extends Container { @@ -299,37 +296,3 @@ export abstract class JlPlatform extends JlGraphic { } } } - -export class PlatformTemplate extends JlGraphicTemplate { - 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; - } - } -} diff --git a/src/packages/Platform/PlatformDrawAssistant.ts b/src/packages/Platform/PlatformDrawAssistant.ts index e0c6d1d..8dda3d2 100644 --- a/src/packages/Platform/PlatformDrawAssistant.ts +++ b/src/packages/Platform/PlatformDrawAssistant.ts @@ -8,7 +8,8 @@ import { JlGraphic, } from 'jl-graphic'; -import { JlPlatform, PlatformTemplate } from './JlPlatform'; +import { JlPlatform } from './JlPlatform'; +import { PlatformTemplate } from './PlatformTemplate'; import { CategoryType, IPlatformData } from './PlatformConfig'; export interface IPlatformDrawOptions { diff --git a/src/packages/Platform/PlatformTemplate.ts b/src/packages/Platform/PlatformTemplate.ts new file mode 100644 index 0000000..801af9b --- /dev/null +++ b/src/packages/Platform/PlatformTemplate.ts @@ -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 { + 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; + } + } +}