add group priorities for ordering groups

This commit is contained in:
XtraCube committed 2024-09-03 20:59:26 -04:00
1 parent 9c14db0321
commit f83dce99ef
3 files changed
+10

No files matched your search

@@ -8,6 +8,8 @@ public class ExampleOptions2 : AbstractOptionGroup
{
public override string GroupName => "Example Options 2";
public override uint GroupPriority => 0; // This group will be displayed first. The default value is uint.MaxValue.
public ModdedToggleOption ToggleOpt1 { get; } = new("Toggle Option 1", false);
public ModdedToggleOption ToggleOpt2 { get; } = new("Toggle Option 2", false)
@@ -26,6 +26,12 @@ public abstract class AbstractOptionGroup
/// </summary>
public virtual Color GroupColor => Color.clear;
/// <summary>
/// Gets the group priority. This is used to determine the order in which groups are displayed in the options menu.
/// Zero is the highest priority, and the default value is the max uint value.
/// </summary>
public virtual uint GroupPriority => uint.MaxValue;
/// <summary>
/// Gets the role the group is associated with. This is used for the advanced role options menu.
/// </summary>
@@ -83,6 +83,8 @@ internal sealed class MiraPluginManager
ModdedOptionsManager.RegisterAttributeOption(type, attribute, property, pluginInfo);
}
}
pluginInfo.OptionGroups.Sort((x, y) => x.GroupPriority.CompareTo(y.GroupPriority));
}
private static void RegisterRoleAttribute(Assembly assembly, MiraPluginInfo pluginInfo)