38 lines
1.2 KiB
JavaScript
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(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 };
|