mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-13 12:14:16 +01:00
fix: use for loop when showing party members
TODO: fix IEnumerable support
This commit is contained in:
parent
19b09a9077
commit
91d4f90de6
2 changed files with 15 additions and 9 deletions
|
|
@ -80,7 +80,7 @@ namespace Dalamud.Game.ClientState
|
||||||
|
|
||||||
public PartyListEnumerator(PartyList list)
|
public PartyListEnumerator(PartyList list)
|
||||||
{
|
{
|
||||||
party = list;
|
this.party = list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool MoveNext()
|
public bool MoveNext()
|
||||||
|
|
@ -102,13 +102,9 @@ namespace Dalamud.Game.ClientState
|
||||||
public void Dispose() {}
|
public void Dispose() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerator<PartyMember> GetEnumerator() {
|
public IEnumerator<PartyMember> GetEnumerator() => new PartyListEnumerator(this);
|
||||||
return new PartyListEnumerator(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
IEnumerator IEnumerable.GetEnumerator() {
|
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
||||||
return GetEnumerator();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Length => !this.isReady ? 0 : Marshal.ReadByte(partyListBegin + 0xF0);
|
public int Length => !this.isReady ? 0 : Marshal.ReadByte(partyListBegin + 0xF0);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -122,8 +122,18 @@ namespace Dalamud.Interface
|
||||||
ImGui.TextUnformatted("Data not ready.");
|
ImGui.TextUnformatted("Data not ready.");
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
partyString += $"{this.dalamud.ClientState.PartyList.Count} Members";
|
partyString += $"{this.dalamud.ClientState.PartyList.Count} Members\n";
|
||||||
partyString = this.dalamud.ClientState.PartyList.Aggregate(partyString, (current, member) => current + $"{member.CharacterName} - {member.ObjectKind} - {member.Actor.ActorId}");
|
for (var i = 0; i < this.dalamud.ClientState.PartyList.Count; i++) {
|
||||||
|
var member = this.dalamud.ClientState.PartyList[i];
|
||||||
|
if (member == null) {
|
||||||
|
partyString +=
|
||||||
|
$"[{i}] was null\n";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
partyString +=
|
||||||
|
$"[{i}] {member.CharacterName} - {member.ObjectKind} - {member.Actor.ActorId}\n";
|
||||||
|
}
|
||||||
|
|
||||||
ImGui.TextUnformatted(partyString);
|
ImGui.TextUnformatted(partyString);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue