feat: order channels and always show GM

This commit is contained in:
Anna
2022-02-04 19:27:50 -05:00
parent 9a38e3a440
commit 8e7a50e3f3
5 changed files with 179 additions and 19 deletions
+30 -17
View File
@@ -78,25 +78,39 @@ internal sealed class Tabs : ISettingsTab {
}
if (ImGui.TreeNodeEx(Language.Options_Tabs_Channels)) {
foreach (var type in Enum.GetValues<ChatType>()) {
var enabled = tab.ChatCodes.ContainsKey(type);
if (ImGui.Checkbox($"##{type.Name()}-{i}", ref enabled)) {
if (enabled) {
tab.ChatCodes[type] = ChatSourceExt.All;
} else {
tab.ChatCodes.Remove(type);
}
}
foreach (var (header, types) in ChatTypeExt.SortOrder) {
if (ImGui.TreeNodeEx(header + $"##{i}")) {
foreach (var type in types) {
if (type.IsGm()) {
continue;
}
ImGui.SameLine();
var enabled = tab.ChatCodes.ContainsKey(type);
if (ImGui.Checkbox($"##{type.Name()}-{i}", ref enabled)) {
if (enabled) {
tab.ChatCodes[type] = ChatSourceExt.All;
} else {
tab.ChatCodes.Remove(type);
}
}
if (ImGui.TreeNodeEx($"{type.Name()}##{i}")) {
tab.ChatCodes.TryGetValue(type, out var sourcesEnum);
var sources = (uint) sourcesEnum;
ImGui.SameLine();
foreach (var source in Enum.GetValues<ChatSource>()) {
if (ImGui.CheckboxFlags(source.ToString(), ref sources, (uint) source)) {
tab.ChatCodes[type] = (ChatSource) sources;
if (type.HasSource()) {
if (ImGui.TreeNodeEx($"{type.Name()}##{i}")) {
tab.ChatCodes.TryGetValue(type, out var sourcesEnum);
var sources = (uint) sourcesEnum;
foreach (var source in Enum.GetValues<ChatSource>()) {
if (ImGui.CheckboxFlags(source.ToString(), ref sources, (uint) source)) {
tab.ChatCodes[type] = (ChatSource) sources;
}
}
ImGui.TreePop();
}
} else {
ImGui.TextUnformatted(type.Name());
}
}
@@ -104,7 +118,6 @@ internal sealed class Tabs : ISettingsTab {
}
}
ImGui.TreePop();
}