feat: give enums human-friendly names
This commit is contained in:
parent
6125c60ab8
commit
e44ad0ebc0
|
@ -626,9 +626,9 @@ namespace HUD_Manager {
|
|||
|
||||
ImGui.PushItemWidth(-1);
|
||||
var measuredFrom = element.MeasuredFrom;
|
||||
if (ImGui.BeginCombo($"##measured-from-{kind}", measuredFrom.ToString())) {
|
||||
if (ImGui.BeginCombo($"##measured-from-{kind}", measuredFrom.Name())) {
|
||||
foreach (var measured in (MeasuredFrom[]) Enum.GetValues(typeof(MeasuredFrom))) {
|
||||
if (!ImGui.Selectable($"{measured}##{kind}", measuredFrom == measured)) {
|
||||
if (!ImGui.Selectable($"{measured.Name()}##{kind}", measuredFrom == measured)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -761,9 +761,9 @@ namespace HUD_Manager {
|
|||
DrawSettingName("Style");
|
||||
|
||||
ImGui.PushItemWidth(-1);
|
||||
if (ImGui.BeginCombo($"##style-{kind}", statusOpts.Style.ToString())) {
|
||||
if (ImGui.BeginCombo($"##style-{kind}", statusOpts.Style.Name())) {
|
||||
foreach (var style in (StatusStyle[]) Enum.GetValues(typeof(StatusStyle))) {
|
||||
if (!ImGui.Selectable($"{style}##{kind}")) {
|
||||
if (!ImGui.Selectable($"{style.Name()}##{kind}")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -785,9 +785,9 @@ namespace HUD_Manager {
|
|||
DrawSettingName("Layout");
|
||||
|
||||
ImGui.PushItemWidth(-1);
|
||||
if (ImGui.BeginCombo($"##layout-{kind}", statusOpts.Layout.ToString())) {
|
||||
if (ImGui.BeginCombo($"##layout-{kind}", statusOpts.Layout.Name())) {
|
||||
foreach (var sLayout in (StatusLayout[]) Enum.GetValues(typeof(StatusLayout))) {
|
||||
if (!ImGui.Selectable($"{sLayout}##{kind}")) {
|
||||
if (!ImGui.Selectable($"{sLayout.Name()}##{kind}")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -805,9 +805,9 @@ namespace HUD_Manager {
|
|||
DrawSettingName("Alignment");
|
||||
|
||||
ImGui.PushItemWidth(-1);
|
||||
if (ImGui.BeginCombo($"##alignment-{kind}", statusOpts.Alignment.ToString())) {
|
||||
if (ImGui.BeginCombo($"##alignment-{kind}", statusOpts.Alignment.Name())) {
|
||||
foreach (var alignment in (StatusAlignment[]) Enum.GetValues(typeof(StatusAlignment))) {
|
||||
if (!ImGui.Selectable($"{alignment}##{kind}")) {
|
||||
if (!ImGui.Selectable($"{alignment.Name()}##{kind}")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -858,9 +858,9 @@ namespace HUD_Manager {
|
|||
|
||||
|
||||
ImGui.PushItemWidth(-1);
|
||||
if (ImGui.BeginCombo($"##hotbar-layout-{kind}", hotbarOpts.Layout.ToString())) {
|
||||
if (ImGui.BeginCombo($"##hotbar-layout-{kind}", hotbarOpts.Layout.Name())) {
|
||||
foreach (var hotbarLayout in (HotbarLayout[]) Enum.GetValues(typeof(HotbarLayout))) {
|
||||
if (!ImGui.Selectable($"{hotbarLayout}##{kind}")) {
|
||||
if (!ImGui.Selectable($"{hotbarLayout.Name()}##{kind}")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,21 @@ namespace HUD_Manager.Structs {
|
|||
}
|
||||
|
||||
public static class MeasureFromExt {
|
||||
public static string Name(this MeasuredFrom measuredFrom) {
|
||||
return measuredFrom switch {
|
||||
MeasuredFrom.TopLeft => "Top left",
|
||||
MeasuredFrom.TopMiddle => "Top middle",
|
||||
MeasuredFrom.TopRight => "Top right",
|
||||
MeasuredFrom.MiddleLeft => "Middle left",
|
||||
MeasuredFrom.Middle => "Middle",
|
||||
MeasuredFrom.MiddleRight => "Middle right",
|
||||
MeasuredFrom.BottomLeft => "Bottom left",
|
||||
MeasuredFrom.BottomMiddle => "Bottom middle",
|
||||
MeasuredFrom.BottomRight => "Bottom right",
|
||||
_ => measuredFrom.ToString(),
|
||||
};
|
||||
}
|
||||
|
||||
public static Tuple<MeasuredX, MeasuredY> ToParts(this MeasuredFrom measured) {
|
||||
return measured switch {
|
||||
MeasuredFrom.TopLeft => Tuple.Create(MeasuredX.Left, MeasuredY.Top),
|
||||
|
|
|
@ -25,4 +25,18 @@
|
|||
TwoBySix = 5,
|
||||
OneByTwelve = 6,
|
||||
}
|
||||
|
||||
public static class HotbarLayoutExt {
|
||||
public static string Name(this HotbarLayout layout) {
|
||||
return layout switch {
|
||||
HotbarLayout.TwelveByOne => "12x1",
|
||||
HotbarLayout.SixByTwo => "6x2",
|
||||
HotbarLayout.FourByThree => "4x3",
|
||||
HotbarLayout.ThreeByFour => "3x4",
|
||||
HotbarLayout.TwoBySix => "2x6",
|
||||
HotbarLayout.OneByTwelve => "1x12",
|
||||
_ => layout.ToString(),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,19 @@ namespace HUD_Manager.Structs.Options {
|
|||
ThreeGroups = 0,
|
||||
}
|
||||
|
||||
public static class StatusStyleExt {
|
||||
public static string Name(this StatusStyle style) {
|
||||
return style switch {
|
||||
StatusStyle.Normal => "Normal",
|
||||
StatusStyle.NormalLeftJustified1 => "Normal (left-justified 1)",
|
||||
StatusStyle.NormalLeftJustified2 => "Normal (left-justified 2)",
|
||||
StatusStyle.NormalLeftJustified3 => "Normal (left-justified 3)",
|
||||
StatusStyle.ThreeGroups => "Split into three groups",
|
||||
_ => style.ToString(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public class StatusInfoOptions {
|
||||
private const int GamepadBit = 1 << 4;
|
||||
|
||||
|
@ -104,11 +117,33 @@ namespace HUD_Manager.Structs.Options {
|
|||
FiveByFour,
|
||||
}
|
||||
|
||||
public static class StatusLayoutExt {
|
||||
public static string Name(this StatusLayout layout) {
|
||||
return layout switch {
|
||||
StatusLayout.TwentyByOne => "20x1",
|
||||
StatusLayout.TenByTwo => "10x2",
|
||||
StatusLayout.SevenByThree => "7x3",
|
||||
StatusLayout.FiveByFour => "5x4",
|
||||
_ => layout.ToString(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public enum StatusAlignment {
|
||||
LeftJustified,
|
||||
RightJustified,
|
||||
}
|
||||
|
||||
public static class StatusAlignmentExt {
|
||||
public static string Name(this StatusAlignment alignment) {
|
||||
return alignment switch {
|
||||
StatusAlignment.LeftJustified => "Left-justified",
|
||||
StatusAlignment.RightJustified => "Right-justified",
|
||||
_ => alignment.ToString(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public enum StatusGamepad {
|
||||
Focusable,
|
||||
NonFocusable,
|
||||
|
|
Loading…
Reference in New Issue