feat: add config setting to toggle hiding

This commit is contained in:
goat 2020-08-14 03:01:58 +02:00
parent 5f9efaaea0
commit 196217f1d5
5 changed files with 18 additions and 14 deletions

View file

@ -42,6 +42,7 @@ namespace Dalamud
public bool DoDalamudTest { get; set; } = false;
public float GlobalUiScale { get; set; } = 1.0f;
public bool ToggleUiHide { get; set; } = true;
[JsonIgnore]
public string ConfigPath;

View file

@ -374,6 +374,9 @@ namespace Dalamud {
ImGui.EndMenu();
}
if (this.Framework.Gui.GameUiHidden)
ImGui.BeginMenu("UI is hidden...", false);
ImGui.EndMainMenuBar();
}
}

View file

@ -1,23 +1,13 @@
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Net.Mime;
using System.Numerics;
using CheapLoc;
using Dalamud.Game.Chat;
using Dalamud.Game.ClientState.Actors.Types;
using Dalamud.Game.ClientState.Actors.Types.NonPlayer;
using Dalamud.Plugin;
using ImGuiNET;
using JetBrains.Annotations;
using Newtonsoft.Json;
using Serilog;
using SharpDX.Direct3D11;
namespace Dalamud.Interface
{
class DalamudSettingsWindow {
internal class DalamudSettingsWindow {
private readonly Dalamud dalamud;
public DalamudSettingsWindow(Dalamud dalamud) {
@ -30,6 +20,7 @@ namespace Dalamud.Interface
this.doCfChatMessage = this.dalamud.Configuration.DutyFinderChatMessage;
this.globalUiScale = this.dalamud.Configuration.GlobalUiScale;
this.doToggleUiHide = this.dalamud.Configuration.ToggleUiHide;
this.doPluginTest = this.dalamud.Configuration.DoPluginTest;
this.doDalamudTest = this.dalamud.Configuration.DoDalamudTest;
@ -53,6 +44,7 @@ namespace Dalamud.Interface
private const float MinScale = 0.3f;
private const float MaxScale = 2.0f;
private float globalUiScale;
private bool doToggleUiHide;
#region Experimental
@ -105,6 +97,11 @@ namespace Dalamud.Interface
ImGui.TextColored(this.hintTextColor, Loc.Localize("DalamudSettingsGlobalUiScaleHint", "Scale all XIVLauncher UI elements - useful for 4K displays."));
ImGui.Dummy(new Vector2(10f, 10f));
ImGui.Checkbox(Loc.Localize("DalamudSettingToggleUiHide", "Hide plugin UI when the game UI is hidden"), ref this.doToggleUiHide);
ImGui.TextColored(this.hintTextColor, Loc.Localize("DalamudSettingToggleUiHideHint", "Check this box to hide any open windows by plugins when toggling the game overlay."));
ImGui.EndTabItem();
}
@ -152,6 +149,7 @@ namespace Dalamud.Interface
this.dalamud.Configuration.DutyFinderChatMessage = this.doCfChatMessage;
this.dalamud.Configuration.GlobalUiScale = this.globalUiScale;
this.dalamud.Configuration.ToggleUiHide = this.doToggleUiHide;
this.dalamud.Configuration.DoPluginTest = this.doPluginTest;
this.dalamud.Configuration.DoDalamudTest = this.doDalamudTest;

View file

@ -40,6 +40,7 @@ namespace Dalamud.Interface
private readonly InterfaceManager interfaceManager;
private readonly GameGui gameGui;
private readonly DalamudConfiguration config;
#if DEBUG
internal static bool DoStats { get; set; } = true;
#else
@ -55,11 +56,12 @@ namespace Dalamud.Interface
/// </summary>
/// <param name="interfaceManager">The interface manager to register on.</param>
/// <param name="namespaceName">The plugin namespace.</param>
internal UiBuilder(InterfaceManager interfaceManager, GameGui gameGui, string namespaceName) {
internal UiBuilder(InterfaceManager interfaceManager, GameGui gameGui, DalamudConfiguration config, string namespaceName) {
this.namespaceName = namespaceName;
this.interfaceManager = interfaceManager;
this.gameGui = gameGui;
this.config = config;
this.interfaceManager.OnDraw += OnDraw;
this.stopwatch = new System.Diagnostics.Stopwatch();
}
@ -128,7 +130,7 @@ namespace Dalamud.Interface
private void OnDraw() {
if (this.gameGui.GameUiHidden && !DisableAutomaticUiHide)
if (this.gameGui.GameUiHidden && this.config.ToggleUiHide && !DisableAutomaticUiHide)
return;
ImGui.PushID(this.namespaceName);

View file

@ -75,7 +75,7 @@ namespace Dalamud.Plugin
this.CommandManager = dalamud.CommandManager;
this.Framework = dalamud.Framework;
this.ClientState = dalamud.ClientState;
this.UiBuilder = new UiBuilder(dalamud.InterfaceManager, dalamud.Framework.Gui, pluginName);
this.UiBuilder = new UiBuilder(dalamud.InterfaceManager, dalamud.Framework.Gui, dalamud.Configuration, pluginName);
this.TargetModuleScanner = dalamud.SigScanner;
this.Data = dalamud.Data;
this.SeStringManager = dalamud.SeStringManager;