UNPKG

@kitten-science/kitten-scientists

Version:

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

55 lines 2.1 kB
import { SettingListItem } from "./SettingListItem.js"; import { SettingsList } from "./SettingsList.js"; /** * A list of settings correlating to the planetary cycles in the game. */ export class CyclesList extends SettingsList { setting; /** * Constructs a `SeasonsList`. * * @param host A reference to the host. * @param setting The settings that correlate to this list. * @param behavior Control cycle check box log output * @param options Options for this list. */ constructor(parent, setting, options) { super(parent, options); this.setting = setting; const makeCycle = (cycle, setting) => { const label = parent.host.engine.labelForCycle(cycle); return new SettingListItem(parent, setting, label, { onCheck: (isBatchProcess) => { options?.onCheckCycle?.(label, setting, isBatchProcess); }, onUnCheck: (isBatchProcess) => { options?.onUnCheckCycle?.(label, setting, isBatchProcess); }, }); }; const cycles = [ makeCycle("charon", this.setting.charon), makeCycle("umbra", this.setting.umbra), makeCycle("yarn", this.setting.yarn), makeCycle("helios", this.setting.helios), makeCycle("cath", this.setting.cath), makeCycle("redmoon", this.setting.redmoon), makeCycle("dune", this.setting.dune), makeCycle("piscine", this.setting.piscine), makeCycle("terminus", this.setting.terminus), makeCycle("kairo", this.setting.kairo), ]; this.addChildren(cycles); this.element[0].addEventListener("enableAll", () => { for (const cycle of cycles) { cycle.check(true); } }); this.element[0].addEventListener("disableAll", () => { for (const cycle of cycles) { cycle.uncheck(true); } }); } } //# sourceMappingURL=CyclesList.js.map