Skip to content

Commit

Permalink
feat(ui): Enable integer handling on SettingTriggerListItem component
Browse files Browse the repository at this point in the history
  • Loading branch information
oliversalzburg committed Dec 25, 2022
1 parent f180283 commit e28ce2c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions packages/userscript/source/ui/ReligionSettingsUi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ export class ReligionSettingsUi extends SettingsSectionUi<ReligionSettings> {
this._host,
this._host.engine.i18n("option.faith.adore"),
this.setting.adore,
"percentage",
{
onCheck: () =>
this._host.engine.imessage("status.sub.enable", [
Expand All @@ -244,6 +245,7 @@ export class ReligionSettingsUi extends SettingsSectionUi<ReligionSettings> {
this._host,
this._host.engine.i18n("option.praise"),
this.setting.autoPraise,
"percentage",
{
onCheck: () =>
this._host.engine.imessage("status.sub.enable", [
Expand Down
1 change: 1 addition & 0 deletions packages/userscript/source/ui/TimeControlSettingsUi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export class TimeControlSettingsUi extends SettingsSectionUi<TimeControlSettings
this._host,
this._host.engine.i18n("option.accelerate"),
this.setting.accelerateTime,
"percentage",
{
onCheck: () => this._host.engine.imessage("status.sub.enable", [label]),
onUnCheck: () => this._host.engine.imessage("status.sub.disable", [label]),
Expand Down
1 change: 1 addition & 0 deletions packages/userscript/source/ui/VillageSettingsUi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export class VillageSettingsUi extends SettingsSectionUi<VillageSettings> {
this._host,
this._host.engine.i18n("option.hunt"),
this.setting.hunt,
"percentage",
{
onCheck: () =>
this._host.engine.imessage("status.sub.enable", [this._host.engine.i18n("option.hunt")]),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SettingTrigger } from "../../settings/Settings";
import { UserScript } from "../../UserScript";
import { SettingListItem } from "./SettingListItem";
import { TriggerButton } from "./TriggerButton";
import { TriggerButton, TriggerButtonBehavior } from "./TriggerButton";

export class SettingTriggerListItem extends SettingListItem {
readonly triggerButton: TriggerButton;
Expand All @@ -10,6 +10,7 @@ export class SettingTriggerListItem extends SettingListItem {
host: UserScript,
label: string,
setting: SettingTrigger,
behavior: TriggerButtonBehavior = "percentage",
handler: {
onCheck: () => void;
onUnCheck: () => void;
Expand All @@ -19,7 +20,7 @@ export class SettingTriggerListItem extends SettingListItem {
) {
super(host, label, setting, handler, delimiter, upgradeIndicator);

this.triggerButton = new TriggerButton(host, label, setting);
this.triggerButton = new TriggerButton(host, label, setting, behavior);
this.element.append(this.triggerButton.element);
}

Expand Down

0 comments on commit e28ce2c

Please sign in to comment.