Adding to UI
- For Variables on MBSingleton - use MBUICategory and MBUIGroup to set what category the variable should show in in the UI.
Attributes can be used to set how the widget should show
[MBValueMinFloatAttribute(0)]
[MBValueMaxFloatAttribute(5)]
[MBValueSlider(WholeNumbers: true, HideEditNumpad: true)]
public FloatVariable QualityLevel { get; private set; }
Register UI Buttons
Separate from the MBVariable system is a way to register UI buttons with the settings systems. This is a way to include buttons in the various Settings windows. A icon can be set, SetVisible can be used to set when it should be shown, and 'OnClick' for when it is clicked.
RegisteredUIButton BuildNewButton = new RegisteredUIButton("Build New", this, ButtonIcons.Instance.BuildNew);
SettingsVars.RegisterUIButton(BuildNewButton, "MainMenu");
BuildNewButton.SetVisible = () =>
{
return !Engine.Instance.InOnlineRoom;
};
BuildNewButton.OnClicked = () =>
{
BuildNewButton.BigUI.ShowScreen("BuildNewScreen");
};
Updated almost 2 years ago