From b82cb7b4627d0bef34ba6a71b7c2df2c9fea0cb6 Mon Sep 17 00:00:00 2001 From: Anna Date: Sun, 6 Feb 2022 03:45:16 -0500 Subject: [PATCH] feat: add option to hide when not logged in --- ChatTwo/Configuration.cs | 2 ++ ChatTwo/Resources/Language.Designer.cs | 18 ++++++++++++++++++ ChatTwo/Resources/Language.resx | 6 ++++++ ChatTwo/Ui/ChatLog.cs | 4 ++++ ChatTwo/Ui/SettingsTabs/Display.cs | 3 +++ 5 files changed, 33 insertions(+) diff --git a/ChatTwo/Configuration.cs b/ChatTwo/Configuration.cs index 65f3434..d23bcbf 100755 --- a/ChatTwo/Configuration.cs +++ b/ChatTwo/Configuration.cs @@ -14,6 +14,7 @@ internal class Configuration : IPluginConfiguration { public bool HideChat = true; public bool HideDuringCutscenes = true; + public bool HideWhenNotLoggedIn = true; public bool NativeItemTooltips = true; public bool PrettierTimestamps = true; public bool MoreCompactPretty; @@ -36,6 +37,7 @@ internal class Configuration : IPluginConfiguration { internal void UpdateFrom(Configuration other) { this.HideChat = other.HideChat; this.HideDuringCutscenes = other.HideDuringCutscenes; + this.HideWhenNotLoggedIn = other.HideWhenNotLoggedIn; this.NativeItemTooltips = other.NativeItemTooltips; this.PrettierTimestamps = other.PrettierTimestamps; this.MoreCompactPretty = other.MoreCompactPretty; diff --git a/ChatTwo/Resources/Language.Designer.cs b/ChatTwo/Resources/Language.Designer.cs index a1680b9..f1a04ca 100755 --- a/ChatTwo/Resources/Language.Designer.cs +++ b/ChatTwo/Resources/Language.Designer.cs @@ -357,6 +357,24 @@ namespace ChatTwo.Resources { } } + /// + /// Looks up a localized string similar to Hide the chat when you are not logged in to a character.. + /// + internal static string Options_HideWhenNotLoggedIn_Description { + get { + return ResourceManager.GetString("Options_HideWhenNotLoggedIn_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Hide when not logged in. + /// + internal static string Options_HideWhenNotLoggedIn_Name { + get { + return ResourceManager.GetString("Options_HideWhenNotLoggedIn_Name", resourceCulture); + } + } + /// /// Looks up a localized string similar to The font Chat 2 will use to display Japanese text.. /// diff --git a/ChatTwo/Resources/Language.resx b/ChatTwo/Resources/Language.resx index 06305be..77fca28 100755 --- a/ChatTwo/Resources/Language.resx +++ b/ChatTwo/Resources/Language.resx @@ -353,4 +353,10 @@ Delete tab + + Hide when not logged in + + + Hide the chat when you are not logged in to a character. + diff --git a/ChatTwo/Ui/ChatLog.cs b/ChatTwo/Ui/ChatLog.cs index db64f66..954f292 100755 --- a/ChatTwo/Ui/ChatLog.cs +++ b/ChatTwo/Ui/ChatLog.cs @@ -296,6 +296,10 @@ internal sealed class ChatLog : IUiComponent { return; } + if (this.Ui.Plugin.Config.HideWhenNotLoggedIn && !this.Ui.Plugin.ClientState.IsLoggedIn) { + return; + } + var flags = ImGuiWindowFlags.None; if (!this.Ui.Plugin.Config.CanMove) { flags |= ImGuiWindowFlags.NoMove; diff --git a/ChatTwo/Ui/SettingsTabs/Display.cs b/ChatTwo/Ui/SettingsTabs/Display.cs index ff4c618..eba5aa1 100755 --- a/ChatTwo/Ui/SettingsTabs/Display.cs +++ b/ChatTwo/Ui/SettingsTabs/Display.cs @@ -22,6 +22,9 @@ internal sealed class Display : ISettingsTab { ImGuiUtil.OptionCheckbox(ref this.Mutable.HideDuringCutscenes, Language.Options_HideDuringCutscenes_Name, Language.Options_HideDuringCutscenes_Description); ImGui.Spacing(); + ImGuiUtil.OptionCheckbox(ref this.Mutable.HideWhenNotLoggedIn, Language.Options_HideWhenNotLoggedIn_Name, Language.Options_HideWhenNotLoggedIn_Description); + ImGui.Spacing(); + ImGuiUtil.OptionCheckbox(ref this.Mutable.NativeItemTooltips, Language.Options_NativeItemTooltips_Name, Language.Options_NativeItemTooltips_Description); ImGui.Spacing();