From 45423c0cc344b65ac4748d8311f63cfeedc30243 Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Sat, 11 May 2024 00:27:33 +0200 Subject: [PATCH] Add code to save dalamud's window options (pinned/clickthrough/alpha) --- Deliveroo/Configuration.cs | 4 ++++ Deliveroo/Deliveroo.csproj | 2 +- Deliveroo/Windows/ConfigWindow.cs | 6 +++++- Deliveroo/Windows/TurnInWindow.cs | 7 +++++-- LLib | 2 +- 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/Deliveroo/Configuration.cs b/Deliveroo/Configuration.cs index 39e22dd..23210df 100644 --- a/Deliveroo/Configuration.cs +++ b/Deliveroo/Configuration.cs @@ -2,6 +2,7 @@ using Dalamud.Configuration; using Dalamud.Game.Text; using Deliveroo.GameData; +using LLib.ImGui; namespace Deliveroo; @@ -21,6 +22,9 @@ internal sealed class Configuration : IPluginConfiguration public bool DisableFrameLimiter { get; set; } = true; public bool UncapFrameRate { get; set; } + public WindowConfig TurnInWindowConfig { get; } = new(); + public WindowConfig ConfigWindowConfig { get; } = new(); + internal sealed class PurchasePriority { public uint ItemId { get; set; } diff --git a/Deliveroo/Deliveroo.csproj b/Deliveroo/Deliveroo.csproj index 33c3e24..dbc6b34 100644 --- a/Deliveroo/Deliveroo.csproj +++ b/Deliveroo/Deliveroo.csproj @@ -1,7 +1,7 @@ net8.0-windows - 4.7 + 4.8 12 enable true diff --git a/Deliveroo/Windows/ConfigWindow.cs b/Deliveroo/Windows/ConfigWindow.cs index 8722d58..c96e133 100644 --- a/Deliveroo/Windows/ConfigWindow.cs +++ b/Deliveroo/Windows/ConfigWindow.cs @@ -17,7 +17,7 @@ using LLib.ImGui; namespace Deliveroo.Windows; -internal sealed class ConfigWindow : LWindow +internal sealed class ConfigWindow : LWindow, IPersistableWindowConfig { private readonly DalamudPluginInterface _pluginInterface; private readonly DeliverooPlugin _plugin; @@ -58,6 +58,8 @@ internal sealed class ConfigWindow : LWindow }; } + public WindowConfig WindowConfig => _configuration.ConfigWindowConfig; + public override void Draw() { if (_configuration.AddVentureIfNoItemToPurchaseSelected()) @@ -425,4 +427,6 @@ internal sealed class ConfigWindow : LWindow private void Save() => _pluginInterface.SavePluginConfig(_configuration); + + public void SaveWindowConfig() => Save(); } diff --git a/Deliveroo/Windows/TurnInWindow.cs b/Deliveroo/Windows/TurnInWindow.cs index 5101401..a4122f2 100644 --- a/Deliveroo/Windows/TurnInWindow.cs +++ b/Deliveroo/Windows/TurnInWindow.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; using System.Numerics; using Dalamud.Game.ClientState.Conditions; -using Dalamud.Game.ClientState.Objects.Enums; using Dalamud.Interface; using Dalamud.Interface.Colors; using Dalamud.Interface.Components; @@ -20,7 +19,7 @@ using LLib.ImGui; namespace Deliveroo.Windows; -internal sealed class TurnInWindow : LWindow +internal sealed class TurnInWindow : LWindow, IPersistableWindowConfig { private static readonly IReadOnlyList InventoryTypes = new[] { @@ -99,6 +98,8 @@ internal sealed class TurnInWindow : LWindow }); } + public WindowConfig WindowConfig => _configuration.TurnInWindowConfig; + public bool State { get => _state; @@ -563,6 +564,8 @@ internal sealed class TurnInWindow : LWindow } } + public void SaveWindowConfig() => _pluginInterface.SavePluginConfig(_configuration); + private interface IItemsToPurchase { string Name { get; } diff --git a/LLib b/LLib index 3792244..b5125d4 160000 --- a/LLib +++ b/LLib @@ -1 +1 @@ -Subproject commit 3792244261a9f5426a7916f5a6dd1966238ba84a +Subproject commit b5125d4b3f7cdc0c7514a01764e5b5d4d85f80a7