diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2021-12-14 15:07:28 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2021-12-14 15:07:28 +0800 |
commit | d7c90e5a10ec1518974cdb1ee85506c28d31b2a1 (patch) | |
tree | 070b7d1c63740c71455bf98f8d89f4f0970d4119 /features/settings/settingThings/dropdownSetting.js | |
parent | 35b89852096c48945e55e9d550a417a963a9ad74 (diff) | |
download | SoopyV2-d7c90e5a10ec1518974cdb1ee85506c28d31b2a1.tar.gz SoopyV2-d7c90e5a10ec1518974cdb1ee85506c28d31b2a1.tar.bz2 SoopyV2-d7c90e5a10ec1518974cdb1ee85506c28d31b2a1.zip |
dropdown setting + stat next to name choose stat type + dragon wings fix
Diffstat (limited to 'features/settings/settingThings/dropdownSetting.js')
-rw-r--r-- | features/settings/settingThings/dropdownSetting.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/features/settings/settingThings/dropdownSetting.js b/features/settings/settingThings/dropdownSetting.js new file mode 100644 index 0000000..6681d68 --- /dev/null +++ b/features/settings/settingThings/dropdownSetting.js @@ -0,0 +1,32 @@ + +import SoopyContentChangeEvent from "../../../../guimanager/EventListener/SoopyContentChangeEvent"; +import SettingBase from "./settingBase"; +import Dropdown from "../../../../guimanager/GuiElement/Dropdown"; + +class DropdownSetting extends SettingBase { + constructor(name, description, defaultVal, settingId, module, optionsData){ + super(name, description, defaultVal, settingId, module) + + this.dropdownObject = new Dropdown().setLocation(0, 0.2, 0.9, 0.6).setOptions(optionsData).setSelectedOption(this.getValue()) + this.settingObject.addChild(this.dropdownObject) + + this.settingObject.setLocation(0.6, 0, 0.4, 1) + this.guiObject.text.setLocation(0, 0, 0.6, 0.6) + this.guiObject.description.setLocation(0, 0.6, 0.55, 0.4) + + this.dropdownObject.addEvent(new SoopyContentChangeEvent().setHandler((newVal, oldVal, resetFun)=>{ + this.setValue(newVal) + })) + + } + + setValue(newVal){ + super.setValue(newVal) + + this.dropdownObject.setSelectedOption(newVal) + + return this + } +} + +export default DropdownSetting
\ No newline at end of file |