Add option to hide chat during loading screens [default false]
This commit is contained in:
@@ -17,6 +17,7 @@ internal class Configuration : IPluginConfiguration {
|
|||||||
public bool HideDuringCutscenes = true;
|
public bool HideDuringCutscenes = true;
|
||||||
public bool HideWhenNotLoggedIn = true;
|
public bool HideWhenNotLoggedIn = true;
|
||||||
public bool HideWhenUiHidden = true;
|
public bool HideWhenUiHidden = true;
|
||||||
|
public bool HideInLoadingScreens;
|
||||||
public bool NativeItemTooltips = true;
|
public bool NativeItemTooltips = true;
|
||||||
public bool PrettierTimestamps = true;
|
public bool PrettierTimestamps = true;
|
||||||
public bool MoreCompactPretty;
|
public bool MoreCompactPretty;
|
||||||
@@ -60,6 +61,7 @@ internal class Configuration : IPluginConfiguration {
|
|||||||
HideDuringCutscenes = other.HideDuringCutscenes;
|
HideDuringCutscenes = other.HideDuringCutscenes;
|
||||||
HideWhenNotLoggedIn = other.HideWhenNotLoggedIn;
|
HideWhenNotLoggedIn = other.HideWhenNotLoggedIn;
|
||||||
HideWhenUiHidden = other.HideWhenUiHidden;
|
HideWhenUiHidden = other.HideWhenUiHidden;
|
||||||
|
HideInLoadingScreens = other.HideInLoadingScreens;
|
||||||
NativeItemTooltips = other.NativeItemTooltips;
|
NativeItemTooltips = other.NativeItemTooltips;
|
||||||
PrettierTimestamps = other.PrettierTimestamps;
|
PrettierTimestamps = other.PrettierTimestamps;
|
||||||
MoreCompactPretty = other.MoreCompactPretty;
|
MoreCompactPretty = other.MoreCompactPretty;
|
||||||
|
|||||||
+20
-10
@@ -5,8 +5,8 @@ using ChatTwo.Ipc;
|
|||||||
using ChatTwo.Resources;
|
using ChatTwo.Resources;
|
||||||
using ChatTwo.Ui;
|
using ChatTwo.Ui;
|
||||||
using ChatTwo.Util;
|
using ChatTwo.Util;
|
||||||
|
using Dalamud.Game.ClientState.Conditions;
|
||||||
using Dalamud.Game.ClientState.Objects;
|
using Dalamud.Game.ClientState.Objects;
|
||||||
using Dalamud.Interface.Style;
|
|
||||||
using Dalamud.Interface.Windowing;
|
using Dalamud.Interface.Windowing;
|
||||||
using Dalamud.IoC;
|
using Dalamud.IoC;
|
||||||
using Dalamud.Plugin;
|
using Dalamud.Plugin;
|
||||||
@@ -17,7 +17,8 @@ using XivCommon;
|
|||||||
namespace ChatTwo;
|
namespace ChatTwo;
|
||||||
|
|
||||||
// ReSharper disable once ClassNeverInstantiated.Global
|
// ReSharper disable once ClassNeverInstantiated.Global
|
||||||
public sealed class Plugin : IDalamudPlugin {
|
public sealed class Plugin : IDalamudPlugin
|
||||||
|
{
|
||||||
internal const string PluginName = "Chat 2";
|
internal const string PluginName = "Chat 2";
|
||||||
|
|
||||||
[PluginService] internal static IPluginLog Log { get; private set; } = null!;
|
[PluginService] internal static IPluginLog Log { get; private set; } = null!;
|
||||||
@@ -63,7 +64,8 @@ public sealed class Plugin : IDalamudPlugin {
|
|||||||
internal DateTime GameStarted { get; }
|
internal DateTime GameStarted { get; }
|
||||||
|
|
||||||
#pragma warning disable CS8618
|
#pragma warning disable CS8618
|
||||||
public Plugin() {
|
public Plugin()
|
||||||
|
{
|
||||||
GameStarted = Process.GetCurrentProcess().StartTime.ToUniversalTime();
|
GameStarted = Process.GetCurrentProcess().StartTime.ToUniversalTime();
|
||||||
|
|
||||||
Config = Interface.GetPluginConfig() as Configuration ?? new Configuration();
|
Config = Interface.GetPluginConfig() as Configuration ?? new Configuration();
|
||||||
@@ -112,7 +114,8 @@ public sealed class Plugin : IDalamudPlugin {
|
|||||||
}
|
}
|
||||||
#pragma warning restore CS8618
|
#pragma warning restore CS8618
|
||||||
|
|
||||||
public void Dispose() {
|
public void Dispose()
|
||||||
|
{
|
||||||
Interface.LanguageChanged -= LanguageChanged;
|
Interface.LanguageChanged -= LanguageChanged;
|
||||||
Interface.UiBuilder.Draw -= Draw;
|
Interface.UiBuilder.Draw -= Draw;
|
||||||
Framework.Update -= FrameworkUpdate;
|
Framework.Update -= FrameworkUpdate;
|
||||||
@@ -135,6 +138,9 @@ public sealed class Plugin : IDalamudPlugin {
|
|||||||
private void Draw()
|
private void Draw()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (Config.HideInLoadingScreens && Condition[ConditionFlag.BetweenAreas])
|
||||||
|
return;
|
||||||
|
|
||||||
Interface.UiBuilder.DisableUserUiHide = !Config.HideWhenUiHidden;
|
Interface.UiBuilder.DisableUserUiHide = !Config.HideWhenUiHidden;
|
||||||
ChatLogWindow.DefaultText = ImGui.GetStyle().Colors[(int) ImGuiCol.Text];
|
ChatLogWindow.DefaultText = ImGui.GetStyle().Colors[(int) ImGuiCol.Text];
|
||||||
|
|
||||||
@@ -144,11 +150,13 @@ public sealed class Plugin : IDalamudPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void SaveConfig() {
|
internal void SaveConfig()
|
||||||
|
{
|
||||||
Interface.SavePluginConfig(Config);
|
Interface.SavePluginConfig(Config);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void LanguageChanged(string langCode) {
|
internal void LanguageChanged(string langCode)
|
||||||
|
{
|
||||||
var info = Config.LanguageOverride is LanguageOverride.None
|
var info = Config.LanguageOverride is LanguageOverride.None
|
||||||
? new CultureInfo(langCode)
|
? new CultureInfo(langCode)
|
||||||
: new CultureInfo(Config.LanguageOverride.Code());
|
: new CultureInfo(Config.LanguageOverride.Code());
|
||||||
@@ -156,15 +164,17 @@ public sealed class Plugin : IDalamudPlugin {
|
|||||||
Language.Culture = info;
|
Language.Culture = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly string[] ChatAddonNames = {
|
private static readonly string[] ChatAddonNames =
|
||||||
|
[
|
||||||
"ChatLog",
|
"ChatLog",
|
||||||
"ChatLogPanel_0",
|
"ChatLogPanel_0",
|
||||||
"ChatLogPanel_1",
|
"ChatLogPanel_1",
|
||||||
"ChatLogPanel_2",
|
"ChatLogPanel_2",
|
||||||
"ChatLogPanel_3",
|
"ChatLogPanel_3"
|
||||||
};
|
];
|
||||||
|
|
||||||
private void FrameworkUpdate(IFramework framework) {
|
private void FrameworkUpdate(IFramework framework)
|
||||||
|
{
|
||||||
if (DeferredSaveFrames >= 0 && DeferredSaveFrames-- == 0) {
|
if (DeferredSaveFrames >= 0 && DeferredSaveFrames-- == 0) {
|
||||||
SaveConfig();
|
SaveConfig();
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+19
-1
@@ -1770,7 +1770,7 @@ namespace ChatTwo.Resources {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Hide chat during cutscenes.
|
/// Looks up a localized string similar to Hide during cutscenes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static string Options_HideDuringCutscenes_Name {
|
internal static string Options_HideDuringCutscenes_Name {
|
||||||
get {
|
get {
|
||||||
@@ -1778,6 +1778,24 @@ namespace ChatTwo.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Hide {0} during loading screens..
|
||||||
|
/// </summary>
|
||||||
|
internal static string Options_HideInLoadingScreens_Description {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Options_HideInLoadingScreens_Description", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Hide during loading screens.
|
||||||
|
/// </summary>
|
||||||
|
internal static string Options_HideInLoadingScreens_Name {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Options_HideInLoadingScreens_Name", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Hide timestamps when previous messages have the same timestamp..
|
/// Looks up a localized string similar to Hide timestamps when previous messages have the same timestamp..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -128,7 +128,7 @@
|
|||||||
<value>Hide the in-game chat window when the plugin is active.</value>
|
<value>Hide the in-game chat window when the plugin is active.</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Options_HideDuringCutscenes_Name">
|
<data name="Options_HideDuringCutscenes_Name">
|
||||||
<value>Hide chat during cutscenes</value>
|
<value>Hide during cutscenes</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Options_HideDuringCutscenes_Description">
|
<data name="Options_HideDuringCutscenes_Description">
|
||||||
<value>Hide {0} during cutscenes.</value>
|
<value>Hide {0} during cutscenes.</value>
|
||||||
@@ -923,4 +923,10 @@
|
|||||||
<data name="Options_OverrideStyle_Name_Desc" xml:space="preserve">
|
<data name="Options_OverrideStyle_Name_Desc" xml:space="preserve">
|
||||||
<value>Override your selected dalamud style with a different one</value>
|
<value>Override your selected dalamud style with a different one</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Options_HideInLoadingScreens_Name" xml:space="preserve">
|
||||||
|
<value>Hide during loading screens</value>
|
||||||
|
</data>
|
||||||
|
<data name="Options_HideInLoadingScreens_Description" xml:space="preserve">
|
||||||
|
<value>Hide {0} during loading screens.</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
|||||||
@@ -41,6 +41,12 @@ internal sealed class Display : ISettingsTab {
|
|||||||
);
|
);
|
||||||
ImGui.Spacing();
|
ImGui.Spacing();
|
||||||
|
|
||||||
|
ImGuiUtil.OptionCheckbox(
|
||||||
|
ref Mutable.HideInLoadingScreens,
|
||||||
|
Language.Options_HideInLoadingScreens_Name,
|
||||||
|
string.Format(Language.Options_HideInLoadingScreens_Description, Plugin.PluginName));
|
||||||
|
ImGui.Spacing();
|
||||||
|
|
||||||
ImGuiUtil.OptionCheckbox(
|
ImGuiUtil.OptionCheckbox(
|
||||||
ref Mutable.NativeItemTooltips,
|
ref Mutable.NativeItemTooltips,
|
||||||
Language.Options_NativeItemTooltips_Name,
|
Language.Options_NativeItemTooltips_Name,
|
||||||
|
|||||||
Reference in New Issue
Block a user