Skip to content
This repository has been archived by the owner on Oct 25, 2022. It is now read-only.

Commit

Permalink
feat(ui): Building groups in bonfire
Browse files Browse the repository at this point in the history
  • Loading branch information
oliversalzburg committed Jul 17, 2021
1 parent f95df34 commit 2c62e9f
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 101 deletions.
207 changes: 111 additions & 96 deletions packages/userscript/source/ui/BonfireSettingsUi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,35 @@ export class BonfireSettingsUi extends SettingsSectionUi<BonfireSettings> {
});

this._optionButtons = [
this._getHeader(this._host.i18n("$buildings.group.food")),
this._getLimitedOption(
"field",
this._options.items.field,
this._host.i18n("$buildings.field.label")
),
this._getLimitedOption(
"pasture",
this._options.items.pasture,
this._host.i18n("$buildings.pasture.label")
),
this._getLimitedOption(
"solarFarm",
this._options.items.solarFarm,
`⮤ ${this._host.i18n("$buildings.solarfarm.label")}`
),
this._getLimitedOption(
"aqueduct",
this._options.items.aqueduct,
this._host.i18n("$buildings.aqueduct.label")
),
this._getLimitedOption(
"hydroPlant",
this._options.items.hydroPlant,
`⮤ ${this._host.i18n("$buildings.hydroplant.label")}`,
true
),

this._getHeader(this._host.i18n("$buildings.group.population")),
this._getLimitedOption(
"hut",
this._options.items.hut,
Expand All @@ -131,90 +160,81 @@ export class BonfireSettingsUi extends SettingsSectionUi<BonfireSettings> {
true
),

this._getHeader(this._host.i18n("$buildings.group.science")),
this._getLimitedOption(
"workshop",
this._options.items.workshop,
this._host.i18n("$buildings.workshop.label")
"library",
this._options.items.library,
this._host.i18n("$buildings.library.label")
),
this._getLimitedOption(
"factory",
this._options.items.factory,
this._host.i18n("$buildings.factory.label"),
"dataCenter",
this._options.items.dataCenter,
`⮤ ${this._host.i18n("$buildings.dataCenter.label")}`
),
this._getLimitedOption(
"academy",
this._options.items.academy,
this._host.i18n("$buildings.academy.label")
),
this._getLimitedOption(
"observatory",
this._options.items.observatory,
`⮤ ${this._host.i18n("$buildings.observatory.label")}`
),
this._getLimitedOption(
"biolab",
this._options.items.biolab,
this._host.i18n("$buildings.biolab.label"),
true
),

this._getHeader(this._host.i18n("$buildings.group.storage")),
this._getLimitedOption(
"field",
this._options.items.field,
this._host.i18n("$buildings.field.label")
"barn",
this._options.items.barn,
this._host.i18n("$buildings.barn.label")
),
this._getLimitedOption(
"pasture",
this._options.items.pasture,
this._host.i18n("$buildings.pasture.label")
"harbor",
this._options.items.harbor,
this._host.i18n("$buildings.harbor.label")
),
this._getLimitedOption(
"solarFarm",
this._options.items.solarFarm,
this._host.i18n("$buildings.solarfarm.label")
"warehouse",
this._options.items.warehouse,
this._host.i18n("$buildings.warehouse.label"),
true
),

this._getHeader(this._host.i18n("$buildings.group.resource")),
this._getLimitedOption(
"mine",
this._options.items.mine,
this._host.i18n("$buildings.mine.label")
),
this._getLimitedOption(
"quarry",
this._options.items.quarry,
this._host.i18n("$buildings.quarry.label")
),
this._getLimitedOption(
"lumberMill",
this._options.items.lumberMill,
this._host.i18n("$buildings.lumberMill.label")
),
this._getLimitedOption(
"aqueduct",
this._options.items.aqueduct,
this._host.i18n("$buildings.aqueduct.label")
),
this._getLimitedOption(
"hydroPlant",
this._options.items.hydroPlant,
this._host.i18n("$buildings.hydroplant.label")
),
this._getLimitedOption(
"oilWell",
this._options.items.oilWell,
this._host.i18n("$buildings.oilWell.label")
),
this._getLimitedOption(
"quarry",
this._options.items.quarry,
this._host.i18n("$buildings.quarry.label"),
true
),

this._getLimitedOption(
"smelter",
this._options.items.smelter,
this._host.i18n("$buildings.smelter.label")
),
this._getLimitedOption(
"biolab",
this._options.items.biolab,
this._host.i18n("$buildings.biolab.label")
),
this._getLimitedOption(
"calciner",
this._options.items.calciner,
this._host.i18n("$buildings.calciner.label")
),
this._getLimitedOption(
"reactor",
this._options.items.reactor,
this._host.i18n("$buildings.reactor.label")
),
this._getLimitedOption(
"accelerator",
this._options.items.accelerator,
this._host.i18n("$buildings.accelerator.label")
this._host.i18n("$buildings.accelerator.label"),
true
),

this._getHeader(this._host.i18n("$buildings.group.industry")),
this._getLimitedOption(
"steamworks",
this._options.items.steamworks,
Expand All @@ -226,29 +246,29 @@ export class BonfireSettingsUi extends SettingsSectionUi<BonfireSettings> {
this._host.i18n("$buildings.magneto.label"),
true
),

this._getLimitedOption(
"library",
this._options.items.library,
this._host.i18n("$buildings.library.label")
"smelter",
this._options.items.smelter,
this._host.i18n("$buildings.smelter.label")
),
this._getLimitedOption(
"dataCenter",
this._options.items.dataCenter,
this._host.i18n("$buildings.dataCenter.label")
"calciner",
this._options.items.calciner,
this._host.i18n("$buildings.calciner.label")
),
this._getLimitedOption(
"academy",
this._options.items.academy,
this._host.i18n("$buildings.academy.label")
"factory",
this._options.items.factory,
this._host.i18n("$buildings.factory.label")
),
this._getLimitedOption(
"observatory",
this._options.items.observatory,
this._host.i18n("$buildings.observatory.label"),
"reactor",
this._options.items.reactor,
this._host.i18n("$buildings.reactor.label"),
true
),

this._getHeader(this._host.i18n("$buildings.group.culture")),
this._getLimitedOption(
"amphitheatre",
this._options.items.amphitheatre,
Expand All @@ -257,12 +277,7 @@ export class BonfireSettingsUi extends SettingsSectionUi<BonfireSettings> {
this._getLimitedOption(
"broadcastTower",
this._options.items.broadcastTower,
this._host.i18n("$buildings.broadcasttower.label")
),
this._getLimitedOption(
"tradepost",
this._options.items.tradepost,
this._host.i18n("$buildings.tradepost.label")
`⮤ ${this._host.i18n("$buildings.broadcasttower.label")}`
),
this._getLimitedOption(
"chapel",
Expand All @@ -272,27 +287,25 @@ export class BonfireSettingsUi extends SettingsSectionUi<BonfireSettings> {
this._getLimitedOption(
"temple",
this._options.items.temple,
this._host.i18n("$buildings.temple.label")
),
this._getLimitedOption(
"mint",
this._options.items.mint,
this._host.i18n("$buildings.mint.label")
this._host.i18n("$buildings.temple.label"),
true
),

this._getHeader(this._host.i18n("$buildings.group.other")),
this._getLimitedOption(
"ziggurat",
this._options.items.ziggurat,
this._host.i18n("$buildings.ziggurat.label")
"workshop",
this._options.items.workshop,
this._host.i18n("$buildings.workshop.label")
),
this._getLimitedOption(
"chronosphere",
this._options.items.chronosphere,
this._host.i18n("$buildings.chronosphere.label")
"tradepost",
this._options.items.tradepost,
this._host.i18n("$buildings.tradepost.label")
),
this._getLimitedOption(
"aiCore",
this._options.items.aiCore,
this._host.i18n("$buildings.aicore.label")
"mint",
this._options.items.mint,
this._host.i18n("$buildings.mint.label")
),
this._getLimitedOption(
"brewery",
Expand All @@ -301,23 +314,25 @@ export class BonfireSettingsUi extends SettingsSectionUi<BonfireSettings> {
true
),

this._getHeader(this._host.i18n("$buildings.group.megastructures")),
this._getLimitedOption(
"barn",
this._options.items.barn,
this._host.i18n("$buildings.barn.label")
"ziggurat",
this._options.items.ziggurat,
this._host.i18n("$buildings.ziggurat.label")
),
this._getLimitedOption(
"harbor",
this._options.items.harbor,
this._host.i18n("$buildings.harbor.label")
"chronosphere",
this._options.items.chronosphere,
this._host.i18n("$buildings.chronosphere.label")
),
this._getLimitedOption(
"warehouse",
this._options.items.warehouse,
this._host.i18n("$buildings.warehouse.label"),
"aiCore",
this._options.items.aiCore,
this._host.i18n("$buildings.aicore.label"),
true
),

this._getHeader(this._host.i18n("$buildings.group.zebraBuildings")),
this._getLimitedOption(
"zebraOutpost",
this._options.items.zebraOutpost,
Expand Down
8 changes: 4 additions & 4 deletions packages/userscript/source/ui/ReligionSettingsUi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export class ReligionSettingsUi extends SettingsSectionUi<ReligionSettings> {
);
});
this._optionButtons = [
this.getHeader("$religion.panel.ziggurat.label"),
this._getHeader("$religion.panel.ziggurat.label"),
this.getOption(
"unicornPasture",
this._options.items.unicornPasture,
Expand Down Expand Up @@ -174,7 +174,7 @@ export class ReligionSettingsUi extends SettingsSectionUi<ReligionSettings> {
true
),

this.getHeader("$religion.panel.orderOfTheSun.label"),
this._getHeader("$religion.panel.orderOfTheSun.label"),
this.getOption(
"solarchant",
this._options.items.solarchant,
Expand Down Expand Up @@ -227,7 +227,7 @@ export class ReligionSettingsUi extends SettingsSectionUi<ReligionSettings> {
true
),

this.getHeader("$religion.panel.cryptotheology.label"),
this._getHeader("$religion.panel.cryptotheology.label"),
this.getOption(
"blackObelisk",
this._options.items.blackObelisk,
Expand Down Expand Up @@ -315,7 +315,7 @@ export class ReligionSettingsUi extends SettingsSectionUi<ReligionSettings> {
}

getAdditionOptions(): Array<JQuery<HTMLElement>> {
const nodeHeader = this.getHeader("Additional options");
const nodeHeader = this._getHeader("Additional options");

const nodeAdore = this.getOption(
"adore",
Expand Down
2 changes: 1 addition & 1 deletion packages/userscript/source/ui/SettingsSectionUi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export abstract class SettingsSectionUi<TState> {
return containerList;
}

protected getHeader(text: string): JQuery<HTMLElement> {
protected _getHeader(text: string): JQuery<HTMLElement> {
const headerElement = $("<li/>");
const header = $("<label/>", {
text,
Expand Down

0 comments on commit 2c62e9f

Please sign in to comment.