feat: allow hiding
This commit is contained in:
parent
326ef5430c
commit
60e22f58ee
|
@ -8,6 +8,7 @@ internal class Configuration : IPluginConfiguration {
|
||||||
public int Version { get; set; } = 1;
|
public int Version { get; set; } = 1;
|
||||||
|
|
||||||
public bool HideChat = true;
|
public bool HideChat = true;
|
||||||
|
public bool HideDuringCutscenes = true;
|
||||||
public bool NativeItemTooltips = true;
|
public bool NativeItemTooltips = true;
|
||||||
public bool PrettierTimestamps = true;
|
public bool PrettierTimestamps = true;
|
||||||
public bool MoreCompactPretty;
|
public bool MoreCompactPretty;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using Dalamud.Data;
|
using Dalamud.Data;
|
||||||
using Dalamud.Game;
|
using Dalamud.Game;
|
||||||
using Dalamud.Game.ClientState;
|
using Dalamud.Game.ClientState;
|
||||||
|
using Dalamud.Game.ClientState.Conditions;
|
||||||
using Dalamud.Game.ClientState.Keys;
|
using Dalamud.Game.ClientState.Keys;
|
||||||
using Dalamud.Game.ClientState.Objects;
|
using Dalamud.Game.ClientState.Objects;
|
||||||
using Dalamud.Game.ClientState.Party;
|
using Dalamud.Game.ClientState.Party;
|
||||||
|
@ -28,6 +29,9 @@ public sealed class Plugin : IDalamudPlugin {
|
||||||
[PluginService]
|
[PluginService]
|
||||||
internal CommandManager CommandManager { get; init; }
|
internal CommandManager CommandManager { get; init; }
|
||||||
|
|
||||||
|
[PluginService]
|
||||||
|
internal Condition Condition { get; init; }
|
||||||
|
|
||||||
[PluginService]
|
[PluginService]
|
||||||
internal DataManager DataManager { get; init; }
|
internal DataManager DataManager { get; init; }
|
||||||
|
|
||||||
|
|
|
@ -88,10 +88,16 @@ internal sealed class PluginUi : IDisposable {
|
||||||
gameSym.Length
|
gameSym.Length
|
||||||
);
|
);
|
||||||
|
|
||||||
this.Plugin.Interface.UiBuilder.BuildFonts += this.BuildFonts;
|
var uiBuilder = this.Plugin.Interface.UiBuilder;
|
||||||
this.Plugin.Interface.UiBuilder.Draw += this.Draw;
|
uiBuilder.DisableAutomaticUiHide = true;
|
||||||
|
uiBuilder.DisableCutsceneUiHide = true;
|
||||||
|
uiBuilder.DisableGposeUiHide = true;
|
||||||
|
uiBuilder.DisableUserUiHide = true;
|
||||||
|
|
||||||
this.Plugin.Interface.UiBuilder.RebuildFonts();
|
uiBuilder.BuildFonts += this.BuildFonts;
|
||||||
|
uiBuilder.Draw += this.Draw;
|
||||||
|
|
||||||
|
uiBuilder.RebuildFonts();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose() {
|
public void Dispose() {
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System.Numerics;
|
||||||
using ChatTwo.Code;
|
using ChatTwo.Code;
|
||||||
using ChatTwo.GameFunctions.Types;
|
using ChatTwo.GameFunctions.Types;
|
||||||
using ChatTwo.Util;
|
using ChatTwo.Util;
|
||||||
|
using Dalamud.Game.ClientState.Conditions;
|
||||||
using Dalamud.Game.ClientState.Keys;
|
using Dalamud.Game.ClientState.Keys;
|
||||||
using Dalamud.Game.Command;
|
using Dalamud.Game.Command;
|
||||||
using Dalamud.Game.Text.SeStringHandling;
|
using Dalamud.Game.Text.SeStringHandling;
|
||||||
|
@ -237,7 +238,55 @@ internal sealed class ChatLog : IUiComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool CutsceneActive {
|
||||||
|
get {
|
||||||
|
var condition = this.Ui.Plugin.Condition;
|
||||||
|
return condition[ConditionFlag.OccupiedInCutSceneEvent]
|
||||||
|
|| condition[ConditionFlag.WatchingCutscene78];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool GposeActive {
|
||||||
|
get {
|
||||||
|
var condition = this.Ui.Plugin.Condition;
|
||||||
|
return condition[ConditionFlag.WatchingCutscene];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private enum HideState {
|
||||||
|
None,
|
||||||
|
Cutscene,
|
||||||
|
CutsceneOverride,
|
||||||
|
User,
|
||||||
|
}
|
||||||
|
|
||||||
|
private HideState _hideState = HideState.None;
|
||||||
|
|
||||||
public unsafe void Draw() {
|
public unsafe void Draw() {
|
||||||
|
// if the chat has no hide state and in a cutscene, set the hide state to cutscene
|
||||||
|
if (this.Ui.Plugin.Config.HideDuringCutscenes && this._hideState == HideState.None && (this.CutsceneActive || this.GposeActive)) {
|
||||||
|
this._hideState = HideState.Cutscene;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if the chat is hidden because of a cutscene and no longer in a cutscene, set the hide state to none
|
||||||
|
if (this._hideState is HideState.Cutscene or HideState.CutsceneOverride && !this.CutsceneActive && !this.GposeActive) {
|
||||||
|
this._hideState = HideState.None;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if the chat is hidden because of a cutscene and the chat has been activated, show chat
|
||||||
|
if (this._hideState == HideState.Cutscene && this.Activate) {
|
||||||
|
this._hideState = HideState.CutsceneOverride;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if the user hid the chat and is now activating chat, reset the hide state
|
||||||
|
if (this._hideState == HideState.User && this.Activate) {
|
||||||
|
this._hideState = HideState.None;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._hideState is HideState.Cutscene or HideState.User) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var flags = ImGuiWindowFlags.None;
|
var flags = ImGuiWindowFlags.None;
|
||||||
if (!this.Ui.Plugin.Config.CanMove) {
|
if (!this.Ui.Plugin.Config.CanMove) {
|
||||||
flags |= ImGuiWindowFlags.NoMove;
|
flags |= ImGuiWindowFlags.NoMove;
|
||||||
|
@ -360,6 +409,8 @@ internal sealed class ChatLog : IUiComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var normalColour = *ImGui.GetStyleColorVec4(ImGuiCol.Text);
|
||||||
|
|
||||||
var inputColour = this.Ui.Plugin.Config.ChatColours.TryGetValue(inputType, out var inputCol)
|
var inputColour = this.Ui.Plugin.Config.ChatColours.TryGetValue(inputType, out var inputCol)
|
||||||
? inputCol
|
? inputCol
|
||||||
: inputType.DefaultColour();
|
: inputType.DefaultColour();
|
||||||
|
@ -422,6 +473,20 @@ internal sealed class ChatLog : IUiComponent {
|
||||||
this._tempChannel = null;
|
this._tempChannel = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ImGui.BeginPopupContextItem()) {
|
||||||
|
ImGui.PushStyleColor(ImGuiCol.Text, normalColour);
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (ImGui.Selectable("Hide chat")) {
|
||||||
|
this._hideState = HideState.User;
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
ImGui.PopStyleColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.EndPopup();
|
||||||
|
}
|
||||||
|
|
||||||
if (inputColour != null) {
|
if (inputColour != null) {
|
||||||
ImGui.PopStyleColor();
|
ImGui.PopStyleColor();
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,8 @@ internal sealed class Display : ISettingsTab {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Draw() {
|
public void Draw() {
|
||||||
ImGui.Checkbox("Hide chat", ref this.Mutable.HideChat);
|
ImGui.Checkbox("Hide vanilla chat", ref this.Mutable.HideChat);
|
||||||
|
ImGui.Checkbox("Hide chat during cutscenes", ref this.Mutable.HideDuringCutscenes);
|
||||||
ImGui.Checkbox("Show native item tooltips", ref this.Mutable.NativeItemTooltips);
|
ImGui.Checkbox("Show native item tooltips", ref this.Mutable.NativeItemTooltips);
|
||||||
ImGui.Checkbox("Show tabs in a sidebar", ref this.Mutable.SidebarTabView);
|
ImGui.Checkbox("Show tabs in a sidebar", ref this.Mutable.SidebarTabView);
|
||||||
ImGui.Checkbox("Use modern timestamp layout", ref this.Mutable.PrettierTimestamps);
|
ImGui.Checkbox("Use modern timestamp layout", ref this.Mutable.PrettierTimestamps);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user