2024-01-03 09:10:35 +08:00
|
|
|
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:
|
2024-01-03 09:30:56 +08:00
|
|
|
const BeiJing = new BeiJingPlatform();
|
2024-01-03 09:10:35 +08:00
|
|
|
BeiJing.loadData(this.datas);
|
|
|
|
BeiJing.loadState(this.states);
|
|
|
|
return BeiJing;
|
|
|
|
default:
|
2024-01-03 09:30:56 +08:00
|
|
|
const XiAn = new XiAnPlatform();
|
2024-01-03 09:10:35 +08:00
|
|
|
XiAn.loadData(this.datas);
|
|
|
|
XiAn.loadState(this.states);
|
|
|
|
return XiAn;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export { PlatformTemplate };
|