rt-graphic-component/components/packages/Platform/PlatformTemplate.js
2024-01-04 10:44:03 +08:00

38 lines
1.2 KiB
JavaScript

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();
BeiJing.loadData(this.datas);
BeiJing.loadState(this.states);
return BeiJing;
default:
const XiAn = new XiAnPlatform();
XiAn.loadData(this.datas);
XiAn.loadState(this.states);
return XiAn;
}
}
}
export { PlatformTemplate };