@kitten-science/kitten-scientists
Version:
Add-on for the wonderful incremental browser game: https://kittensgame.com/web/
42 lines • 1.66 kB
JavaScript
import { SettingListItem } from "./SettingListItem.js";
import { SettingsList } from "./SettingsList.js";
/**
* A list of 4 settings correlating to the 4 seasons.
*/
export class SeasonsList extends SettingsList {
setting;
spring;
summer;
autumn;
winter;
/**
* Constructs a `SeasonsList`.
*
* @param host A reference to the host.
* @param setting The settings that correlate to this list.
* @param options Options for this list
*/
constructor(parent, setting, options) {
super(parent, options);
this.setting = setting;
const makeSeason = (label, setting) => {
return new SettingListItem(this, setting, label, {
onCheck: (isBatchProcess) => {
options?.onCheckSeason?.(label, setting, isBatchProcess);
},
onUnCheck: (isBatchProcess) => {
options?.onUnCheckSeason?.(label, setting, isBatchProcess);
},
});
};
this.spring = makeSeason(this.host.engine.i18n("$calendar.season.spring"), this.setting.spring);
this.summer = makeSeason(this.host.engine.i18n("$calendar.season.summer"), this.setting.summer);
this.autumn = makeSeason(this.host.engine.i18n("$calendar.season.autumn"), this.setting.autumn);
this.winter = makeSeason(this.host.engine.i18n("$calendar.season.winter"), this.setting.winter);
this.addChildren([this.spring, this.summer, this.autumn, this.winter]);
}
toString() {
return `[${SeasonsList.name}#${this.componentId}]`;
}
}
//# sourceMappingURL=SeasonsList.js.map