mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
fix(DtrBar): fix relogging
This commit is contained in:
parent
5d6de6f7ef
commit
bab7f33e96
1 changed files with 22 additions and 2 deletions
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
|
|
@ -19,8 +19,11 @@ namespace Dalamud.Game.Gui.Dtr
|
|||
[InterfaceVersion("1.0")]
|
||||
public sealed unsafe class DtrBar : IDisposable
|
||||
{
|
||||
private const uint BaseNodeCount = 17;
|
||||
private const uint BaseNodeId = 1000;
|
||||
|
||||
private List<DtrBarEntry> entries = new();
|
||||
private uint runningNodeIds = 1000;
|
||||
private uint runningNodeIds = BaseNodeId;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DtrBar"/> class.
|
||||
|
|
@ -130,6 +133,13 @@ namespace Dalamud.Game.Gui.Dtr
|
|||
|
||||
// The collision node on the DTR element is always the width of its content
|
||||
if (dtr->UldManager.NodeList == null) return;
|
||||
|
||||
// If we have an unmodified DTR but still have entries, we need to
|
||||
// work to reset our state.
|
||||
var nodeCount = dtr->UldManager.NodeListCount;
|
||||
if (nodeCount == BaseNodeCount)
|
||||
this.Reset();
|
||||
|
||||
var collisionNode = dtr->UldManager.NodeList[1];
|
||||
if (collisionNode == null) return;
|
||||
var runningXPos = collisionNode->X;
|
||||
|
|
@ -176,6 +186,16 @@ namespace Dalamud.Game.Gui.Dtr
|
|||
}
|
||||
}
|
||||
|
||||
private void Reset()
|
||||
{
|
||||
this.runningNodeIds = BaseNodeId;
|
||||
foreach (var entry in this.entries)
|
||||
{
|
||||
entry.TextNode = this.MakeNode(++this.runningNodeIds);
|
||||
entry.Added = false;
|
||||
}
|
||||
}
|
||||
|
||||
private bool AddNode(AtkTextNode* node)
|
||||
{
|
||||
var dtr = GetDtr();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue