feat: make tippy respect UI hiding

This commit is contained in:
goat 2021-04-01 16:16:58 +02:00
parent 6169f28b33
commit 1778ee9d27

View file

@ -9,6 +9,7 @@ using System.Numerics;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms.VisualStyles; using System.Windows.Forms.VisualStyles;
using Dalamud.Game.ClientState;
using Dalamud.Interface; using Dalamud.Interface;
using ImGuiNET; using ImGuiNET;
using ImGuiScene; using ImGuiScene;
@ -320,6 +321,15 @@ namespace Dalamud
this.sounds.Play(); this.sounds.Play();
} }
private bool CutsceneActive => this.dalamud.ClientState != null &&
(this.dalamud.ClientState.Condition[ConditionFlag.OccupiedInCutSceneEvent] ||
this.dalamud.ClientState.Condition[ConditionFlag.WatchingCutscene78]);
private bool GposeActive => this.dalamud.ClientState != null &&
this.dalamud.ClientState.Condition[ConditionFlag.WatchingCutscene];
private bool ShouldHide => this.CutsceneActive || this.GposeActive || this.dalamud.Framework.Gui.GameUiHidden;
private void DrawTippy() private void DrawTippy()
{ {
if (this.tippyState == TippyState.BeforeIntro && this.tippyLogicTimer.ElapsedMilliseconds > 8000) { if (this.tippyState == TippyState.BeforeIntro && this.tippyLogicTimer.ElapsedMilliseconds > 8000) {
@ -362,7 +372,7 @@ namespace Dalamud
ImGui.PushFont(InterfaceManager.FoolsFont); ImGui.PushFont(InterfaceManager.FoolsFont);
if (!string.IsNullOrEmpty(this.tippyText)) if (!string.IsNullOrEmpty(this.tippyText) && !ShouldHide)
{ {
DrawTextBox(this.tippyText); DrawTextBox(this.tippyText);
} }
@ -372,17 +382,16 @@ namespace Dalamud
ImGui.SetCursorPosX(230); ImGui.SetCursorPosX(230);
ImGui.SetCursorPosY(18 + 55); ImGui.SetCursorPosY(18 + 55);
DrawTippyAnim(); if (!ShouldHide)
DrawTippyAnim();
ImGui.End(); ImGui.End();
ImGui.PushStyleColor(ImGuiCol.Button, new Vector4(0.6f, 0.6f, 0.6f, 1f)); ImGui.PushStyleColor(ImGuiCol.Button, new Vector4(0.6f, 0.6f, 0.6f, 1f));
ImGui.PushStyleColor(ImGuiCol.Text, new Vector4(0, 0, 0, 1)); ImGui.PushStyleColor(ImGuiCol.Text, new Vector4(0, 0, 0, 1));
if (this.showTippyButton) { if (this.showTippyButton && !ShouldHide) {
ImGui.SetNextWindowPos(tippyPos + new Vector2(117, 117), ImGuiCond.Always); ImGui.SetNextWindowPos(tippyPos + new Vector2(117, 117), ImGuiCond.Always);
ImGui.SetNextWindowSize(new Vector2(95, 40), ImGuiCond.Always); ImGui.SetNextWindowSize(new Vector2(95, 40), ImGuiCond.Always);
//ImGui.SetNextWindowFocus(); //ImGui.SetNextWindowFocus();