From 598901d2f9cefb7d297fc5c8fcfe6739e329287d Mon Sep 17 00:00:00 2001 From: Anna Clemens Date: Mon, 7 Feb 2022 14:44:19 -0500 Subject: [PATCH] feat: add option to hide when game ui is hidden --- ChatTwo/Configuration.cs | 2 ++ ChatTwo/PluginUi.cs | 3 +-- ChatTwo/Resources/Language.Designer.cs | 18 ++++++++++++++++++ ChatTwo/Resources/Language.resx | 6 ++++++ ChatTwo/Ui/SettingsTabs/Display.cs | 7 +++++++ 5 files changed, 34 insertions(+), 2 deletions(-) diff --git a/ChatTwo/Configuration.cs b/ChatTwo/Configuration.cs index dbb0eee..9c7bf65 100755 --- a/ChatTwo/Configuration.cs +++ b/ChatTwo/Configuration.cs @@ -15,6 +15,7 @@ internal class Configuration : IPluginConfiguration { public bool HideChat = true; public bool HideDuringCutscenes = true; public bool HideWhenNotLoggedIn = true; + public bool HideWhenUiHidden = true; public bool NativeItemTooltips = true; public bool PrettierTimestamps = true; public bool MoreCompactPretty; @@ -39,6 +40,7 @@ internal class Configuration : IPluginConfiguration { this.HideChat = other.HideChat; this.HideDuringCutscenes = other.HideDuringCutscenes; this.HideWhenNotLoggedIn = other.HideWhenNotLoggedIn; + this.HideWhenUiHidden = other.HideWhenUiHidden; this.NativeItemTooltips = other.NativeItemTooltips; this.PrettierTimestamps = other.PrettierTimestamps; this.MoreCompactPretty = other.MoreCompactPretty; diff --git a/ChatTwo/PluginUi.cs b/ChatTwo/PluginUi.cs index da4bf5c..9428949 100755 --- a/ChatTwo/PluginUi.cs +++ b/ChatTwo/PluginUi.cs @@ -88,10 +88,8 @@ internal sealed class PluginUi : IDisposable { ); var uiBuilder = this.Plugin.Interface.UiBuilder; - uiBuilder.DisableAutomaticUiHide = true; uiBuilder.DisableCutsceneUiHide = true; uiBuilder.DisableGposeUiHide = true; - uiBuilder.DisableUserUiHide = true; uiBuilder.BuildFonts += this.BuildFonts; uiBuilder.Draw += this.Draw; @@ -117,6 +115,7 @@ internal sealed class PluginUi : IDisposable { } private void Draw() { + this.Plugin.Interface.UiBuilder.DisableUserUiHide = !this.Plugin.Config.HideWhenUiHidden; this.DefaultText = ImGui.GetStyle().Colors[(int) ImGuiCol.Text]; var font = this.RegularFont.HasValue; diff --git a/ChatTwo/Resources/Language.Designer.cs b/ChatTwo/Resources/Language.Designer.cs index 0794a83..58f27a6 100755 --- a/ChatTwo/Resources/Language.Designer.cs +++ b/ChatTwo/Resources/Language.Designer.cs @@ -465,6 +465,24 @@ namespace ChatTwo.Resources { } } + /// + /// Looks up a localized string similar to Hide {0} when the game UI is hidden.. + /// + internal static string Options_HideWhenUiHidden_Description { + get { + return ResourceManager.GetString("Options_HideWhenUiHidden_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Hide when game UI is hidden. + /// + internal static string Options_HideWhenUiHidden_Name { + get { + return ResourceManager.GetString("Options_HideWhenUiHidden_Name", resourceCulture); + } + } + /// /// Looks up a localized string similar to The font {0} will use to display Japanese text.. /// diff --git a/ChatTwo/Resources/Language.resx b/ChatTwo/Resources/Language.resx index 30bf28d..15b8bdb 100755 --- a/ChatTwo/Resources/Language.resx +++ b/ChatTwo/Resources/Language.resx @@ -401,4 +401,10 @@ The side of {0} to display help for commands on. + + Hide when game UI is hidden + + + Hide {0} when the game UI is hidden. + diff --git a/ChatTwo/Ui/SettingsTabs/Display.cs b/ChatTwo/Ui/SettingsTabs/Display.cs index f104397..5ab533f 100755 --- a/ChatTwo/Ui/SettingsTabs/Display.cs +++ b/ChatTwo/Ui/SettingsTabs/Display.cs @@ -33,6 +33,13 @@ internal sealed class Display : ISettingsTab { ); ImGui.Spacing(); + ImGuiUtil.OptionCheckbox( + ref this.Mutable.HideWhenUiHidden, + Language.Options_HideWhenUiHidden_Name, + string.Format(Language.Options_HideWhenUiHidden_Description, Plugin.PluginName) + ); + ImGui.Spacing(); + ImGuiUtil.OptionCheckbox( ref this.Mutable.NativeItemTooltips, Language.Options_NativeItemTooltips_Name,