mirror of
https://github.com/xivdev/Penumbra.git
synced 2026-01-03 06:13:45 +01:00
Update PlayerWatcher to deal with multiple actors with the same name.
This commit is contained in:
parent
0b8a3d2d11
commit
b6304d43db
4 changed files with 75 additions and 37 deletions
|
|
@ -9,6 +9,7 @@ using Dalamud.Game.ClientState.Objects.Types;
|
|||
using ImGuiNET;
|
||||
using Penumbra.Api;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.GameData.Structs;
|
||||
using Penumbra.GameData.Util;
|
||||
using Penumbra.Interop;
|
||||
using Penumbra.Meta;
|
||||
|
|
@ -28,13 +29,14 @@ namespace Penumbra.UI
|
|||
}
|
||||
|
||||
var players = Penumbra.PlayerWatcher.WatchedPlayers().ToArray();
|
||||
if( !players.Any() )
|
||||
var count = players.Sum( s => Math.Max(1, s.Item2.Length) );
|
||||
if( count == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( !ImGui.BeginTable( "##ObjectTable", 13, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.ScrollX,
|
||||
new Vector2( -1, ImGui.GetTextLineHeightWithSpacing() * 4 * players.Length ) ) )
|
||||
new Vector2( -1, ImGui.GetTextLineHeightWithSpacing() * 4 * count ) ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -43,7 +45,10 @@ namespace Penumbra.UI
|
|||
|
||||
var identifier = GameData.GameData.GetIdentifier();
|
||||
|
||||
foreach( var (actor, equip) in players )
|
||||
foreach( var (actor, equip) in players.SelectMany( kvp => kvp.Item2.Any()
|
||||
? kvp.Item2
|
||||
.Select( x => ( $"{kvp.Item1} ({x.Item1})", x.Item2 ) )
|
||||
: new[] { ( kvp.Item1, new CharacterEquipment() ) } ) )
|
||||
{
|
||||
// @formatter:off
|
||||
ImGui.TableNextRow();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue