mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-20 11:39:45 +00:00
add local setting buttons
This commit is contained in:
1 parent
6b37b9c09c
commit
1f6962efe9
7 files changed
+182
-12
No files matched your search
@@ -2,6 +2,7 @@
|
||||
using MiraAPI.LocalSettings;
|
||||
using MiraAPI.LocalSettings.Attributes;
|
||||
using MiraAPI.Utilities;
|
||||
using Reactor.Utilities;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MiraAPI.Example;
|
||||
@@ -13,11 +14,13 @@ public class ExampleLocalSettings(ConfigFile config) : LocalSettingsTab(config)
|
||||
|
||||
public override LocalSettingTabAppearance TabAppearance => new()
|
||||
{
|
||||
TabColor = Color.cyan,
|
||||
ToggleActiveColor = Color.blue,
|
||||
ToggleInactiveColor = Color.red,
|
||||
};
|
||||
|
||||
[LocalSettingsButton]
|
||||
public LocalSettingsButton ExampleButton { get; private set; } = new("Example Button", OnExampleButtonClick);
|
||||
|
||||
[LocalToggleSetting]
|
||||
public ConfigEntry<bool> ExampleToggle { get; private set; } = config.Bind("General", "Example Bool", true);
|
||||
|
||||
@@ -32,6 +35,11 @@ public class ExampleLocalSettings(ConfigFile config) : LocalSettingsTab(config)
|
||||
|
||||
[LocalEnumSetting]
|
||||
public ConfigEntry<ExampleEnumSetting> ExampleEnum { get; private set; } = config.Bind("General", "Example Enum", ExampleEnumSetting.Fries);
|
||||
|
||||
private static void OnExampleButtonClick(LocalSettingsTab instance)
|
||||
{
|
||||
Logger<ExamplePlugin>.Warning("Button clicked");
|
||||
}
|
||||
}
|
||||
|
||||
public enum ExampleEnumSetting
|
||||
@@ -40,4 +48,4 @@ public enum ExampleEnumSetting
|
||||
Sandwich,
|
||||
Fries,
|
||||
ChickenNuggets,
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user