diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-09-17 23:47:59 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-17 23:47:59 +0800 |
commit | 364caae9b6e47b8d5e1bab950aebc5b35bc4baad (patch) | |
tree | e554b5859e0135b8f644986768306d5f3ee5683e /features/settings/settingThings/toggle.js | |
parent | eb8bc77bf2d790e97fe793eb96ad77e1b4d2bbbf (diff) | |
parent | 12f3a81cf12c6ffc24a7f2a0e8102dfba3fddf82 (diff) | |
download | SoopyV2-364caae9b6e47b8d5e1bab950aebc5b35bc4baad.tar.gz SoopyV2-364caae9b6e47b8d5e1bab950aebc5b35bc4baad.tar.bz2 SoopyV2-364caae9b6e47b8d5e1bab950aebc5b35bc4baad.zip |
Merge pull request #71 from Soopyboo32/Babel
Diffstat (limited to 'features/settings/settingThings/toggle.js')
-rw-r--r-- | features/settings/settingThings/toggle.js | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/features/settings/settingThings/toggle.js b/features/settings/settingThings/toggle.js deleted file mode 100644 index 24310d2..0000000 --- a/features/settings/settingThings/toggle.js +++ /dev/null @@ -1,62 +0,0 @@ -import Enum from "../../../../guimanager/Enum"; -import SoopyContentChangeEvent from "../../../../guimanager/EventListener/SoopyContentChangeEvent"; -import Toggle from "../../../../guimanager/GuiElement/Toggle"; -import SettingBase from "./settingBase"; - -class ToggleSetting extends SettingBase { - constructor(name, description, defaultVal, settingId, module) { - super(name, description, defaultVal, settingId, module) - - this.onChange = undefined - - this.toggleObject = new Toggle().setLocation(0, 0.3, 0.8, 0.4).setValue(this.getValue()) - this.settingObject.addChild(this.toggleObject) - - this.toggleObject.addEvent(new SoopyContentChangeEvent().setHandler((newVal, oldVal, resetFun) => { - this.setValue(newVal) - })) - - } - - setValue(newVal) { - super.setValue(newVal) - - this.toggleObject.setValue(newVal) - - if (this.onChange) this.onChange() - - return this - } - - requires(toggleSetting) { - this.requiresO = toggleSetting - - toggleSetting.toggleObject.addEvent(new SoopyContentChangeEvent().setHandler((newVal, oldVal, resetFun) => { - if (newVal) { - this.setValue(this.temp_val) - - this.toggleObject.triggerEvent(Enum.EVENT.CONTENT_CHANGE, [this.temp_val, false, () => { }]) - - this.guiObject.location.size.y.set(0.15, 500) - } else { - this.temp_val = this.getValue() - this.setValue(false) - - this.toggleObject.triggerEvent(Enum.EVENT.CONTENT_CHANGE, [false, this.temp_val, () => { }]) - - this.guiObject.location.size.y.set(0, 500) - } - })) - let newVal = this.requiresO.getValue() - if (!newVal) { - let temp_val = this.temp_val - this.setValue(false) - this.temp_val = temp_val - this.guiObject.location.size.y.set(0, 0) - } - - return this - } -} - -export default ToggleSetting
\ No newline at end of file |