From fdd2855b6078267f9c2e391467b845a3fac5d15e Mon Sep 17 00:00:00 2001 From: SitiSchu Date: Sun, 17 Aug 2025 01:41:09 +0200 Subject: [PATCH] Add option to hide when the NG+ menu is open Fixes #147 --- ChatTwo/Configuration.cs | 4 ++++ ChatTwo/Resources/Language.Designer.cs | 18 ++++++++++++++++++ ChatTwo/Resources/Language.resx | 6 ++++++ ChatTwo/Ui/ChatLogWindow.cs | 12 ++++++++++-- ChatTwo/Ui/Popout.cs | 13 +++++++++++-- ChatTwo/Ui/SettingsTabs/Display.cs | 3 +++ ChatTwo/Ui/SettingsTabs/Tabs.cs | 3 +++ 7 files changed, 55 insertions(+), 4 deletions(-) diff --git a/ChatTwo/Configuration.cs b/ChatTwo/Configuration.cs index 78c46060..4584130d 100755 --- a/ChatTwo/Configuration.cs +++ b/ChatTwo/Configuration.cs @@ -44,6 +44,7 @@ internal class Configuration : IPluginConfiguration public bool HideWhenUiHidden = true; public bool HideInLoadingScreens; public bool HideInBattle; + public bool HideInNewGamePlusMenu; public bool HideWhenInactive; public int InactivityHideTimeout = 10; public bool InactivityHideActiveDuringBattle = true; @@ -135,6 +136,7 @@ internal void UpdateFrom(Configuration other, bool backToOriginal) HideWhenUiHidden = other.HideWhenUiHidden; HideInLoadingScreens = other.HideInLoadingScreens; HideInBattle = other.HideInBattle; + HideInNewGamePlusMenu = other.HideInNewGamePlusMenu; HideWhenInactive = other.HideWhenInactive; InactivityHideTimeout = other.InactivityHideTimeout; InactivityHideActiveDuringBattle = other.InactivityHideActiveDuringBattle; @@ -248,6 +250,7 @@ internal class Tab public bool HideWhenUiHidden = true; public bool HideInLoadingScreens; public bool HideInBattle; + public bool HideInNewGamePlusMenu; public bool HideWhenInactive; [NonSerialized] public uint Unread; @@ -301,6 +304,7 @@ internal Tab Clone() HideWhenUiHidden = HideWhenUiHidden, HideInLoadingScreens = HideInLoadingScreens, HideInBattle = HideInBattle, + HideInNewGamePlusMenu = HideInNewGamePlusMenu, HideWhenInactive = HideWhenInactive, }; } diff --git a/ChatTwo/Resources/Language.Designer.cs b/ChatTwo/Resources/Language.Designer.cs index cebe6dcd..8f62b56d 100755 --- a/ChatTwo/Resources/Language.Designer.cs +++ b/ChatTwo/Resources/Language.Designer.cs @@ -2497,6 +2497,24 @@ internal static string Options_HideInBattle_Name { return ResourceManager.GetString("Options_HideInBattle_Name", resourceCulture); } } + + /// + /// Looks up a localized string similar to Hide Chat 2 when the New Game+ menu is open. + /// + internal static string Options_HideInNewGamePlusMenu_Description { + get { + return ResourceManager.GetString("Options_HideInNewGamePlusMenu_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Hide when New Game+ is open. + /// + internal static string Options_HideInNewGamePlusMenu_Name { + get { + return ResourceManager.GetString("Options_HideInNewGamePlusMenu_Name", resourceCulture); + } + } /// /// Looks up a localized string similar to Hide {0} during loading screens.. diff --git a/ChatTwo/Resources/Language.resx b/ChatTwo/Resources/Language.resx index fdaf26ca..b8c3b542 100644 --- a/ChatTwo/Resources/Language.resx +++ b/ChatTwo/Resources/Language.resx @@ -1183,6 +1183,12 @@ Hide the chat during battles. + + Hide when New Game+ is open. + + + Hide Chat 2 when the New Game+ menu is open. + Emote Stats diff --git a/ChatTwo/Ui/ChatLogWindow.cs b/ChatTwo/Ui/ChatLogWindow.cs index b8571ac0..5b3fcbc6 100644 --- a/ChatTwo/Ui/ChatLogWindow.cs +++ b/ChatTwo/Ui/ChatLogWindow.cs @@ -387,7 +387,8 @@ private enum HideState Cutscene, CutsceneOverride, User, - Battle + Battle, + NewGamePlus, } private HideState CurrentHideState = HideState.None; @@ -410,6 +411,13 @@ public void HideStateCheck() CurrentHideState = HideState.Cutscene; } + var newGamePlusOpen = GameFunctions.GameFunctions.IsAddonInteractable("QuestRedo"); + if (Plugin.Config.HideInNewGamePlusMenu && CurrentHideState == HideState.None && newGamePlusOpen) + CurrentHideState = HideState.NewGamePlus; + + if (CurrentHideState is HideState.NewGamePlus && !newGamePlusOpen) + CurrentHideState = HideState.None; + // if the chat is hidden because of a cutscene and no longer in a cutscene, set the hide state to none if (CurrentHideState is HideState.Cutscene or HideState.CutsceneOverride && !Plugin.CutsceneActive && !Plugin.GposeActive) CurrentHideState = HideState.None; @@ -422,7 +430,7 @@ public void HideStateCheck() if (CurrentHideState == HideState.User && Activate) CurrentHideState = HideState.None; - if (CurrentHideState is HideState.Cutscene or HideState.User or HideState.Battle || (Plugin.Config.HideWhenNotLoggedIn && !Plugin.ClientState.IsLoggedIn)) + if (CurrentHideState is HideState.Cutscene or HideState.User or HideState.Battle or HideState.NewGamePlus || (Plugin.Config.HideWhenNotLoggedIn && !Plugin.ClientState.IsLoggedIn)) { IsHidden = true; return; diff --git a/ChatTwo/Ui/Popout.cs b/ChatTwo/Ui/Popout.cs index 8871d54f..832bcfce 100644 --- a/ChatTwo/Ui/Popout.cs +++ b/ChatTwo/Ui/Popout.cs @@ -115,7 +115,8 @@ private enum HideState Cutscene, CutsceneOverride, User, - Battle + Battle, + NewGamePlus, } private HideState CurrentHideState = HideState.None; @@ -137,6 +138,14 @@ private bool HideStateCheck() CurrentHideState = HideState.Cutscene; } + var newGamePlusOpen = GameFunctions.GameFunctions.IsAddonInteractable("QuestRedo"); + if (Tab.HideInNewGamePlusMenu && CurrentHideState == HideState.None && newGamePlusOpen) + CurrentHideState = HideState.NewGamePlus; + + if (CurrentHideState is HideState.NewGamePlus && !newGamePlusOpen) + CurrentHideState = HideState.None; + + // if the chat is hidden because of a cutscene and no longer in a cutscene, set the hide state to none if (CurrentHideState is HideState.Cutscene or HideState.CutsceneOverride && !Plugin.CutsceneActive && !Plugin.GposeActive) CurrentHideState = HideState.None; @@ -149,6 +158,6 @@ private bool HideStateCheck() if (CurrentHideState == HideState.User && ChatLogWindow.Activate) CurrentHideState = HideState.None; - return CurrentHideState is HideState.Cutscene or HideState.User or HideState.Battle || (Tab.HideWhenNotLoggedIn && !Plugin.ClientState.IsLoggedIn); + return CurrentHideState is HideState.Cutscene or HideState.User or HideState.Battle or HideState.NewGamePlus || (Tab.HideWhenNotLoggedIn && !Plugin.ClientState.IsLoggedIn); } } diff --git a/ChatTwo/Ui/SettingsTabs/Display.cs b/ChatTwo/Ui/SettingsTabs/Display.cs index f6980dfb..f00a1fd5 100755 --- a/ChatTwo/Ui/SettingsTabs/Display.cs +++ b/ChatTwo/Ui/SettingsTabs/Display.cs @@ -39,6 +39,9 @@ public void Draw(bool changed) ImGuiUtil.OptionCheckbox(ref Mutable.HideInBattle, Language.Options_HideInBattle_Name, Language.Options_HideInBattle_Description); ImGui.Spacing(); + ImGuiUtil.OptionCheckbox(ref Mutable.HideInNewGamePlusMenu, Language.Options_HideInNewGamePlusMenu_Name, Language.Options_HideInNewGamePlusMenu_Description); + ImGui.Spacing(); + ImGui.Separator(); ImGui.Spacing(); diff --git a/ChatTwo/Ui/SettingsTabs/Tabs.cs b/ChatTwo/Ui/SettingsTabs/Tabs.cs index eab084ca..96bea516 100755 --- a/ChatTwo/Ui/SettingsTabs/Tabs.cs +++ b/ChatTwo/Ui/SettingsTabs/Tabs.cs @@ -111,6 +111,9 @@ public void Draw(bool changed) ImGuiUtil.OptionCheckbox(ref tab.HideInBattle, Language.Options_HideInBattle_Name); ImGui.Spacing(); + + ImGuiUtil.OptionCheckbox(ref tab.HideInNewGamePlusMenu, Language.Options_HideInNewGamePlusMenu_Name); + ImGui.Spacing(); } ImGuiUtil.OptionCheckbox(ref tab.CanMove, Language.Popout_CanMove_Name);