diff options
| author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-04-03 00:05:04 +0800 |
|---|---|---|
| committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-04-03 00:05:04 +0800 |
| commit | 7efa7599053cc8da203286d2beaeac737b2325f1 (patch) | |
| tree | 70f50385e4cd6bc7749d611cfab241714663fbea /features/settings/settingThings | |
| parent | 4411297dc00f5fa33864530756fbeeaf617bb2c7 (diff) | |
| download | SoopyV2-7efa7599053cc8da203286d2beaeac737b2325f1.tar.gz SoopyV2-7efa7599053cc8da203286d2beaeac737b2325f1.tar.bz2 SoopyV2-7efa7599053cc8da203286d2beaeac737b2325f1.zip | |
asd
Diffstat (limited to 'features/settings/settingThings')
| -rw-r--r-- | features/settings/settingThings/settingBase.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/features/settings/settingThings/settingBase.js b/features/settings/settingThings/settingBase.js index 55dacc3..8093179 100644 --- a/features/settings/settingThings/settingBase.js +++ b/features/settings/settingThings/settingBase.js @@ -1,8 +1,12 @@ import SoopyContentChangeEvent from "../../../../guimanager/EventListener/SoopyContentChangeEvent"; +import SoopyMouseClickEvent from "../../../../guimanager/EventListener/SoopyMouseClickEvent"; +import BoxWithText from "../../../../guimanager/GuiElement/BoxWithText"; import BoxWithTextAndDescription from "../../../../guimanager/GuiElement/BoxWithTextAndDescription" import SoopyGuiElement from "../../../../guimanager/GuiElement/SoopyGuiElement"; import renderLibs from "../../../../guimanager/renderLibs"; +import helpDataLoader from "../helpDataLoader"; import settingsCommunicator from "../settingsCommunicator"; +import SoopyMarkdownElement from "../../../../guimanager/GuiElement/SoopyMarkdownElement"; class SettingBase { constructor(name, description, defaultVal, settingId, module){ @@ -21,6 +25,17 @@ class SettingBase { this.guiObject.addChild(this.settingObject) + this.helpButton = new BoxWithText().setText("ยง0?").setLocation(3, 3, 0.05, 0.5) + this.helpButton.location.location.setRelative(false, false) + + this.helpButton.addEvent(new SoopyMouseClickEvent().setHandler(()=>{ + module.FeatureManager.features.soopyGui.class.openSidebarPage(new SoopyGuiElement().setLocation(0.05,0.05,0.9,0.9).setScrollable(true).addChild(new SoopyMarkdownElement().setLocation(0,0,1,1).setText("Loading..."))) + + this.getHelp(helpText=>{ + module.FeatureManager.features.soopyGui.class.openSidebarPage(new SoopyGuiElement().setLocation(0.05,0.05,0.9,0.9).setScrollable(true).addChild(new SoopyMarkdownElement().setLocation(0,0,1,1).setText(helpText))) + }) + })) + settingsCommunicator.addSetting(this.moduleId, settingId, this) if(!module.FeatureManager.featureSettingsData[this.moduleId]){ @@ -46,6 +61,20 @@ class SettingBase { this.initTime = Date.now() } + update(){ + if(this.hasHelp()){ + this.guiObject.addChild(this.helpButton) + } + } + + hasHelp(){ + return helpDataLoader.hasData(this.moduleId, this.settingId) + } + + getHelp(callback){ + helpDataLoader.getData(this.moduleId, this.settingId, callback) + } + getValue(){ return this.val; } |
