public StringInputElement(PropertyFieldWrapper memberInfo, object item, IList <string> array, int index) : base(memberInfo, item, (IList)array)
        {
            _GetValue = () => DefaultGetValue();
            _SetValue = (string value) => DefaultSetValue(value);

            if (array != null)
            {
                _GetValue            = () => array[index];
                _SetValue            = (string value) => { array[index] = value; Interface.modConfig.SetPendingChanges(); };
                _TextDisplayFunction = () => index + 1 + ": " + array[index];
            }

            UIPanel textBoxBackground = new UIPanel();

            textBoxBackground.SetPadding(0);
            UIFocusInputTextField uIInputTextField = new UIFocusInputTextField("Type here");

            textBoxBackground.Top.Set(0f, 0f);
            textBoxBackground.Left.Set(-190, 1f);
            textBoxBackground.Width.Set(180, 0f);
            textBoxBackground.Height.Set(30, 0f);
            Append(textBoxBackground);

            uIInputTextField.SetText(_GetValue());
            uIInputTextField.Top.Set(5, 0f);
            uIInputTextField.Left.Set(10, 0f);
            uIInputTextField.Width.Set(-20, 1f);
            uIInputTextField.Height.Set(20, 0);
            uIInputTextField.OnTextChange += (a, b) =>
            {
                _SetValue(uIInputTextField.currentString);
            };
            textBoxBackground.Append(uIInputTextField);
        }
Exemple #2
0
        public override void OnBind()
        {
            base.OnBind();

            UIPanel textBoxBackground = new UIPanel();

            textBoxBackground.SetPadding(0);
            UIFocusInputTextField uIInputTextField = new UIFocusInputTextField("Type here");

            textBoxBackground.Top.Set(0f, 0f);
            textBoxBackground.Left.Set(-190, 1f);
            textBoxBackground.Width.Set(180, 0f);
            textBoxBackground.Height.Set(30, 0f);
            Append(textBoxBackground);

            uIInputTextField.SetText(Value);
            uIInputTextField.Top.Set(5, 0f);
            uIInputTextField.Left.Set(10, 0f);
            uIInputTextField.Width.Set(-20, 1f);
            uIInputTextField.Height.Set(20, 0);
            uIInputTextField.OnTextChange += (a, b) =>
            {
                Value = uIInputTextField.CurrentString;
            };
            textBoxBackground.Append(uIInputTextField);
        }
        public override void OnBind()
        {
            base.OnBind();
            stringList = (IList <string>)list;
            _GetValue  = () => DefaultGetValue();
            _SetValue  = (string value) => DefaultSetValue(value);

            if (stringList != null)
            {
                _GetValue           = () => stringList[index];
                _SetValue           = (string value) => { this.stringList[index] = value; Interface.modConfig.SetPendingChanges(); };
                TextDisplayFunction = () => index + 1 + ": " + this.stringList[index];
            }

            UIPanel textBoxBackground = new UIPanel();

            textBoxBackground.SetPadding(0);
            UIFocusInputTextField uIInputTextField = new UIFocusInputTextField("Type here");

            textBoxBackground.Top.Set(0f, 0f);
            textBoxBackground.Left.Set(-190, 1f);
            textBoxBackground.Width.Set(180, 0f);
            textBoxBackground.Height.Set(30, 0f);
            Append(textBoxBackground);

            uIInputTextField.SetText(_GetValue());
            uIInputTextField.Top.Set(5, 0f);
            uIInputTextField.Left.Set(10, 0f);
            uIInputTextField.Width.Set(-20, 1f);
            uIInputTextField.Height.Set(20, 0);
            uIInputTextField.OnTextChange += (a, b) =>
            {
                _SetValue(uIInputTextField.currentString);
            };
            textBoxBackground.Append(uIInputTextField);
        }
Exemple #4
0
        public override void OnInitialize()
        {
            uIElement = new UIElement();
            uIElement.Width.Set(0f, 0.8f);
            uIElement.MaxWidth.Set(600f, 0f);
            uIElement.Top.Set(160f, 0f);
            uIElement.Height.Set(-180f, 1f);
            uIElement.HAlign = 0.5f;

            uIPanel = new UIPanel();
            uIPanel.Width.Set(0f, 1f);
            uIPanel.Height.Set(-140f, 1f);
            uIPanel.Top.Set(30f, 0f);
            uIPanel.BackgroundColor = UICommon.MainPanelBackground;
            uIElement.Append(uIPanel);

            UIPanel textBoxBackground = new UIPanel();

            textBoxBackground.SetPadding(0);
            filterTextField = new UIFocusInputTextField("Filter Options");
            textBoxBackground.Top.Set(2f, 0f);
            textBoxBackground.Left.Set(-190, 1f);
            textBoxBackground.Width.Set(180, 0f);
            textBoxBackground.Height.Set(30, 0f);
            uIElement.Append(textBoxBackground);

            filterTextField.SetText("");
            filterTextField.Top.Set(5, 0f);
            filterTextField.Left.Set(10, 0f);
            filterTextField.Width.Set(-20, 1f);
            filterTextField.Height.Set(20, 0);
            filterTextField.OnTextChange += (a, b) => {
                updateNeeded = true;
            };
            filterTextField.OnRightClick += (a, b) => {
                filterTextField.SetText("");
            };
            textBoxBackground.Append(filterTextField);

            // TODO: ModConfig Localization support
            message = new UITextPanel <string>("Notification: ");
            message.Width.Set(-80f, 1f);
            message.Height.Set(20f, 0f);
            message.HAlign = 0.5f;
            message.VAlign = 1f;
            message.Top.Set(-65f, 0f);
            uIElement.Append(message);

            mainConfigList = new UIList();
            mainConfigList.Width.Set(-25f, 1f);
            mainConfigList.Height.Set(0f, 1f);
            //mainConfigList.Top.Set(40f, 0f);
            mainConfigList.ListPadding = 5f;
            uIPanel.Append(mainConfigList);
            configPanelStack.Push(uIPanel);
            //currentConfigList = mainConfigList;

            uIScrollbar = new UIScrollbar();
            uIScrollbar.SetView(100f, 1000f);
            uIScrollbar.Height.Set(0f, 1f);
            uIScrollbar.HAlign = 1f;
            uIPanel.Append(uIScrollbar);
            mainConfigList.SetScrollbar(uIScrollbar);

            headerTextPanel        = new UITextPanel <string>("Mod Config", 0.8f, true);
            headerTextPanel.HAlign = 0.5f;
            headerTextPanel.Top.Set(-50f, 0f);
            headerTextPanel.SetPadding(15f);
            headerTextPanel.BackgroundColor = UICommon.DefaultUIBlue;
            uIElement.Append(headerTextPanel);

            previousConfigButton = new UITextPanel <string>("<", 1f, false);
            previousConfigButton.Width.Set(25f, 0);
            previousConfigButton.Height.Set(25f, 0f);
            previousConfigButton.VAlign = 1f;
            previousConfigButton.Top.Set(-65f, 0f);
            previousConfigButton.HAlign = 0f;
            previousConfigButton.WithFadedMouseOver();
            previousConfigButton.OnClick += PreviousConfig;
            //uIElement.Append(previousConfigButton);

            nextConfigButton = new UITextPanel <string>(">", 1f, false);
            nextConfigButton.CopyStyle(previousConfigButton);
            nextConfigButton.WithFadedMouseOver();
            nextConfigButton.HAlign   = 1f;
            nextConfigButton.OnClick += NextConfig;
            //uIElement.Append(nextConfigButton);

            saveConfigButton = new UITextPanel <string>("Save Config", 1f, false);
            saveConfigButton.Width.Set(-10f, 1f / 4f);
            saveConfigButton.Height.Set(25f, 0f);
            saveConfigButton.Top.Set(-20f, 0f);
            saveConfigButton.WithFadedMouseOver();
            saveConfigButton.HAlign   = 0.33f;
            saveConfigButton.VAlign   = 1f;
            saveConfigButton.OnClick += SaveConfig;
            //uIElement.Append(saveConfigButton);

            backButton = new UITextPanel <string>("Back", 1f, false);
            backButton.CopyStyle(saveConfigButton);
            backButton.HAlign = 0;
            backButton.WithFadedMouseOver();
            backButton.OnMouseOver += (a, b) => {
                if (pendingChanges)
                {
                    backButton.BackgroundColor = Color.Red;
                }
            };
            backButton.OnMouseOut += (a, b) => {
                if (pendingChanges)
                {
                    backButton.BackgroundColor = Color.Red * 0.7f;
                }
            };
            backButton.OnClick += BackClick;
            uIElement.Append(backButton);

            revertConfigButton = new UITextPanel <string>("Revert Changes", 1f, false);
            revertConfigButton.CopyStyle(saveConfigButton);
            revertConfigButton.WithFadedMouseOver();
            revertConfigButton.HAlign   = 0.66f;
            revertConfigButton.OnClick += RevertConfig;
            //uIElement.Append(revertConfigButton);

            //float scale = Math.Min(1f, 130f/Main.fontMouseText.MeasureString("Restore Defaults").X);
            restoreDefaultsConfigButton = new UITextPanel <string>("Restore Defaults", 1f, false);
            restoreDefaultsConfigButton.CopyStyle(saveConfigButton);
            restoreDefaultsConfigButton.WithFadedMouseOver();
            restoreDefaultsConfigButton.HAlign   = 1f;
            restoreDefaultsConfigButton.OnClick += RestoreDefaults;
            uIElement.Append(restoreDefaultsConfigButton);

            uIPanel.BackgroundColor = UICommon.MainPanelBackground;

            Append(uIElement);
        }
Exemple #5
0
        public override void OnActivate()
        {
            filterTextField.SetText("");
            updateNeeded = false;
            SetMessage("", Color.White);
            string configDisplayName = ((LabelAttribute)Attribute.GetCustomAttribute(modConfig.GetType(), typeof(LabelAttribute)))?.Label ?? modConfig.Name;

            headerTextPanel.SetText(string.IsNullOrEmpty(configDisplayName) ? modConfig.mod.DisplayName : modConfig.mod.DisplayName + ": " + configDisplayName);
            pendingConfig  = ConfigManager.GeneratePopulatedClone(modConfig);
            pendingChanges = pendingRevertDefaults;
            if (pendingRevertDefaults)
            {
                pendingRevertDefaults = false;
                ConfigManager.Reset(pendingConfig);
                pendingChangesUIUpdate = true;
            }

            int index = modConfigs.IndexOf(modConfig);
            int count = modConfigs.Count;

            //pendingChanges = false;
            backButton.BackgroundColor = UICommon.DefaultUIBlueMouseOver;
            uIElement.RemoveChild(saveConfigButton);
            uIElement.RemoveChild(revertConfigButton);
            uIElement.RemoveChild(previousConfigButton);
            uIElement.RemoveChild(nextConfigButton);
            if (index + 1 < count)
            {
                uIElement.Append(nextConfigButton);
            }
            if (index - 1 >= 0)
            {
                uIElement.Append(previousConfigButton);
            }

            uIElement.RemoveChild(configPanelStack.Peek());
            uIElement.Append(uIPanel);
            mainConfigItems.Clear();
            mainConfigList.Clear();
            configPanelStack.Clear();
            configPanelStack.Push(uIPanel);
            subPageStack.Clear();
            //currentConfigList = mainConfigList;
            int top = 0;

            // load all mod config options into UIList
            // TODO: Inheritance with ModConfig? DeclaredOnly?

            uIPanel.BackgroundColor = UICommon.MainPanelBackground;
            var backgroundColorAttribute = (BackgroundColorAttribute)Attribute.GetCustomAttribute(pendingConfig.GetType(), typeof(BackgroundColorAttribute));

            if (backgroundColorAttribute != null)
            {
                uIPanel.BackgroundColor = backgroundColorAttribute.color;
            }

            int order = 0;

            foreach (PropertyFieldWrapper variable in ConfigManager.GetFieldsAndProperties(pendingConfig))
            {
                if (variable.isProperty && variable.Name == "Mode")
                {
                    continue;
                }
                if (Attribute.IsDefined(variable.MemberInfo, typeof(JsonIgnoreAttribute)) && !Attribute.IsDefined(variable.MemberInfo, typeof(LabelAttribute)))                 // TODO, appropriately named attribute
                {
                    continue;
                }
                HeaderAttribute header = ConfigManager.GetCustomAttribute <HeaderAttribute>(variable, null, null);
                if (header != null)
                {
                    var wrapper = new PropertyFieldWrapper(typeof(HeaderAttribute).GetProperty(nameof(HeaderAttribute.Header)));
                    WrapIt(mainConfigList, ref top, wrapper, header, order++);
                }
                WrapIt(mainConfigList, ref top, variable, pendingConfig, order++);
            }
        }
Exemple #6
0
        public override void OnBind()
        {
            base.OnBind();
            Height.Set(30f, 0f);

            //itemChoice = new UIModConfigItemDefinitionChoice(_GetValue()?.GetID() ?? 0, 0.5f);
            itemChoice = new ItemDefinitionOptionElement(Value, 0.5f);
            itemChoice.Top.Set(2f, 0f);
            itemChoice.Left.Set(-30, 1f);
            itemChoice.OnClick += (a, b) =>
            {
                itemSelectionExpanded = !itemSelectionExpanded;
                updateNeeded          = true;
            };
            Append(itemChoice);

            chooserPanel = new UIPanel();
            chooserPanel.Top.Set(30, 0);
            chooserPanel.Height.Set(200, 0);
            chooserPanel.Width.Set(0, 1);
            chooserPanel.BackgroundColor = Color.CornflowerBlue;

            UIPanel textBoxBackgroundA = new UIPanel();

            textBoxBackgroundA.Width.Set(160, 0f);
            textBoxBackgroundA.Height.Set(30, 0f);
            textBoxBackgroundA.Top.Set(-6, 0);
            textBoxBackgroundA.PaddingTop    = 0;
            textBoxBackgroundA.PaddingBottom = 0;
            chooserFilter = new UIFocusInputTextField("Filter by Name");
            chooserFilter.OnTextChange += (a, b) =>
            {
                updateNeeded = true;
            };
            chooserFilter.OnRightClick += (a, b) => chooserFilter.SetText("");
            chooserFilter.Width         = StyleDimension.Fill;
            chooserFilter.Height.Set(-6, 1f);
            chooserFilter.Top.Set(6, 0f);
            textBoxBackgroundA.Append(chooserFilter);
            chooserPanel.Append(textBoxBackgroundA);

            UIPanel textBoxBackgroundB = new UIPanel();

            textBoxBackgroundB.CopyStyle(textBoxBackgroundA);
            textBoxBackgroundB.Left.Set(180, 0);
            chooserFilterMod = new UIFocusInputTextField("Filter by Mod");
            chooserFilterMod.OnTextChange += (a, b) =>
            {
                updateNeeded = true;
            };
            chooserFilterMod.OnRightClick += (a, b) => chooserFilterMod.SetText("");
            chooserFilterMod.Width         = StyleDimension.Fill;
            chooserFilterMod.Height.Set(-6, 1f);
            chooserFilterMod.Top.Set(6, 0f);
            textBoxBackgroundB.Append(chooserFilterMod);
            chooserPanel.Append(textBoxBackgroundB);

            chooserGrid = new NestedUIGrid();
            chooserGrid.Top.Set(30, 0);
            chooserGrid.Height.Set(-30, 1);
            chooserGrid.Width.Set(-12, 1);
            chooserPanel.Append(chooserGrid);

            UIScrollbar scrollbar = new UIScrollbar();

            scrollbar.SetView(100f, 1000f);
            scrollbar.Height.Set(-30f, 1f);
            scrollbar.Top.Set(30f, 0f);
            scrollbar.Left.Pixels += 8;
            scrollbar.HAlign       = 1f;
            chooserGrid.SetScrollbar(scrollbar);
            chooserPanel.Append(scrollbar);
            //Append(chooserPanel);

            UIModConfigHoverImageSplit upDownButton = new UIModConfigHoverImageSplit(upDownTexture, "Zoom in", "Zoom out");

            upDownButton.Recalculate();
            upDownButton.Top.Set(-4f, 0f);
            upDownButton.Left.Set(-18, 1f);
            upDownButton.OnClick += (a, b) =>
            {
                Rectangle r = b.GetDimensions().ToRectangle();
                if (a.MousePosition.Y < r.Y + r.Height / 2)
                {
                    itemScale = Math.Min(1f, itemScale + 0.1f);
                }
                else
                {
                    itemScale = Math.Max(0.5f, itemScale - 0.1f);
                }
                foreach (var itemchoice in items)
                {
                    itemchoice.SetScale(itemScale);
                }
            };
            chooserPanel.Append(upDownButton);
        }
Exemple #7
0
 internal static void NewFolderClick(UIMouseEvent evt, UIElement listeningElement)
 {
     panel.isVisible = !panel.isVisible;
     textField.SetText("");
 }
        public IntInputElement(PropertyFieldWrapper memberInfo, object item, IList <int> array, int index) : base(memberInfo, item, (IList)array)
        {
            _GetValue = () => DefaultGetValue();
            _SetValue = (int value) => DefaultSetValue(value);

            if (array != null)
            {
                _GetValue            = () => array[index];
                _SetValue            = (int value) => { array[index] = value; Interface.modConfig.SetPendingChanges(); };
                _TextDisplayFunction = () => index + 1 + ": " + array[index];
            }

            if (rangeAttribute != null && rangeAttribute.min is int && rangeAttribute.max is int)
            {
                min = (int)rangeAttribute.min;
                max = (int)rangeAttribute.max;
            }
            if (incrementAttribute != null && incrementAttribute.increment is int)
            {
                this.increment = (int)incrementAttribute.increment;
            }

            UIPanel textBoxBackground = new UIPanel();

            textBoxBackground.SetPadding(0);
            UIFocusInputTextField uIInputTextField = new UIFocusInputTextField("Type here");

            textBoxBackground.Top.Set(0f, 0f);
            textBoxBackground.Left.Set(-190, 1f);
            textBoxBackground.Width.Set(180, 0f);
            textBoxBackground.Height.Set(30, 0f);
            Append(textBoxBackground);

            uIInputTextField.SetText(_GetValue().ToString());
            uIInputTextField.Top.Set(5, 0f);
            uIInputTextField.Left.Set(10, 0f);
            uIInputTextField.Width.Set(-42, 1f);             // allow space for arrows
            uIInputTextField.Height.Set(20, 0);
            uIInputTextField.OnTextChange += (a, b) =>
            {
                if (Int32.TryParse(uIInputTextField.currentString, out int val))
                {
                    _SetValue(val);
                }
                //else
                //{
                //	Interface.modConfig.SetMessage($"{uIInputTextField.currentString} isn't a valid value.", Color.Green);
                //}
            };
            uIInputTextField.OnUnfocus += (a, b) => uIInputTextField.SetText(_GetValue().ToString());
            textBoxBackground.Append(uIInputTextField);

            UIModConfigHoverImageSplit upDownButton = new UIModConfigHoverImageSplit(upDownTexture, "+" + increment, "-" + increment);

            upDownButton.Recalculate();
            upDownButton.Top.Set(4f, 0f);
            upDownButton.Left.Set(-30, 1f);
            upDownButton.OnClick += (a, b) =>
            {
                Rectangle r = b.GetDimensions().ToRectangle();
                if (a.MousePosition.Y < r.Y + r.Height / 2)
                {
                    _SetValue(Utils.Clamp(_GetValue() + increment, min, max));
                }
                else
                {
                    _SetValue(Utils.Clamp(_GetValue() - increment, min, max));
                }
                uIInputTextField.SetText(_GetValue().ToString());
            };
            textBoxBackground.Append(upDownButton);
            Recalculate();
        }
Exemple #9
0
        public ItemDefinitionElement(PropertyFieldWrapper memberInfo, object item, IList <ItemDefinition> array = null, int index = -1) : base(memberInfo, item, (IList)array)
        {
            Height.Set(30f, 0f);

            _GetValue = () => DefaultGetValue();
            _SetValue = (ItemDefinition value) => DefaultSetValue(value);

            if (array != null)
            {
                _GetValue            = () => array[index];
                _SetValue            = (ItemDefinition value) => { array[index] = value; Interface.modConfig.SetPendingChanges(); };
                _TextDisplayFunction = () => index + 1 + ": ";
            }

            //itemChoice = new UIModConfigItemDefinitionChoice(_GetValue()?.GetID() ?? 0, 0.5f);
            itemChoice = new ItemDefinitionOptionElement(_GetValue(), 0.5f);
            itemChoice.Top.Set(2f, 0f);
            itemChoice.Left.Set(-30, 1f);
            itemChoice.OnClick += (a, b) =>
            {
                itemSelectionExpanded = !itemSelectionExpanded;
                updateNeeded          = true;
            };
            Append(itemChoice);

            chooserPanel = new UIPanel();
            chooserPanel.Top.Set(30, 0);
            chooserPanel.Height.Set(200, 0);
            chooserPanel.Width.Set(0, 1);
            chooserPanel.BackgroundColor = Color.CornflowerBlue;

            UIPanel textBoxBackgroundA = new UIPanel();

            textBoxBackgroundA.Width.Set(160, 0f);
            textBoxBackgroundA.Height.Set(30, 0f);
            textBoxBackgroundA.Top.Set(-6, 0);
            textBoxBackgroundA.PaddingTop    = 0;
            textBoxBackgroundA.PaddingBottom = 0;
            chooserFilter = new UIFocusInputTextField("Filter by Name");
            chooserFilter.OnTextChange += (a, b) =>
            {
                updateNeeded = true;
            };
            chooserFilter.OnRightClick += (a, b) => chooserFilter.SetText("");
            chooserFilter.Width         = StyleDimension.Fill;
            chooserFilter.Height.Set(-6, 1f);
            chooserFilter.Top.Set(6, 0f);
            textBoxBackgroundA.Append(chooserFilter);
            chooserPanel.Append(textBoxBackgroundA);

            UIPanel textBoxBackgroundB = new UIPanel();

            textBoxBackgroundB.CopyStyle(textBoxBackgroundA);
            textBoxBackgroundB.Left.Set(180, 0);
            chooserFilterMod = new UIFocusInputTextField("Filter by Mod");
            chooserFilterMod.OnTextChange += (a, b) =>
            {
                updateNeeded = true;
            };
            chooserFilterMod.OnRightClick += (a, b) => chooserFilterMod.SetText("");
            chooserFilterMod.Width         = StyleDimension.Fill;
            chooserFilterMod.Height.Set(-6, 1f);
            chooserFilterMod.Top.Set(6, 0f);
            textBoxBackgroundB.Append(chooserFilterMod);
            chooserPanel.Append(textBoxBackgroundB);

            chooserGrid = new NestedUIGrid();
            chooserGrid.Top.Set(30, 0);
            chooserGrid.Height.Set(-30, 1);
            chooserGrid.Width.Set(-12, 1);
            chooserPanel.Append(chooserGrid);

            UIScrollbar scrollbar = new UIScrollbar();

            scrollbar.SetView(100f, 1000f);
            scrollbar.Height.Set(-30f, 1f);
            scrollbar.Top.Set(30f, 0f);
            scrollbar.Left.Pixels += 8;
            scrollbar.HAlign       = 1f;
            chooserGrid.SetScrollbar(scrollbar);
            chooserPanel.Append(scrollbar);
            //Append(chooserPanel);

            UIModConfigHoverImageSplit upDownButton = new UIModConfigHoverImageSplit(upDownTexture, "Zoom in", "Zoom out");

            upDownButton.Recalculate();
            upDownButton.Top.Set(-4f, 0f);
            upDownButton.Left.Set(-18, 1f);
            upDownButton.OnClick += (a, b) =>
            {
                Rectangle r = b.GetDimensions().ToRectangle();
                if (a.MousePosition.Y < r.Y + r.Height / 2)
                {
                    itemScale = Math.Min(1f, itemScale + 0.1f);
                }
                else
                {
                    itemScale = Math.Max(0.5f, itemScale - 0.1f);
                }
                foreach (var itemchoice in items)
                {
                    itemchoice.SetScale(itemScale);
                }
            };
            chooserPanel.Append(upDownButton);
        }
Exemple #10
0
        public override void OnBind()
        {
            base.OnBind();
            this.intList = (IList <int>)list;

            if (intList != null)
            {
                TextDisplayFunction = () => index + 1 + ": " + intList[index];
            }

            if (rangeAttribute != null && rangeAttribute.min is int && rangeAttribute.max is int)
            {
                min = (int)rangeAttribute.min;
                max = (int)rangeAttribute.max;
            }
            if (incrementAttribute != null && incrementAttribute.increment is int)
            {
                this.increment = (int)incrementAttribute.increment;
            }

            UIPanel textBoxBackground = new UIPanel();

            textBoxBackground.SetPadding(0);
            UIFocusInputTextField uIInputTextField = new UIFocusInputTextField("Type here");

            textBoxBackground.Top.Set(0f, 0f);
            textBoxBackground.Left.Set(-190, 1f);
            textBoxBackground.Width.Set(180, 0f);
            textBoxBackground.Height.Set(30, 0f);
            Append(textBoxBackground);

            uIInputTextField.SetText(GetValue().ToString());
            uIInputTextField.Top.Set(5, 0f);
            uIInputTextField.Left.Set(10, 0f);
            uIInputTextField.Width.Set(-42, 1f);             // allow space for arrows
            uIInputTextField.Height.Set(20, 0);
            uIInputTextField.OnTextChange += (a, b) => {
                if (Int32.TryParse(uIInputTextField.CurrentString, out int val))
                {
                    SetValue(val);
                }
                //else
                //{
                //	Interface.modConfig.SetMessage($"{uIInputTextField.currentString} isn't a valid value.", Color.Green);
                //}
            };
            uIInputTextField.OnUnfocus += (a, b) => uIInputTextField.SetText(GetValue().ToString());
            textBoxBackground.Append(uIInputTextField);

            UIModConfigHoverImageSplit upDownButton = new UIModConfigHoverImageSplit(upDownTexture, "+" + increment, "-" + increment);

            upDownButton.Recalculate();
            upDownButton.Top.Set(4f, 0f);
            upDownButton.Left.Set(-30, 1f);
            upDownButton.OnClick += (a, b) => {
                Rectangle r = b.GetDimensions().ToRectangle();
                if (a.MousePosition.Y < r.Y + r.Height / 2)
                {
                    SetValue(Utils.Clamp(GetValue() + increment, min, max));
                }
                else
                {
                    SetValue(Utils.Clamp(GetValue() - increment, min, max));
                }
                uIInputTextField.SetText(GetValue().ToString());
            };
            textBoxBackground.Append(upDownButton);
            Recalculate();
        }