diff --git a/Glamourer/Configuration.cs b/Glamourer/Configuration.cs index 8c3b21d..ff4eb45 100644 --- a/Glamourer/Configuration.cs +++ b/Glamourer/Configuration.cs @@ -19,7 +19,6 @@ namespace Glamourer; public class Configuration : IPluginConfiguration, ISavable { - public bool Enabled { get; set; } = true; public bool UseRestrictedGearProtection { get; set; } = false; public bool OpenFoldersByDefault { get; set; } = false; public bool AutoRedrawEquipOnChanges { get; set; } = false; diff --git a/Glamourer/Glamourer.cs b/Glamourer/Glamourer.cs index 31942da..2ac26ce 100644 --- a/Glamourer/Glamourer.cs +++ b/Glamourer/Glamourer.cs @@ -3,6 +3,7 @@ using Dalamud.Plugin; using Glamourer.Gui; using Glamourer.Interop; using Glamourer.Services; +using Glamourer.State; using Microsoft.Extensions.DependencyInjection; using OtterGui.Classes; using OtterGui.Log; @@ -31,6 +32,7 @@ public class Glamourer : IDalamudPlugin { _services = ServiceManager.CreateProvider(pluginInterface, Log); Messager = _services.GetRequiredService(); + _services.GetRequiredService(); // Initialize State Listener. _services.GetRequiredService(); // initialize ui. _services.GetRequiredService(); // initialize commands. _services.GetRequiredService(); diff --git a/Glamourer/Gui/Tabs/SettingsTab.cs b/Glamourer/Gui/Tabs/SettingsTab.cs index 142b48b..7b86912 100644 --- a/Glamourer/Gui/Tabs/SettingsTab.cs +++ b/Glamourer/Gui/Tabs/SettingsTab.cs @@ -24,7 +24,6 @@ public class SettingsTab : ITab private readonly VirtualKey[] _validKeys; private readonly Configuration _config; private readonly DesignFileSystemSelector _selector; - private readonly StateListener _stateListener; private readonly CodeService _codeService; private readonly PenumbraAutoRedraw _autoRedraw; private readonly ContextMenuService _contextMenuService; @@ -32,13 +31,11 @@ public class SettingsTab : ITab private readonly GlamourerChangelog _changelog; private readonly FunModule _funModule; - public SettingsTab(Configuration config, DesignFileSystemSelector selector, StateListener stateListener, - CodeService codeService, PenumbraAutoRedraw autoRedraw, ContextMenuService contextMenuService, UiBuilder uiBuilder, - GlamourerChangelog changelog, FunModule funModule, IKeyState keys) + public SettingsTab(Configuration config, DesignFileSystemSelector selector, CodeService codeService, PenumbraAutoRedraw autoRedraw, + ContextMenuService contextMenuService, UiBuilder uiBuilder, GlamourerChangelog changelog, FunModule funModule, IKeyState keys) { _config = config; _selector = selector; - _stateListener = stateListener; _codeService = codeService; _autoRedraw = autoRedraw; _contextMenuService = contextMenuService; @@ -59,11 +56,11 @@ public class SettingsTab : ITab if (!child) return; - Checkbox("Enabled", "Enable main functionality of keeping and applying state.", _stateListener.Enabled, _stateListener.Enable); Checkbox("Enable Auto Designs", "Enable the application of designs associated to characters to be applied automatically.", _config.EnableAutoDesigns, v => _config.EnableAutoDesigns = v); ImGui.NewLine(); ImGui.NewLine(); + ImGui.NewLine(); using (var child2 = ImRaii.Child("SettingsChild")) { diff --git a/Glamourer/State/StateListener.cs b/Glamourer/State/StateListener.cs index 791a0f8..3fdf4f7 100644 --- a/Glamourer/State/StateListener.cs +++ b/Glamourer/State/StateListener.cs @@ -13,7 +13,6 @@ using Penumbra.GameData.Structs; using System; using Dalamud.Game.ClientState.Conditions; using Dalamud.Plugin.Services; -using Glamourer.Structs; namespace Glamourer.State; @@ -49,12 +48,6 @@ public class StateListener : IDisposable private ActorState? _creatingState; private CharacterWeapon _lastFistOffhand = CharacterWeapon.Empty; - public bool Enabled - { - get => _config.Enabled; - set => Enable(value); - } - public StateListener(StateManager manager, ItemManager items, PenumbraService penumbra, ActorService actors, Configuration config, SlotUpdating slotUpdating, WeaponLoading weaponLoading, VisorStateChanged visorState, WeaponVisibilityChanged weaponVisibility, HeadGearVisibilityChanged headGearVisibility, AutoDesignApplier autoDesignApplier, FunModule funModule, HumanModelList humans, @@ -81,30 +74,11 @@ public class StateListener : IDisposable _changeCustomizeService = changeCustomizeService; _customizations = customizations; _condition = condition; - - if (Enabled) - Subscribe(); - } - - public void Enable(bool value) - { - if (value == Enabled) - return; - - _config.Enabled = value; - _config.Save(); - - if (value) - Subscribe(); - else - Unsubscribe(); + Subscribe(); } void IDisposable.Dispose() - { - if (Enabled) - Unsubscribe(); - } + => Unsubscribe(); /// The result of updating the base state of an ActorState. private enum UpdateState