rt-graphic-component/components/packages/Platform/common/PlatformTemplate.js
joylink_zhaoerwei 3c81ca8a83 重新打包
2024-01-11 13:38:16 +08:00

38 lines
1.1 KiB
JavaScript

import { JlGraphicTemplate } from 'jl-graphic';
import { JlPlatform } from './JlPlatform.js';
import { THPlatform } from '../THPlatform.js';
import { GPPlatform } from '../GPPlatform.js';
import { StyleType } from '../../../common/common.js';
class PlatformTemplate extends JlGraphicTemplate {
hasdoor;
direction;
styleType;
constructor(dataTemplate, stateTemplate, styleType) {
super(JlPlatform.Type, { dataTemplate, stateTemplate });
this.styleType = styleType;
switch (this.styleType) {
case StyleType.TH:
this.hasdoor = true;
this.direction = 'up';
break;
}
}
new() {
switch (this.styleType) {
case StyleType.GP:
const GP = new GPPlatform();
GP.loadData(this.datas);
GP.loadState(this.states);
return GP;
default:
const TH = new THPlatform();
TH.loadData(this.datas);
TH.loadState(this.states);
return TH;
}
}
}
export { PlatformTemplate };