spaar / besiege-modloader

spaar's Mod Loader for Besiege - Deprecated
Other
57 stars 14 forks source link

Keep reference to SettingsButton and OptionsButton #52

Closed lenartbezek closed 7 years ago

lenartbezek commented 7 years ago

Allows mods to keep reference and update values, text, font sizes of SettingButton and OptionButton instances. Also allows them to destroy them.

Deprecates old register functions but maintains compatibility. New way of registering buttons would now be:

var button = new SettingsButton
{
    Text = "MyButton",
    FontSize = 13,
    Value = true, // default false
    OnToggle = value => Debug.Log("MyButton was toggled to "+value);
};
button.Create();

After creation, changing the button properties also changes the button visually. Button can be removed by calling button.Destroy().

spaar commented 7 years ago

Thank your the the PR! This is indeed a better API and should allow some new use-cases.