Пример #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));
        }