fix: reset UI hide state when login/logout (closes #734)

This commit is contained in:
goaaats 2022-01-16 15:20:20 +01:00
parent a0caea1545
commit a94d39e2a9
No known key found for this signature in database
GPG key ID: F18F057873895461
2 changed files with 13 additions and 0 deletions

View file

@ -11,6 +11,7 @@ using Dalamud.Game.ClientState.Keys;
using Dalamud.Game.ClientState.Objects;
using Dalamud.Game.ClientState.Objects.SubKinds;
using Dalamud.Game.ClientState.Party;
using Dalamud.Game.Gui;
using Dalamud.Game.Network.Internal;
using Dalamud.Hooking;
using Dalamud.IoC;
@ -164,12 +165,14 @@ namespace Dalamud.Game.ClientState
private void FrameworkOnOnUpdateEvent(Framework framework)
{
var condition = Service<Condition>.Get();
var gameGui = Service<GameGui>.Get();
if (condition.Any() && this.lastConditionNone == true)
{
Log.Debug("Is login");
this.lastConditionNone = false;
this.IsLoggedIn = true;
this.Login?.Invoke(this, null);
gameGui.ResetUiHideState();
}
if (!condition.Any() && this.lastConditionNone == false)
@ -178,6 +181,7 @@ namespace Dalamud.Game.ClientState
this.lastConditionNone = true;
this.IsLoggedIn = false;
this.Logout?.Invoke(this, null);
gameGui.ResetUiHideState();
}
}
}

View file

@ -459,6 +459,14 @@ namespace Dalamud.Game.Gui
this.handleActionOutHook.Dispose();
}
/// <summary>
/// Reset the stored "UI hide" state.
/// </summary>
internal void ResetUiHideState()
{
this.GameUiHidden = false;
}
private IntPtr HandleSetGlobalBgmDetour(ushort bgmKey, byte a2, uint a3, uint a4, uint a5, byte a6)
{
var retVal = this.setGlobalBgmHook.Original(bgmKey, a2, a3, a4, a5, a6);
@ -570,6 +578,7 @@ namespace Dalamud.Game.Gui
private IntPtr ToggleUiHideDetour(IntPtr thisPtr, byte unknownByte)
{
// TODO(goat): We should read this from memory directly, instead of relying on catching every toggle.
this.GameUiHidden = !this.GameUiHidden;
try