Skip to content
Justin Oroz edited this page Jul 8, 2018 · 2 revisions

Buttons

Overview

Adding a ConfigAction object to your menu displays a Button which can be used to trigger actions in your mod.

Usage

Initializing

ConfigAction myButton = new ConfigAction("mySetting", "Option Label", OptionActionType.GIFT);

ConfigAction initialization requires an identifier, label, and type but can be initialized with the standard enabled. You can then add it to an OptionsTab.

The type argument decides which icon to display and requires a ButtonType enum value which currently includes:

public enum ButtonType
{
    OK, SET, CLEAR, DONE, GIFT
}

The corresponding icons are as follows:

OK SET CLEAR DONE GIFT

Reading/Modifying Values

The event ActionWasTriggered is triggered every time the button is pressed.

The mod can manually trigger the event with the Trigger() method.

Properties and Methods

Initializers

ConfigAction(string identifier, string labelText, ButtonType type, bool enabled = true);

Methods

void Trigger();

Properties

ButtonType type { get; set; }

Events

event ActionHandler ActionWasTriggered;