예제 #1
0
        internal override void AddSettings(ModSettingsBase modSettings)
        {
            base.AddSettings(modSettings);
            tabSettings.Add(modSettings);

            menuGroup.NotifyChildAdded(modSettings.IsVisible());
            modSettings.AddVisibilityListener((visible) => {
                menuGroup.NotifyChildVisible(visible);
            });
        }
예제 #2
0
        private void UpdateSliderValue(ModSettingsBase modSettings, FieldInfo field, UISlider slider, UILabel label, float from, float to, string numberFormat)
        {
            float sliderValue = from + slider.value * (to - from);

            if (SliderMatchesField(modSettings, field, sliderValue))
            {
                return;
            }
            if (IsIntegerType(field.FieldType))
            {
                sliderValue = Mathf.Round(sliderValue);
            }

            UpdateSliderLabel(field, label, sliderValue, numberFormat);
            SetSettingsField(modSettings, field, Convert.ChangeType(sliderValue, field.FieldType, null));

            if (modSettings.IsVisible() && slider.numberOfSteps > 1)
            {
                GameAudioManager.PlayGUISlider();
            }
        }