mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
Update to use AgentUpdate event
This commit is contained in:
parent
700aaa4a5d
commit
af8b61f08a
2 changed files with 24 additions and 7 deletions
|
|
@ -54,7 +54,7 @@ internal unsafe class RecipeData : IInternalDisposableService
|
||||||
this.clientState.Login += this.Update;
|
this.clientState.Login += this.Update;
|
||||||
this.clientState.Logout += this.OnLogout;
|
this.clientState.Logout += this.OnLogout;
|
||||||
this.clientState.LevelChanged += this.OnlevelChanged;
|
this.clientState.LevelChanged += this.OnlevelChanged;
|
||||||
this.gameGui.UnlocksUpdate += this.Update;
|
this.gameGui.AgentUpdate += this.OnAgentUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
|
|
@ -63,7 +63,7 @@ internal unsafe class RecipeData : IInternalDisposableService
|
||||||
this.clientState.Login -= this.Update;
|
this.clientState.Login -= this.Update;
|
||||||
this.clientState.Logout -= this.OnLogout;
|
this.clientState.Logout -= this.OnLogout;
|
||||||
this.clientState.LevelChanged -= this.OnlevelChanged;
|
this.clientState.LevelChanged -= this.OnlevelChanged;
|
||||||
this.gameGui.UnlocksUpdate -= this.Update;
|
this.gameGui.AgentUpdate -= this.OnAgentUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -121,6 +121,12 @@ internal unsafe class RecipeData : IInternalDisposableService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnAgentUpdate(AgentUpdateFlag agentUpdateFlag)
|
||||||
|
{
|
||||||
|
if (agentUpdateFlag.HasFlag(AgentUpdateFlag.UnlocksUpdate))
|
||||||
|
this.Update();
|
||||||
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
// based on Client::Game::UI::RecipeNote.InitializeStructs
|
// based on Client::Game::UI::RecipeNote.InitializeStructs
|
||||||
|
|
|
||||||
|
|
@ -49,9 +49,9 @@ internal unsafe class UnlockState : IInternalDisposableService, IUnlockState
|
||||||
[ServiceManager.ServiceConstructor]
|
[ServiceManager.ServiceConstructor]
|
||||||
private UnlockState()
|
private UnlockState()
|
||||||
{
|
{
|
||||||
this.clientState.Login += this.UpdateUnlocks;
|
this.clientState.Login += this.OnLogin;
|
||||||
this.clientState.Logout += this.OnLogout;
|
this.clientState.Logout += this.OnLogout;
|
||||||
this.gameGui.UnlocksUpdate += this.UpdateUnlocks;
|
this.gameGui.AgentUpdate += this.OnAgentUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
|
|
@ -62,9 +62,9 @@ internal unsafe class UnlockState : IInternalDisposableService, IUnlockState
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
void IInternalDisposableService.DisposeService()
|
void IInternalDisposableService.DisposeService()
|
||||||
{
|
{
|
||||||
this.clientState.Login -= this.UpdateUnlocks;
|
this.clientState.Login -= this.OnLogin;
|
||||||
this.clientState.Logout -= this.OnLogout;
|
this.clientState.Logout -= this.OnLogout;
|
||||||
this.gameGui.UnlocksUpdate -= this.UpdateUnlocks;
|
this.gameGui.AgentUpdate -= this.OnAgentUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
|
|
@ -577,12 +577,23 @@ internal unsafe class UnlockState : IInternalDisposableService, IUnlockState
|
||||||
return UIState.Instance()->IsUnlockLinkUnlockedOrQuestCompleted(unlockLink);
|
return UIState.Instance()->IsUnlockLinkUnlockedOrQuestCompleted(unlockLink);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnLogin()
|
||||||
|
{
|
||||||
|
this.Update();
|
||||||
|
}
|
||||||
|
|
||||||
private void OnLogout(int type, int code)
|
private void OnLogout(int type, int code)
|
||||||
{
|
{
|
||||||
this.cachedUnlockedRowIds.Clear();
|
this.cachedUnlockedRowIds.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateUnlocks()
|
private void OnAgentUpdate(AgentUpdateFlag agentUpdateFlag)
|
||||||
|
{
|
||||||
|
if (agentUpdateFlag.HasFlag(AgentUpdateFlag.UnlocksUpdate))
|
||||||
|
this.Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Update()
|
||||||
{
|
{
|
||||||
if (!this.IsLoaded)
|
if (!this.IsLoaded)
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue