aboutsummaryrefslogtreecommitdiff
path: root/src/features/settings/settingThings/button.js
blob: 77ba4b8dcbed2a307a21e8761c86d90c923bf8f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import SoopyMouseClickEvent from "../../../../guimanager/EventListener/SoopyMouseClickEvent";
import ButtonWithArrow from "../../../../guimanager/GuiElement/ButtonWithArrow";
import SettingBase from "./settingBase";

class ButtonSetting extends SettingBase {
    constructor(name, description, settingId, module, buttonText, buttonFunction, defaultValue=null){
        super(name, description, defaultValue, settingId, module)

        this.buttonObject = new ButtonWithArrow().setLocation(0, 0.3, 0.8, 0.4).setText("§0"+buttonText)
        this.settingObject.addChild(this.buttonObject)

        this.buttonObject.addEvent(new SoopyMouseClickEvent().setHandler(()=>{
            buttonFunction.call(this)
        }))
    }
}

export default ButtonSetting