Add code to save dalamud's window options (pinned/clickthrough/alpha)

This commit is contained in:
Liza 2024-05-11 00:27:33 +02:00
parent 6a76b259bb
commit 45423c0cc3
Signed by: liza
GPG Key ID: 7199F8D727D55F67
5 changed files with 16 additions and 5 deletions

View File

@ -2,6 +2,7 @@
using Dalamud.Configuration; using Dalamud.Configuration;
using Dalamud.Game.Text; using Dalamud.Game.Text;
using Deliveroo.GameData; using Deliveroo.GameData;
using LLib.ImGui;
namespace Deliveroo; namespace Deliveroo;
@ -21,6 +22,9 @@ internal sealed class Configuration : IPluginConfiguration
public bool DisableFrameLimiter { get; set; } = true; public bool DisableFrameLimiter { get; set; } = true;
public bool UncapFrameRate { get; set; } public bool UncapFrameRate { get; set; }
public WindowConfig TurnInWindowConfig { get; } = new();
public WindowConfig ConfigWindowConfig { get; } = new();
internal sealed class PurchasePriority internal sealed class PurchasePriority
{ {
public uint ItemId { get; set; } public uint ItemId { get; set; }

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework> <TargetFramework>net8.0-windows</TargetFramework>
<Version>4.7</Version> <Version>4.8</Version>
<LangVersion>12</LangVersion> <LangVersion>12</LangVersion>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>

View File

@ -17,7 +17,7 @@ using LLib.ImGui;
namespace Deliveroo.Windows; namespace Deliveroo.Windows;
internal sealed class ConfigWindow : LWindow internal sealed class ConfigWindow : LWindow, IPersistableWindowConfig
{ {
private readonly DalamudPluginInterface _pluginInterface; private readonly DalamudPluginInterface _pluginInterface;
private readonly DeliverooPlugin _plugin; private readonly DeliverooPlugin _plugin;
@ -58,6 +58,8 @@ internal sealed class ConfigWindow : LWindow
}; };
} }
public WindowConfig WindowConfig => _configuration.ConfigWindowConfig;
public override void Draw() public override void Draw()
{ {
if (_configuration.AddVentureIfNoItemToPurchaseSelected()) if (_configuration.AddVentureIfNoItemToPurchaseSelected())
@ -425,4 +427,6 @@ internal sealed class ConfigWindow : LWindow
private void Save() => _pluginInterface.SavePluginConfig(_configuration); private void Save() => _pluginInterface.SavePluginConfig(_configuration);
public void SaveWindowConfig() => Save();
} }

View File

@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Numerics; using System.Numerics;
using Dalamud.Game.ClientState.Conditions; using Dalamud.Game.ClientState.Conditions;
using Dalamud.Game.ClientState.Objects.Enums;
using Dalamud.Interface; using Dalamud.Interface;
using Dalamud.Interface.Colors; using Dalamud.Interface.Colors;
using Dalamud.Interface.Components; using Dalamud.Interface.Components;
@ -20,7 +19,7 @@ using LLib.ImGui;
namespace Deliveroo.Windows; namespace Deliveroo.Windows;
internal sealed class TurnInWindow : LWindow internal sealed class TurnInWindow : LWindow, IPersistableWindowConfig
{ {
private static readonly IReadOnlyList<InventoryType> InventoryTypes = new[] private static readonly IReadOnlyList<InventoryType> InventoryTypes = new[]
{ {
@ -99,6 +98,8 @@ internal sealed class TurnInWindow : LWindow
}); });
} }
public WindowConfig WindowConfig => _configuration.TurnInWindowConfig;
public bool State public bool State
{ {
get => _state; get => _state;
@ -563,6 +564,8 @@ internal sealed class TurnInWindow : LWindow
} }
} }
public void SaveWindowConfig() => _pluginInterface.SavePluginConfig(_configuration);
private interface IItemsToPurchase private interface IItemsToPurchase
{ {
string Name { get; } string Name { get; }

2
LLib

@ -1 +1 @@
Subproject commit 3792244261a9f5426a7916f5a6dd1966238ba84a Subproject commit b5125d4b3f7cdc0c7514a01764e5b5d4d85f80a7