mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 18:27:24 +01:00
Remove Enabled Config.
This commit is contained in:
parent
eb6e665147
commit
a3583dd5f1
4 changed files with 7 additions and 35 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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<MessageService>();
|
||||
_services.GetRequiredService<StateListener>(); // Initialize State Listener.
|
||||
_services.GetRequiredService<GlamourerWindowSystem>(); // initialize ui.
|
||||
_services.GetRequiredService<CommandService>(); // initialize commands.
|
||||
_services.GetRequiredService<VisorService>();
|
||||
|
|
|
|||
|
|
@ -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"))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
/// <summary> The result of updating the base state of an ActorState. </summary>
|
||||
private enum UpdateState
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue