mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-20 01:46:15 +00:00
Created examples of utilizing option lists
This commit is contained in:
1 parent
ff6c6114cf
commit
e205a68330
2 files changed
+15
No files matched your search
@@ -1,6 +1,7 @@
|
||||
using MiraAPI.GameOptions;
|
||||
using MiraAPI.GameOptions.Attributes;
|
||||
using MiraAPI.Utilities;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MiraAPI.Example.Options;
|
||||
@@ -21,6 +22,10 @@ public class ExampleOptions : AbstractOptionGroup
|
||||
|
||||
[ModdedEnumOption("Best API", typeof(BestApi), ["Mira API", "Mitochondria", "Reactor"])]
|
||||
public BestApi Opt { get; set; } = BestApi.MiraAPI;
|
||||
|
||||
[ModdedEnumOptionList<ValueState>("Value State {0}", ["None", "Primary", "Secondary"])]
|
||||
public List<ValueState> ValueStates { get; } =
|
||||
[ValueState.Primary, ValueState.Secondary, ValueState.None, ValueState.None, ValueState.None];
|
||||
}
|
||||
|
||||
public enum BestApi
|
||||
@@ -29,3 +34,10 @@ public enum BestApi
|
||||
Mitochondria,
|
||||
Reactor,
|
||||
}
|
||||
|
||||
public enum ValueState
|
||||
{
|
||||
None,
|
||||
Primary,
|
||||
Secondary,
|
||||
}
|
||||
@@ -14,6 +14,9 @@ public class ExampleOptions2 : AbstractOptionGroup
|
||||
public ModdedPlayerOption PlayerOption { get; } = new("Eh whatever");
|
||||
public ModdedToggleOption ToggleOpt1 { get; } = new("Toggle Option 1", false);
|
||||
|
||||
public ModdedOptionList<ModdedNumberOption> PlayerNums { get; } = new(5, i =>
|
||||
new($"PlayerNum{i}", 2, 0, 5, 1, Utilities.MiraNumberSuffixes.None));
|
||||
|
||||
public ModdedToggleOption ToggleOpt2 { get; } = new("Toggle Option 2", false)
|
||||
{
|
||||
Visible = () => OptionGroupSingleton<ExampleOptions2>.Instance.ToggleOpt1, // implicit cast from ModdedToggleOption to bool
|
||||
|
||||
Reference in new issue
Block a user