示例#1
0
        public CheckboxOption(GameObject parentGO, ModSettingBool modSettingBool) : base(parentGO, modSettingBool, "CheckboxOption")
        {
            checkbox     = instantiatedGameObject.transform.Find("Checkbox1").GetComponent <Toggle>();
            checkboxText = instantiatedGameObject.transform.Find("Checkbox1/Label").GetComponent <Text>();

            checkbox.AddOnValueChanged(value => modSettingBool.SetValue(value));
        }
示例#2
0
        public ButtonOption(GameObject parentGO, ModSettingBool modSetting) : base(parentGO, modSetting, "ButtonOption")
        {
            button     = instantiatedGameObject.transform.Find("Button").GetComponent <Button>();
            buttonText = instantiatedGameObject.transform.Find("Button/Text").GetComponent <Text>();

            //button.onClick.AddListener(new Action(() => { buttonPressed(); })); //how you'd normally setup button events
            //button.AddOnClick(buttonPressed); //you can also add OnClick events using this BTD6 Mod Helper extension
        }
示例#3
0
        internal CheckboxOption(GameObject parentGO, ModSettingBool modSettingBool) : base(parentGO, modSettingBool, "CheckboxOption")
        {
            this.modSettingBool = modSettingBool;
            Checkbox            = instantiatedGameObject.transform.Find("Checkbox1").GetComponent <Toggle>();
            CheckboxText        = instantiatedGameObject.transform.Find("Checkbox1/Label").GetComponent <Text>();

            Checkbox.Set(modSettingBool);
            Checkbox.AddOnValueChanged(value => modSettingBool.SetValue(value));
            modSettingBool.OnInitialized.InvokeAll(this);
        }
示例#4
0
        internal ButtonOption(GameObject parentGO, ModSettingBool modSetting) : base(parentGO, modSetting, "ButtonOption")
        {
            Button     = instantiatedGameObject.transform.Find("Button").GetComponent <Button>();
            ButtonText = instantiatedGameObject.transform.Find("Button/Text").GetComponent <Text>();

            //button.onClick.AddListener(new Action(() => { buttonPressed(); })); //how you'd normally setup button events
            //button.AddOnClick(buttonPressed); //you can also add OnClick events using this BTD6 Mod Helper extension

            modSetting.OnInitialized.InvokeAll(this);

            Button.AddOnClick(() => modSetting.SetValue(!modSetting.value));
        }