Added several settings to control when plugin window is being hidden/shown
This commit is contained in:
@@ -53,8 +53,14 @@ public class PluginConfiguration : IPluginConfiguration, ISavable
|
|||||||
|
|
||||||
public bool FoldersDefaultOpen { get; set; } = true;
|
public bool FoldersDefaultOpen { get; set; } = true;
|
||||||
|
|
||||||
|
public bool OpenWindowAtStart { get; set; } = false;
|
||||||
|
|
||||||
public bool HideWindowInCutscene { get; set; } = true;
|
public bool HideWindowInCutscene { get; set; } = true;
|
||||||
|
|
||||||
|
public bool HideWindowWhenUiHidden { get; set; } = true;
|
||||||
|
|
||||||
|
public bool HideWindowInGPose { get; set; } = false;
|
||||||
|
|
||||||
public bool IncognitoMode { get; set; } = false;
|
public bool IncognitoMode { get; set; } = false;
|
||||||
|
|
||||||
public List<string> ViewedMessageWindows { get; set; } = new();
|
public List<string> ViewedMessageWindows { get; set; } = new();
|
||||||
|
|||||||
@@ -30,8 +30,9 @@ public class CPlusWindowSystem : IDisposable
|
|||||||
_uiBuilder.Draw += OnDraw;
|
_uiBuilder.Draw += OnDraw;
|
||||||
_uiBuilder.OpenConfigUi += _mainWindow.Toggle;
|
_uiBuilder.OpenConfigUi += _mainWindow.Toggle;
|
||||||
|
|
||||||
_uiBuilder.DisableGposeUiHide = true;
|
_uiBuilder.DisableGposeUiHide = !configuration.UISettings.HideWindowInGPose; //seems to be broken as of 2024/10/18
|
||||||
_uiBuilder.DisableCutsceneUiHide = !configuration.UISettings.HideWindowInCutscene;
|
_uiBuilder.DisableCutsceneUiHide = !configuration.UISettings.HideWindowInCutscene;
|
||||||
|
_uiBuilder.DisableUserUiHide = !configuration.UISettings.HideWindowWhenUiHidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDraw()
|
private void OnDraw()
|
||||||
|
|||||||
31
CustomizePlus/UI/UiHelpers.cs
Normal file
31
CustomizePlus/UI/UiHelpers.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
using Dalamud.Interface.Utility;
|
||||||
|
using ImGuiNET;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Numerics;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CustomizePlus.UI;
|
||||||
|
internal class UiHelpers
|
||||||
|
{
|
||||||
|
/// <summary> Vertical spacing between groups. </summary>
|
||||||
|
public static Vector2 DefaultSpace;
|
||||||
|
|
||||||
|
/// <summary> Multiples of the current Global Scale </summary>
|
||||||
|
public static float Scale;
|
||||||
|
|
||||||
|
/// <summary> Draw default vertical space. </summary>
|
||||||
|
public static void DefaultLineSpace()
|
||||||
|
=> ImGui.Dummy(DefaultSpace);
|
||||||
|
|
||||||
|
public static void SetupCommonSizes()
|
||||||
|
{
|
||||||
|
if (ImGuiHelpers.GlobalScale != Scale)
|
||||||
|
{
|
||||||
|
Scale = ImGuiHelpers.GlobalScale;
|
||||||
|
DefaultSpace = new Vector2(0, 10 * Scale);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -78,14 +78,13 @@ public class MainWindow : Window, IDisposable
|
|||||||
|
|
||||||
_templateEditorEvent.Subscribe(OnTemplateEditorEvent, TemplateEditorEvent.Priority.MainWindow);
|
_templateEditorEvent.Subscribe(OnTemplateEditorEvent, TemplateEditorEvent.Priority.MainWindow);
|
||||||
|
|
||||||
pluginInterface.UiBuilder.DisableGposeUiHide = true;
|
|
||||||
SizeConstraints = new WindowSizeConstraints()
|
SizeConstraints = new WindowSizeConstraints()
|
||||||
{
|
{
|
||||||
MinimumSize = new Vector2(700, 675),
|
MinimumSize = new Vector2(700, 675),
|
||||||
MaximumSize = ImGui.GetIO().DisplaySize,
|
MaximumSize = ImGui.GetIO().DisplaySize,
|
||||||
};
|
};
|
||||||
|
|
||||||
IsOpen = pluginInterface.IsDevMenuOpen && configuration.DebuggingModeEnabled;
|
IsOpen = configuration.UISettings.OpenWindowAtStart;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ using CustomizePlus.Templates;
|
|||||||
using CustomizePlus.Core.Helpers;
|
using CustomizePlus.Core.Helpers;
|
||||||
using CustomizePlus.Armatures.Services;
|
using CustomizePlus.Armatures.Services;
|
||||||
using Dalamud.Interface.ImGuiNotification;
|
using Dalamud.Interface.ImGuiNotification;
|
||||||
|
using Dalamud.Plugin;
|
||||||
|
|
||||||
namespace CustomizePlus.UI.Windows.MainWindow.Tabs;
|
namespace CustomizePlus.UI.Windows.MainWindow.Tabs;
|
||||||
|
|
||||||
@@ -21,6 +22,7 @@ public class SettingsTab
|
|||||||
{
|
{
|
||||||
private const uint DiscordColor = 0xFFDA8972;
|
private const uint DiscordColor = 0xFFDA8972;
|
||||||
|
|
||||||
|
private readonly IDalamudPluginInterface _pluginInterface;
|
||||||
private readonly PluginConfiguration _configuration;
|
private readonly PluginConfiguration _configuration;
|
||||||
private readonly ArmatureManager _armatureManager;
|
private readonly ArmatureManager _armatureManager;
|
||||||
private readonly HookingService _hookingService;
|
private readonly HookingService _hookingService;
|
||||||
@@ -30,6 +32,7 @@ public class SettingsTab
|
|||||||
private readonly SupportLogBuilderService _supportLogBuilderService;
|
private readonly SupportLogBuilderService _supportLogBuilderService;
|
||||||
|
|
||||||
public SettingsTab(
|
public SettingsTab(
|
||||||
|
IDalamudPluginInterface pluginInterface,
|
||||||
PluginConfiguration configuration,
|
PluginConfiguration configuration,
|
||||||
ArmatureManager armatureManager,
|
ArmatureManager armatureManager,
|
||||||
HookingService hookingService,
|
HookingService hookingService,
|
||||||
@@ -38,6 +41,7 @@ public class SettingsTab
|
|||||||
MessageService messageService,
|
MessageService messageService,
|
||||||
SupportLogBuilderService supportLogBuilderService)
|
SupportLogBuilderService supportLogBuilderService)
|
||||||
{
|
{
|
||||||
|
_pluginInterface = pluginInterface;
|
||||||
_configuration = configuration;
|
_configuration = configuration;
|
||||||
_armatureManager = armatureManager;
|
_armatureManager = armatureManager;
|
||||||
_hookingService = hookingService;
|
_hookingService = hookingService;
|
||||||
@@ -49,6 +53,7 @@ public class SettingsTab
|
|||||||
|
|
||||||
public void Draw()
|
public void Draw()
|
||||||
{
|
{
|
||||||
|
UiHelpers.SetupCommonSizes();
|
||||||
using var child = ImRaii.Child("MainWindowChild");
|
using var child = ImRaii.Child("MainWindowChild");
|
||||||
if (!child)
|
if (!child)
|
||||||
return;
|
return;
|
||||||
@@ -209,16 +214,40 @@ public class SettingsTab
|
|||||||
if (!isShouldDraw)
|
if (!isShouldDraw)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
DrawOpenWindowAtStart();
|
||||||
DrawHideWindowInCutscene();
|
DrawHideWindowInCutscene();
|
||||||
|
DrawHideWindowWhenUiHidden();
|
||||||
|
DrawHideWindowInGPose();
|
||||||
|
|
||||||
|
UiHelpers.DefaultLineSpace();
|
||||||
|
|
||||||
DrawFoldersDefaultOpen();
|
DrawFoldersDefaultOpen();
|
||||||
|
|
||||||
|
UiHelpers.DefaultLineSpace();
|
||||||
|
|
||||||
DrawSetPreviewToCurrentCharacterOnLogin();
|
DrawSetPreviewToCurrentCharacterOnLogin();
|
||||||
|
|
||||||
|
UiHelpers.DefaultLineSpace();
|
||||||
|
|
||||||
if (Widget.DoubleModifierSelector("Template Deletion Modifier",
|
if (Widget.DoubleModifierSelector("Template Deletion Modifier",
|
||||||
"A modifier you need to hold while clicking the Delete Template button for it to take effect.", 100 * ImGuiHelpers.GlobalScale,
|
"A modifier you need to hold while clicking the Delete Template button for it to take effect.", 100 * ImGuiHelpers.GlobalScale,
|
||||||
_configuration.UISettings.DeleteTemplateModifier, v => _configuration.UISettings.DeleteTemplateModifier = v))
|
_configuration.UISettings.DeleteTemplateModifier, v => _configuration.UISettings.DeleteTemplateModifier = v))
|
||||||
_configuration.Save();
|
_configuration.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DrawOpenWindowAtStart()
|
||||||
|
{
|
||||||
|
var isChecked = _configuration.UISettings.OpenWindowAtStart;
|
||||||
|
|
||||||
|
if (CtrlHelper.CheckboxWithTextAndHelp("##openwindowatstart", "Open Customize+ Window at Game Start",
|
||||||
|
"Controls whether main Customize+ window will be opened when you launch the game or not.", ref isChecked))
|
||||||
|
{
|
||||||
|
_configuration.UISettings.OpenWindowAtStart = isChecked;
|
||||||
|
|
||||||
|
_configuration.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void DrawHideWindowInCutscene()
|
private void DrawHideWindowInCutscene()
|
||||||
{
|
{
|
||||||
var isChecked = _configuration.UISettings.HideWindowInCutscene;
|
var isChecked = _configuration.UISettings.HideWindowInCutscene;
|
||||||
@@ -226,7 +255,35 @@ public class SettingsTab
|
|||||||
if (CtrlHelper.CheckboxWithTextAndHelp("##hidewindowincutscene", "Hide Plugin Windows in Cutscenes",
|
if (CtrlHelper.CheckboxWithTextAndHelp("##hidewindowincutscene", "Hide Plugin Windows in Cutscenes",
|
||||||
"Controls whether any Customize+ windows are hidden during cutscenes or not.", ref isChecked))
|
"Controls whether any Customize+ windows are hidden during cutscenes or not.", ref isChecked))
|
||||||
{
|
{
|
||||||
|
_pluginInterface.UiBuilder.DisableCutsceneUiHide = !isChecked;
|
||||||
_configuration.UISettings.HideWindowInCutscene = isChecked;
|
_configuration.UISettings.HideWindowInCutscene = isChecked;
|
||||||
|
|
||||||
|
_configuration.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawHideWindowWhenUiHidden()
|
||||||
|
{
|
||||||
|
var isChecked = _configuration.UISettings.HideWindowWhenUiHidden;
|
||||||
|
|
||||||
|
if (CtrlHelper.CheckboxWithTextAndHelp("##hidewindowwhenuihidden", "Hide Plugin Windows when UI is Hidden",
|
||||||
|
"Controls whether any Customize+ windows are hidden when you manually hide the in-game user interface.", ref isChecked))
|
||||||
|
{
|
||||||
|
_pluginInterface.UiBuilder.DisableUserUiHide = !isChecked;
|
||||||
|
_configuration.UISettings.HideWindowWhenUiHidden = isChecked;
|
||||||
|
_configuration.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawHideWindowInGPose()
|
||||||
|
{
|
||||||
|
var isChecked = _configuration.UISettings.HideWindowInGPose;
|
||||||
|
|
||||||
|
if (CtrlHelper.CheckboxWithTextAndHelp("##hidewindowingpose", "Hide Plugin Windows in GPose",
|
||||||
|
"Controls whether any Customize+ windows are hidden when you enter GPose.", ref isChecked))
|
||||||
|
{
|
||||||
|
_pluginInterface.UiBuilder.DisableGposeUiHide = !isChecked;
|
||||||
|
_configuration.UISettings.HideWindowInGPose = isChecked;
|
||||||
_configuration.Save();
|
_configuration.Save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user