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