UNPKG

@kitten-science/kitten-scientists

Version:

Add-on for the wonderful incremental browser game: https://kittensgame.com/web/

40 lines 2.13 kB
import { isNil } from "@oliversalzburg/js-utils/data/nil.js"; import { Container } from "./components/Container.js"; import stylesLabelListItem from "./components/LabelListItem.module.css"; import { SettingListItem } from "./components/SettingListItem.js"; import { SettingsList } from "./components/SettingsList.js"; import { SettingsPanel } from "./components/SettingsPanel.js"; export class MissionSettingsUi extends SettingsPanel { _missions; constructor(parent, settings, _locale, sectionSetting) { const label = parent.host.engine.i18n("ui.upgrade.missions"); super(parent, settings, new SettingListItem(parent, settings, label, { onCheck: (_isBatchProcess) => { parent.host.engine.imessage("status.auto.enable", [label]); }, onRefresh: () => { this.expando.ineffective = sectionSetting.enabled && settings.enabled && !Object.values(settings.missions).some(mission => mission.enabled); }, onUnCheck: (_isBatchProcess) => { parent.host.engine.imessage("status.auto.disable", [label]); }, }).addChildrenHead([new Container(parent, { classes: [stylesLabelListItem.fillSpace] })])); // Missions should be sorted by KG. For example, when going to the sun just choose the top five Checkbox instead of looking through the list this._missions = this.host.game.space.programs .filter(item => !isNil(this.setting.missions[item.name])) .map(mission => new SettingListItem(this, this.setting.missions[mission.name], mission.label, { onCheck: () => { this.host.engine.imessage("status.sub.enable", [mission.label]); }, onUnCheck: () => { this.host.engine.imessage("status.sub.disable", [mission.label]); }, })); const itemsList = new SettingsList(this).addChildren(this._missions); this.addChildContent(itemsList); } } //# sourceMappingURL=MissionSettingsUi.js.map