diff --git a/ChatTwo/Ui/SettingsTabs/ChatColours.cs b/ChatTwo/Ui/SettingsTabs/ChatColours.cs index a8962d4..dfeb028 100755 --- a/ChatTwo/Ui/SettingsTabs/ChatColours.cs +++ b/ChatTwo/Ui/SettingsTabs/ChatColours.cs @@ -15,28 +15,45 @@ internal sealed class ChatColours : ISettingsTab { internal ChatColours(Configuration mutable, Plugin plugin) { this.Mutable = mutable; this.Plugin = plugin; + + #if DEBUG + var sortable = ChatTypeExt.SortOrder + .SelectMany(entry => entry.Item2) + .Where(type => !type.IsGm()) + .ToHashSet(); + var total = Enum.GetValues().Where(type => !type.IsGm()).ToHashSet(); + if (sortable.Count != total.Count) { + Dalamud.Logging.PluginLog.Warning($"There are {sortable.Count} sortable channels, but there are {total.Count} total channels."); + total.ExceptWith(sortable); + foreach (var missing in total) { + Dalamud.Logging.PluginLog.Log($"Missing {missing}"); + } + } + #endif } public void Draw() { - foreach (var type in Enum.GetValues()) { - if (ImGuiUtil.IconButton(FontAwesomeIcon.UndoAlt, $"{type}", Language.Options_ChatColours_Reset)) { - this.Mutable.ChatColours.Remove(type); - } + foreach (var (_, types) in ChatTypeExt.SortOrder) { + foreach (var type in types) { + if (ImGuiUtil.IconButton(FontAwesomeIcon.UndoAlt, $"{type}", Language.Options_ChatColours_Reset)) { + this.Mutable.ChatColours.Remove(type); + } - ImGui.SameLine(); + ImGui.SameLine(); - if (ImGuiUtil.IconButton(FontAwesomeIcon.LongArrowAltDown, $"{type}", Language.Options_ChatColours_Import)) { - var gameColour = this.Plugin.Functions.Chat.GetChannelColour(type); - this.Mutable.ChatColours[type] = gameColour ?? type.DefaultColour() ?? 0; - } + if (ImGuiUtil.IconButton(FontAwesomeIcon.LongArrowAltDown, $"{type}", Language.Options_ChatColours_Import)) { + var gameColour = this.Plugin.Functions.Chat.GetChannelColour(type); + this.Mutable.ChatColours[type] = gameColour ?? type.DefaultColour() ?? 0; + } - ImGui.SameLine(); + ImGui.SameLine(); - var vec = this.Mutable.ChatColours.TryGetValue(type, out var colour) - ? ColourUtil.RgbaToVector3(colour) - : ColourUtil.RgbaToVector3(type.DefaultColour() ?? 0); - if (ImGui.ColorEdit3(type.Name(), ref vec, ImGuiColorEditFlags.NoInputs)) { - this.Mutable.ChatColours[type] = ColourUtil.Vector3ToRgba(vec); + var vec = this.Mutable.ChatColours.TryGetValue(type, out var colour) + ? ColourUtil.RgbaToVector3(colour) + : ColourUtil.RgbaToVector3(type.DefaultColour() ?? 0); + if (ImGui.ColorEdit3(type.Name(), ref vec, ImGuiColorEditFlags.NoInputs)) { + this.Mutable.ChatColours[type] = ColourUtil.Vector3ToRgba(vec); + } } }