diff --git a/RotationSolver.Basic/Configuration/Configs.cs b/RotationSolver.Basic/Configuration/Configs.cs index db531e1b0..ef04ccfcc 100644 --- a/RotationSolver.Basic/Configuration/Configs.cs +++ b/RotationSolver.Basic/Configuration/Configs.cs @@ -8,7 +8,6 @@ namespace RotationSolver.Basic.Configuration; -[Command("Settings")] internal partial class Configs : IPluginConfiguration { public int Version { get; set; } = 8; diff --git a/RotationSolver.Basic/Data/UiString.cs b/RotationSolver.Basic/Data/UiString.cs index 6b8cb7a36..3dbc99836 100644 --- a/RotationSolver.Basic/Data/UiString.cs +++ b/RotationSolver.Basic/Data/UiString.cs @@ -616,12 +616,6 @@ internal enum UiString [Description("Off")] SpecialCommandType_Off, - [Description("Open config window.")] - Commands_Rotation, - - [Description("Rotation Solver Settings v")] - ConfigWindowHeader, - [Description("This config is job specific")] JobConfigTip, diff --git a/RotationSolver/Commands/RSCommands_Actions.cs b/RotationSolver/Commands/RSCommands_Actions.cs index 7fb764179..09fb353ec 100644 --- a/RotationSolver/Commands/RSCommands_Actions.cs +++ b/RotationSolver/Commands/RSCommands_Actions.cs @@ -4,7 +4,6 @@ using ECommons.GameHelpers; using RotationSolver.Basic.Configuration; using RotationSolver.Data; -using RotationSolver.Localization; using RotationSolver.UI; using RotationSolver.Updaters; using XIVConfigUI; diff --git a/RotationSolver/Commands/RSCommands_BasicInfo.cs b/RotationSolver/Commands/RSCommands_BasicInfo.cs index 0e142f997..a2d93674a 100644 --- a/RotationSolver/Commands/RSCommands_BasicInfo.cs +++ b/RotationSolver/Commands/RSCommands_BasicInfo.cs @@ -1,27 +1,8 @@ -using Dalamud.Game.Command; -using ECommons.DalamudServices; -using RotationSolver.Data; -using XIVConfigUI; - -namespace RotationSolver.Commands; +namespace RotationSolver.Commands; public static partial class RSCommands { - internal static void Enable() - => Svc.Commands.AddHandler(Service.COMMAND, new CommandInfo(OnCommand) - { - HelpMessage = UiString.Commands_Rotation.Local(), - ShowInHelp = true, - }); - - internal static void Disable() => Svc.Commands.RemoveHandler(Service.COMMAND); - - private static void OnCommand(string command, string arguments) - { - DoOneCommand(arguments); - } - - private static void DoOneCommand(string str) + internal static void DoOneCommand(string str) { if (TryGetOneEnum(str, out var stateType)) { diff --git a/RotationSolver/Localization/Localization.json b/RotationSolver/Localization/Localization.json index c2d863a39..5874119e8 100644 --- a/RotationSolver/Localization/Localization.json +++ b/RotationSolver/Localization/Localization.json @@ -1,6 +1,4 @@ { - "RotationSolver.Data.UiString.ConfigWindowHeader": "Rotation Solver Settings v", - "RotationSolver.Data.UiString.Commands_Rotation": "Open config window.", "RotationSolver.Basic.Data.StateCommandType.Manual": "Start the addon in Manual mode. You need to choose the target manually. This will bypass any engage settings that you have set up and will start attacking immediately once something is targeted.", "RotationSolver.Basic.Data.StateCommandType.Cancel": "Stop the addon. Always remember to turn it off when it is not in use!", "RotationSolver.Basic.Data.StateCommandType.Auto": "Start the addon in Auto mode. When out of combat or when combat starts, switches the target according to the set condition.", diff --git a/RotationSolver/RotationSolverPlugin.cs b/RotationSolver/RotationSolverPlugin.cs index 73187fc1a..8c5eec759 100644 --- a/RotationSolver/RotationSolverPlugin.cs +++ b/RotationSolver/RotationSolverPlugin.cs @@ -5,7 +5,6 @@ using ECommons; using ECommons.DalamudServices; using ECommons.GameHelpers; -using ECommons.ImGuiMethods; using RotationSolver.Basic.Configuration; using RotationSolver.Basic.Configuration.Timeline; using RotationSolver.Basic.Configuration.Timeline.TimelineCondition; @@ -14,7 +13,6 @@ using RotationSolver.Data; using RotationSolver.Helpers; using RotationSolver.UI; -using RotationSolver.UI.SearchableConfigs; using RotationSolver.Updaters; using XIVConfigUI; @@ -37,7 +35,7 @@ public sealed class RotationSolverPlugin : IDalamudPlugin, IDisposable public RotationSolverPlugin(DalamudPluginInterface pluginInterface) { ECommonsMain.Init(pluginInterface, this, ECommons.Module.DalamudReflector, ECommons.Module.ObjectFunctions); - XIVConfigUIMain.Init(pluginInterface, Service.USERNAME, Service.REPO, Service.COMMAND + "Config"); + XIVConfigUIMain.Init(pluginInterface, Service.USERNAME, Service.REPO, Service.COMMAND, "Open config window.", RSCommands.DoOneCommand); XIVConfigUIMain.ShowTooltip = () => Service.Config.ShowTooltips; _dis.Add(new Service()); @@ -71,11 +69,9 @@ public RotationSolverPlugin(DalamudPluginInterface pluginInterface) PainterManager.Init(); - LocalManager.LanguageChanged += ChangeUITranslation; MajorUpdater.Enable(); Watcher.Enable(); OtherConfiguration.Init(); - ChangeUITranslation(); OpenLinkPayload = pluginInterface.AddChatLinkHandler(0, (id, str) => { @@ -109,21 +105,11 @@ private void OnDraw() windowSystem.Draw(); } - internal static void ChangeUITranslation() - { - _rotationConfigWindow!.WindowName = UiString.ConfigWindowHeader.Local() - + typeof(RotationConfigWindow).Assembly.GetName().Version?.ToString() ?? "?.?.?"; - - RSCommands.Disable(); - RSCommands.Enable(); - } - public async void Dispose() { DataCenter.RightNowDutyRotation?.Dispose(); DataCenter.RightNowRotation?.Dispose(); - RSCommands.Disable(); Watcher.Disable(); Svc.PluginInterface.UiBuilder.OpenConfigUi -= OnOpenConfigUi; @@ -135,8 +121,6 @@ public async void Dispose() } _dis?.Clear(); - LocalManager.LanguageChanged -= ChangeUITranslation; - MajorUpdater.Dispose(); PainterManager.Dispose(); XIVConfigUIMain.Dispose(); diff --git a/RotationSolver/UI/RotationConfigWindow.cs b/RotationSolver/UI/RotationConfigWindow.cs index 36fcabe13..fc9e8a0d4 100644 --- a/RotationSolver/UI/RotationConfigWindow.cs +++ b/RotationSolver/UI/RotationConfigWindow.cs @@ -30,7 +30,7 @@ namespace RotationSolver.UI; public class RotationConfigWindow : ConfigWindow { - public SearchableCollection AllSearchable { get; } = new(Service.Config, + public override SearchableCollection Collection { get; } = new(Service.Config, new SearchableConfigRS()); public static Vector3 HoveredPosition { get; private set; } = Vector3.Zero; @@ -40,7 +40,7 @@ public class RotationConfigWindow : ConfigWindow public override IEnumerable Searchables => [.. base.Searchables, ..DataCenter.RightNowRotation?.Configs]; public RotationConfigWindow() - : base("") + : base(typeof(RotationConfigWindow).Assembly.GetName()) { Size = new Vector2(740f, 490f); } @@ -591,12 +591,7 @@ private static void DrawAboutLinks() { var width = ImGui.GetWindowWidth(); - if (ImageLoader.GetTexture("https://GitHub-readme-stats.vercel.app/api/pin/?username=ArchiDog1998&repo=RotationSolver&theme=dark", out var icon) && ImGuiHelper.TextureButton(icon, width, width)) - { - Util.OpenLink($"https://GitHub.com/{Service.USERNAME}/{Service.REPO}"); - } - - if (ImageLoader.GetTexture("https://badges.crowdin.net/badge/light/crowdin-on-dark.png", out icon) && ImGuiHelper.TextureButton(icon, width, width)) + if (ImageLoader.GetTexture("https://badges.crowdin.net/badge/light/crowdin-on-dark.png", out var icon) && ImGuiHelper.TextureButton(icon, width, width)) { Util.OpenLink("https://crowdin.com/project/rotationsolver"); } @@ -1272,8 +1267,6 @@ public class RotationsItem : ConfigWindowItemRS public override void Draw(ConfigWindow window) { - var rsWindow = (RotationConfigWindow)window; - var width = ImGui.GetWindowWidth(); var text = UiString.ConfigWindow_Rotations_Download.Local(); @@ -1302,7 +1295,7 @@ public override void Draw(ConfigWindow window) _rotationsHeader ??= new(new() { - { () => UiString.ConfigWindow_Rotations_Settings.Local(), () => DrawRotationsSettings(rsWindow)}, + { () => UiString.ConfigWindow_Rotations_Settings.Local(), () => DrawRotationsSettings(window)}, { () => UiString.ConfigWindow_Rotations_Loaded.Local(), DrawRotationsLoaded}, { () => UiString.ConfigWindow_Rotations_GitHub.Local(), DrawRotationsGitHub}, { () => UiString.ConfigWindow_Rotations_Libraries.Local(), DrawRotationsLibraries}, @@ -1311,9 +1304,9 @@ public override void Draw(ConfigWindow window) _rotationsHeader?.Draw(); } - private static void DrawRotationsSettings(RotationConfigWindow window) + private static void DrawRotationsSettings(ConfigWindow window) { - window.AllSearchable.DrawItems((int)UiString.ConfigWindow_Rotations_Settings); + window.Collection.DrawItems((int)UiString.ConfigWindow_Rotations_Settings); } private static void DrawRotationsLoaded() @@ -1566,15 +1559,13 @@ public class ListItem : ConfigWindowItemRS public override void Draw(ConfigWindow window) { - var rsWindow = (RotationConfigWindow)window; - ImGui.TextWrapped(UiString.ConfigWindow_List_Description.Local()); _idsHeader ??= new(new() { { () => UiString.ConfigWindow_List_Statuses.Local(), DrawListStatuses}, { () => Service.Config.UseDefenseAbility ? UiString.ConfigWindow_List_Actions.Local() : string.Empty, - () => DrawListActions(rsWindow)}, + () => DrawListActions(window)}, {() => UiString.ConfigWindow_List_Territories.Local(), DrawListTerritories}, }); _idsHeader?.Draw(); @@ -1730,7 +1721,7 @@ private static void DrawStatusList(string name, HashSet statuses, Status[] } } - private static void DrawListActions(RotationConfigWindow window) + private static void DrawListActions(ConfigWindow window) { ImGui.SetNextItemWidth(ImGui.GetWindowWidth()); ImGui.InputTextWithHint("##Searching the action", UiString.ConfigWindow_List_ActionNameOrId.Local(), ref _actionSearching, 128); @@ -1757,12 +1748,12 @@ private static void DrawListActions(RotationConfigWindow window) DrawActionsList(nameof(OtherConfiguration.HostileCastingTank), OtherConfiguration.HostileCastingTank); ImGui.TableNextColumn(); - window.AllSearchable.DrawItems((int)UiString.ConfigWindow_List_HostileCastingArea); + window.Collection.DrawItems((int)UiString.ConfigWindow_List_HostileCastingArea); ImGui.TextWrapped(UiString.ConfigWindow_List_HostileCastingAreaDesc.Local()); DrawActionsList(nameof(OtherConfiguration.HostileCastingArea), OtherConfiguration.HostileCastingArea); ImGui.TableNextColumn(); - window.AllSearchable.DrawItems((int)UiString.ConfigWindow_List_HostileCastingKnockback); + window.Collection.DrawItems((int)UiString.ConfigWindow_List_HostileCastingKnockback); ImGui.TextWrapped(UiString.ConfigWindow_List_HostileCastingKnockbackDesc.Local()); DrawActionsList(nameof(OtherConfiguration.HostileCastingKnockback), OtherConfiguration.HostileCastingKnockback); } @@ -2030,14 +2021,12 @@ public class BasicItem : ConfigWindowItemRS private CollapsingHeaderGroup? _baseHeader; public override void Draw(ConfigWindow window) { - var rsWindow = (RotationConfigWindow)window; - _baseHeader ??= new(new() { - { () => UiString.ConfigWindow_Basic_Timer.Local(), () => DrawBasicTimer(rsWindow) }, - { () => UiString.ConfigWindow_Basic_AutoSwitch.Local(), () => DrawBasicAutoSwitch(rsWindow) }, + { () => UiString.ConfigWindow_Basic_Timer.Local(), () => DrawBasicTimer(window) }, + { () => UiString.ConfigWindow_Basic_AutoSwitch.Local(), () => DrawBasicAutoSwitch(window) }, { () => UiString.ConfigWindow_Basic_NamedConditions.Local(), DrawBasicNamedConditions }, - { () => UiString.ConfigWindow_Basic_Others.Local(), () => DrawBasicOthers(rsWindow) }, + { () => UiString.ConfigWindow_Basic_Others.Local(), () => DrawBasicOthers(window) }, }); _baseHeader?.Draw(); } @@ -2098,7 +2087,7 @@ private static void AddPingLockTime(ImDrawListPtr drawList, Vector2 lineStart, f time += clickTime; } } - private static void DrawBasicTimer(RotationConfigWindow window) + private static void DrawBasicTimer(ConfigWindow window) { var gcdTime = DataCenter.WeaponTotal; if (gcdTime == 0) gcdTime = 2.5f; @@ -2188,7 +2177,7 @@ private static void DrawBasicTimer(RotationConfigWindow window) ImGui.Spacing(); - window.AllSearchable.DrawItems((int)UiString.ConfigWindow_Basic_Timer); + window.Collection.DrawItems((int)UiString.ConfigWindow_Basic_Timer); } private static readonly CollapsingHeaderGroup _autoSwitch = new(new() @@ -2209,9 +2198,9 @@ private static void DrawBasicTimer(RotationConfigWindow window) { HeaderSize = FontSize.Forth, }; - private static void DrawBasicAutoSwitch(RotationConfigWindow window) + private static void DrawBasicAutoSwitch(ConfigWindow window) { - window.AllSearchable.DrawItems((int)UiString.ConfigWindow_Basic_AutoSwitch); + window.Collection.DrawItems((int)UiString.ConfigWindow_Basic_AutoSwitch); _autoSwitch?.Draw(); } @@ -2265,9 +2254,9 @@ private static void DrawBasicNamedConditions() } } - private static void DrawBasicOthers(RotationConfigWindow window) + private static void DrawBasicOthers(ConfigWindow window) { - window.AllSearchable.DrawItems((int)UiString.ConfigWindow_Basic_Others); + window.Collection.DrawItems((int)UiString.ConfigWindow_Basic_Others); if (Service.Config.SayHelloToAll) { @@ -2304,8 +2293,7 @@ public class UIItem : ConfigWindowItemRS public override void Draw(ConfigWindow window) { - var rsWindow = (RotationConfigWindow)window; - _UIHeader ??= rsWindow.AllSearchable.GetGroups([ + _UIHeader ??= window.Collection.GetGroups([ UiString.ConfigWindow_UI_Information, UiString.ConfigWindow_UI_Overlay, UiString.ConfigWindow_UI_Windows, @@ -2323,8 +2311,6 @@ public class AutoItem : ConfigWindowItemRS public override void Draw(ConfigWindow window) { - var rsWindow = (RotationConfigWindow)window; - ImGui.TextWrapped(UiString.ConfigWindow_Auto_Description.Local()); _autoHeader ??= new(new() { @@ -2334,10 +2320,10 @@ public override void Draw(ConfigWindow window) .Local()); ImGui.Separator(); - rsWindow.AllSearchable.DrawItems((int)UiString.ConfigWindow_Auto_ActionUsage); + window.Collection.DrawItems((int)UiString.ConfigWindow_Auto_ActionUsage); } }, - { () => UiString.ConfigWindow_Auto_ActionCondition.Local(), () => DrawAutoActionCondition(rsWindow) }, + { () => UiString.ConfigWindow_Auto_ActionCondition.Local(), () => DrawAutoActionCondition(window) }, { () => UiString.ConfigWindow_Auto_StateCondition.Local(), () => _autoState?.Draw() }, }); @@ -2405,12 +2391,12 @@ public override void Draw(ConfigWindow window) HeaderSize = FontSize.Forth, }; - private static void DrawAutoActionCondition(RotationConfigWindow window) + private static void DrawAutoActionCondition(ConfigWindow window) { ImGui.TextWrapped(UiString.ConfigWindow_Auto_ActionCondition_Description.Local()); ImGui.Separator(); - window.AllSearchable.DrawItems((int)UiString.ConfigWindow_Auto_ActionCondition); + window.Collection.DrawItems((int)UiString.ConfigWindow_Auto_ActionCondition); } } @@ -2423,19 +2409,17 @@ public class TargetItem : ConfigWindowItemRS public override void Draw(ConfigWindow window) { - var rsWindow = (RotationConfigWindow)window; - _targetHeader ??= new(new() { - { () =>UiString.ConfigWindow_Target_Config.Local(), () => DrawTargetConfig(rsWindow) }, + { () =>UiString.ConfigWindow_Target_Config.Local(), () => DrawTargetConfig(window) }, { () =>UiString.ConfigWindow_List_Hostile.Local(), DrawTargetHostile }, }); _targetHeader?.Draw(); } - private static void DrawTargetConfig(RotationConfigWindow window) + private static void DrawTargetConfig(ConfigWindow window) { - window.AllSearchable.DrawItems((int)UiString.ConfigWindow_Target_Config); + window.Collection.DrawItems((int)UiString.ConfigWindow_Target_Config); } private static void DrawTargetHostile() @@ -2512,14 +2496,12 @@ public class ExtraItem : ConfigWindowItemRS public override void Draw(ConfigWindow window) { - var rsWindow = (RotationConfigWindow)window; - _extraHeader ??= new(new() { { () =>UiString.ConfigWindow_EventItem.Local(), DrawEventTab }, { () =>UiString.ConfigWindow_Extra_Others.Local(), - () => rsWindow.AllSearchable.DrawItems((int)UiString.ConfigWindow_Extra_Others) + () => window.Collection.DrawItems((int)UiString.ConfigWindow_Extra_Others) }, }); ImGui.TextWrapped(UiString.ConfigWindow_Extra_Description.Local()); @@ -2572,9 +2554,7 @@ public class DebutItem : ConfigWindowItemRS public override uint Icon => 5; public override void Draw(ConfigWindow window) { - var rsWindow = (RotationConfigWindow)window; - - rsWindow.AllSearchable.DrawItems(-1); + window.Collection.DrawItems(-1); if (!Player.Available || !Service.Config.InDebug) return; diff --git a/RotationSolver/UI/TimelineDrawer.cs b/RotationSolver/UI/TimelineDrawer.cs index 0cbc340df..8b82e7e96 100644 --- a/RotationSolver/UI/TimelineDrawer.cs +++ b/RotationSolver/UI/TimelineDrawer.cs @@ -13,7 +13,6 @@ using RotationSolver.Data; using RotationSolver.Updaters; using XIVConfigUI; -using XIVConfigUI.Attributes; using XIVDrawer; using XIVDrawer.Vfx; @@ -110,7 +109,7 @@ static string GetName(TerritoryType? territory) ImGui.SameLine(); ImGui.Text(UiString.TimelineRaidTime.Local() + ": " + TimeSpan.FromSeconds(DataCenter.RaidTimeRaw).ToString("hh\\:mm\\:ss\\.f")); - RotationSolverPlugin._rotationConfigWindow?.AllSearchable.DrawItems((int)UiString.TimelineRaidTime); + RotationSolverPlugin._rotationConfigWindow?.Collection.DrawItems((int)UiString.TimelineRaidTime); using var table = ImRaii.Table("Rotation Solver List Timeline", 3, ImGuiTableFlags.BordersInner | ImGuiTableFlags.Resizable | ImGuiTableFlags.SizingStretchProp | ImGuiTableFlags.ScrollY); if (table) diff --git a/XIVConfigUI b/XIVConfigUI index c2e50eb8b..93dd6dfc7 160000 --- a/XIVConfigUI +++ b/XIVConfigUI @@ -1 +1 @@ -Subproject commit c2e50eb8bc00c4146591b9ec382d2d6c99d1c45a +Subproject commit 93dd6dfc7bcacd007d869bb7fb0d0485d007fc5a