mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-15 13:14:17 +01:00
Add check for Palette+.
This commit is contained in:
parent
78a77eb6c4
commit
5a30107d78
3 changed files with 52 additions and 12 deletions
|
|
@ -28,7 +28,8 @@ public class SettingsTab(
|
||||||
FunModule funModule,
|
FunModule funModule,
|
||||||
IKeyState keys,
|
IKeyState keys,
|
||||||
DesignColorUi designColorUi,
|
DesignColorUi designColorUi,
|
||||||
PaletteImport paletteImport)
|
PaletteImport paletteImport,
|
||||||
|
PalettePlusChecker paletteChecker)
|
||||||
: ITab
|
: ITab
|
||||||
{
|
{
|
||||||
private readonly VirtualKey[] _validKeys = keys.GetValidVirtualKeys().Prepend(VirtualKey.NO_KEY).ToArray();
|
private readonly VirtualKey[] _validKeys = keys.GetValidVirtualKeys().Prepend(VirtualKey.NO_KEY).ToArray();
|
||||||
|
|
@ -84,7 +85,7 @@ public class SettingsTab(
|
||||||
config.RevertManualChangesOnZoneChange, v => config.RevertManualChangesOnZoneChange = v);
|
config.RevertManualChangesOnZoneChange, v => config.RevertManualChangesOnZoneChange = v);
|
||||||
Checkbox("Enable Advanced Customization Options",
|
Checkbox("Enable Advanced Customization Options",
|
||||||
"Enable the display and editing of advanced customization options like arbitrary colors.",
|
"Enable the display and editing of advanced customization options like arbitrary colors.",
|
||||||
config.UseAdvancedParameters, v => config.UseAdvancedParameters = v);
|
config.UseAdvancedParameters, paletteChecker.SetAdvancedParameters);
|
||||||
PaletteImportButton();
|
PaletteImportButton();
|
||||||
ImGui.NewLine();
|
ImGui.NewLine();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -164,14 +164,4 @@ public class PaletteImport(DalamudPluginInterface pluginInterface, DesignManager
|
||||||
Glamourer.Log.Error($"Could not read Palette+ configuration:\n{ex}");
|
Glamourer.Log.Error($"Could not read Palette+ configuration:\n{ex}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryRead(string name, ref CustomizeParameterData data)
|
|
||||||
{
|
|
||||||
if (!Data.TryGetValue(name, out var t))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
foreach (var flag in t.Item2.Iterate())
|
|
||||||
data[flag] = t.Item1[flag];
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
49
Glamourer/Interop/PalettePlus/PalettePlusChecker.cs
Normal file
49
Glamourer/Interop/PalettePlus/PalettePlusChecker.cs
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
using Dalamud.Interface.Internal.Notifications;
|
||||||
|
using Dalamud.Plugin;
|
||||||
|
using OtterGui.Classes;
|
||||||
|
using OtterGui.Services;
|
||||||
|
|
||||||
|
namespace Glamourer.Interop.PalettePlus;
|
||||||
|
|
||||||
|
public sealed class PalettePlusChecker : IRequiredService, IDisposable
|
||||||
|
{
|
||||||
|
private readonly Timer _paletteTimer;
|
||||||
|
private readonly Configuration _config;
|
||||||
|
private readonly DalamudPluginInterface _pluginInterface;
|
||||||
|
|
||||||
|
public PalettePlusChecker(Configuration config, DalamudPluginInterface pluginInterface)
|
||||||
|
{
|
||||||
|
_config = config;
|
||||||
|
_pluginInterface = pluginInterface;
|
||||||
|
_paletteTimer = new Timer(_ => PalettePlusCheck(), null, TimeSpan.FromSeconds(30), Timeout.InfiniteTimeSpan);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
=> _paletteTimer.Dispose();
|
||||||
|
|
||||||
|
public void SetAdvancedParameters(bool value)
|
||||||
|
{
|
||||||
|
_config.UseAdvancedParameters = value;
|
||||||
|
PalettePlusCheck();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PalettePlusCheck()
|
||||||
|
{
|
||||||
|
if (!_config.UseAdvancedParameters)
|
||||||
|
return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var subscriber = _pluginInterface.GetIpcSubscriber<string>("PalettePlus.ApiVersion");
|
||||||
|
subscriber.InvokeFunc();
|
||||||
|
Glamourer.Messager.AddMessage(new Notification(
|
||||||
|
"You currently have Palette+ installed. This conflicts with Glamourers advanced options and will cause invalid state.\n\n"
|
||||||
|
+ "Please uninstall Palette+ and restart your game. Palette+ is deprecated and no longer supported by Mare Synchronos.",
|
||||||
|
NotificationType.Warning, 10000));
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue