public UiNumberInput() { _textInput = new UiTextInput(); _textInput.SetBackground(Constants.Backgrounds.TextInput); _textInput.SetTextColor(Color.Black); _textInput.SetActiveTextColor(Color.Black); _textInput.InputCheck += ch => { switch (ch) { default: return(false); case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case '.': return(true); } }; _textInput.OnChange += text => { if (float.TryParse(text, out var value)) { SetValue(value, true); } }; _displayRow = new UiRow(); var downButton = new UiButton(); downButton.SetBackground(Constants.Backgrounds.Button); downButton.OnHold += () => { SetValue(_value - _itterations, true); }; downButton.SetTextColor(Color.Black); downButton.SetActiveTextColor(Color.Black); var downText = new UiTextBlock(); downText.SetString("-"); downButton.AddChild(downText); var spacer = UiSpacer.GetSpacer(5, 5); _displayRow.AddChild(downButton); _displayRow.AddChild(spacer); base.AddChild(_displayRow); var upButton = new UiButton(); upButton.SetBackground(Constants.Backgrounds.Button); upButton.OnHold += () => { SetValue(_value + _itterations, true); }; var inputColumn = new UiColumn(); inputColumn.AddChild(spacer); inputColumn.AddChild(_textInput); inputColumn.AddChild(spacer); _displayRow.AddChild(inputColumn); _displayRow.AddChild(spacer); _displayRow.AddChild(upButton); upButton.SetTextColor(Color.Black); upButton.SetActiveTextColor(Color.Black); var upText = new UiTextBlock(); upText.SetString("+"); upButton.AddChild(upText); SetSize(60, 30); }