mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-13 12:14:16 +01:00
53 lines
1.5 KiB
C#
53 lines
1.5 KiB
C#
using Dalamud.Plugin.Ipc.Internal;
|
|
using ImGuiNET;
|
|
|
|
namespace Dalamud.Interface.Internal.Windows.Data;
|
|
|
|
/// <summary>
|
|
/// Widget for displaying plugin data share modules.
|
|
/// </summary>
|
|
internal class DataShareWidget : IDataWindowWidget
|
|
{
|
|
/// <inheritdoc/>
|
|
public DataKind DataKind { get; init; } = DataKind.DataShare;
|
|
|
|
/// <inheritdoc/>
|
|
public bool Ready { get; set; }
|
|
|
|
/// <inheritdoc/>
|
|
public void Load()
|
|
{
|
|
this.Ready = true;
|
|
}
|
|
|
|
/// <inheritdoc/>
|
|
public void Draw()
|
|
{
|
|
if (!ImGui.BeginTable("###DataShareTable", 4, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg))
|
|
return;
|
|
|
|
try
|
|
{
|
|
ImGui.TableSetupColumn("Shared Tag");
|
|
ImGui.TableSetupColumn("Creator Assembly");
|
|
ImGui.TableSetupColumn("#", ImGuiTableColumnFlags.WidthFixed, 30 * ImGuiHelpers.GlobalScale);
|
|
ImGui.TableSetupColumn("Consumers");
|
|
ImGui.TableHeadersRow();
|
|
foreach (var share in Service<DataShare>.Get().GetAllShares())
|
|
{
|
|
ImGui.TableNextColumn();
|
|
ImGui.TextUnformatted(share.Tag);
|
|
ImGui.TableNextColumn();
|
|
ImGui.TextUnformatted(share.CreatorAssembly);
|
|
ImGui.TableNextColumn();
|
|
ImGui.TextUnformatted(share.Users.Length.ToString());
|
|
ImGui.TableNextColumn();
|
|
ImGui.TextUnformatted(string.Join(", ", share.Users));
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
ImGui.EndTable();
|
|
}
|
|
}
|
|
}
|