Class ButtonAttribute
- Namespace
- Nautilus.Options.Attributes
- Assembly
- Nautilus.dll
Attribute used to signify the decorated method should be represented in the mod's options menu
as a ModButtonOption.
When the button is clicked, the given method will run.
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public sealed class ButtonAttribute : ModOptionAttribute, _Attribute
- Inheritance
-
ButtonAttribute
- Implements
- Inherited Members
- Extension Methods
Examples
using Nautilus.Json;
using Nautilus.Options;
using QModManager.Utility;
[Menu("My Options Menu")]
public class Config : ConfigFile
{
[Button("My Cool Button")]
public static void MyCoolButton(object sender, ButtonClickedEventArgs e)
{
Logger.Log(Logger.Level.Info, "Button was clicked!");
Logger.Log(Logger.Level.Info, e.Id.ToString());
}
}
Constructors
ButtonAttribute()
Signifies the decorated method should be represented in the mod's options menu as a ModButtonOption.
public ButtonAttribute()
ButtonAttribute(string)
Signifies the decorated method should be represented in the mod's options menu as a ModButtonOption
and sets its label.
public ButtonAttribute(string label = null)
Parameters
label
string- The label for the button. If none is set, the name of the method will be used.