From 4d3d21f2feb88aefd1423f2883648b84701cccf8 Mon Sep 17 00:00:00 2001 From: LTS-FFXIV <127939494+LTS-FFXIV@users.noreply.github.com> Date: Fri, 31 Jan 2025 01:22:55 -0600 Subject: [PATCH] Refactor RotationConfigWindow and update submodule Updated subproject commit to c28878a. Refactored DrawErrorZone in RotationConfigWindow: - Check for incompatible plugin using FirstOrDefault. - Removed hasIncompatiblePlugin boolean check. - Simplified message string construction. - Refactored ImRaii.PushColor with using var syntax. - Improved readability by removing unnecessary braces. --- ECommons | 2 +- RotationSolver/UI/RotationConfigWindow.cs | 19 +++++++------------ 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/ECommons b/ECommons index 2c01433d..c28878a3 160000 --- a/ECommons +++ b/ECommons @@ -1 +1 @@ -Subproject commit 2c01433dba269cd7624b88e86cc8b74f904b34c7 +Subproject commit c28878a30d62d3cd4b0928bd21aa382d420871b1 diff --git a/RotationSolver/UI/RotationConfigWindow.cs b/RotationSolver/UI/RotationConfigWindow.cs index e6174823..f193b0eb 100644 --- a/RotationSolver/UI/RotationConfigWindow.cs +++ b/RotationSolver/UI/RotationConfigWindow.cs @@ -145,22 +145,17 @@ private static void DrawDutyRotation() private void DrawErrorZone() { var incompatiblePlugins = DownloadHelper.IncompatiblePlugins ?? Array.Empty(); + var installedIncompatiblePlugin = incompatiblePlugins.FirstOrDefault(p => p.IsInstalled && (int)p.Type == 5); - bool hasIncompatiblePlugin = incompatiblePlugins.Any(p => p.IsInstalled); - - if (hasIncompatiblePlugin) + if (installedIncompatiblePlugin.Name != null) { - string message = "Disable incompatible plugin"; - var installedPlugin = incompatiblePlugins.FirstOrDefault(p => p.IsInstalled); - message = $"Disable {installedPlugin.Name}, causes targetting issues."; + string message = $"Disable {installedIncompatiblePlugin.Name}, causes targetting issues."; float availableWidth = ImGui.GetContentRegionAvail().X; // Get the available width dynamically - using (var color = ImRaii.PushColor(ImGuiCol.Text, ImGui.ColorConvertFloat4ToU32(ImGuiColors.DalamudOrange))) - { - ImGui.PushTextWrapPos(ImGui.GetCursorPos().X + availableWidth); // Set text wrapping position dynamically - ImGui.Text(message); - ImGui.PopTextWrapPos(); // Reset text wrapping position - } + using var color = ImRaii.PushColor(ImGuiCol.Text, ImGui.ColorConvertFloat4ToU32(ImGuiColors.DalamudOrange)); + ImGui.PushTextWrapPos(ImGui.GetCursorPos().X + availableWidth); // Set text wrapping position dynamically + ImGui.Text(message); + ImGui.PopTextWrapPos(); // Reset text wrapping position } if (DataCenter.SystemWarnings != null && DataCenter.SystemWarnings.Any())