added broadcaster name display in Syncshell finder table

This commit is contained in:
choco
2025-09-28 15:49:15 +02:00
parent 6af2013a03
commit 08e3c8678f
2 changed files with 23 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
using Dalamud.Game; using Dalamud.Game;
using Dalamud.Game.ClientState.Objects; using Dalamud.Game.ClientState.Objects;
using Dalamud.Interface.ImGuiFileDialog; using Dalamud.Interface.ImGuiFileDialog;
using Dalamud.Interface.Windowing; using Dalamud.Interface.Windowing;
@@ -230,7 +230,7 @@ public sealed class Plugin : IDalamudPlugin
s.GetRequiredService<LightlessProfileManager>(), s.GetRequiredService<PerformanceCollectorService>())); s.GetRequiredService<LightlessProfileManager>(), s.GetRequiredService<PerformanceCollectorService>()));
collection.AddScoped<WindowMediatorSubscriberBase, PopupHandler>(); collection.AddScoped<WindowMediatorSubscriberBase, PopupHandler>();
collection.AddScoped<WindowMediatorSubscriberBase, BroadcastUI>((s) => new BroadcastUI(s.GetRequiredService<ILogger<BroadcastUI>>(), s.GetRequiredService<LightlessMediator>(), s.GetRequiredService<PerformanceCollectorService>(), s.GetRequiredService<BroadcastService>(), s.GetRequiredService<LightlessConfigService>(), s.GetRequiredService<UiSharedService>(), s.GetRequiredService<ApiController>(), s.GetRequiredService<BroadcastScannerService>())); collection.AddScoped<WindowMediatorSubscriberBase, BroadcastUI>((s) => new BroadcastUI(s.GetRequiredService<ILogger<BroadcastUI>>(), s.GetRequiredService<LightlessMediator>(), s.GetRequiredService<PerformanceCollectorService>(), s.GetRequiredService<BroadcastService>(), s.GetRequiredService<LightlessConfigService>(), s.GetRequiredService<UiSharedService>(), s.GetRequiredService<ApiController>(), s.GetRequiredService<BroadcastScannerService>()));
collection.AddScoped<WindowMediatorSubscriberBase, SyncshellFinderUI>((s) => new SyncshellFinderUI(s.GetRequiredService<ILogger<SyncshellFinderUI>>(), s.GetRequiredService<LightlessMediator>(), s.GetRequiredService<PerformanceCollectorService>(), s.GetRequiredService<BroadcastService>(), s.GetRequiredService<UiSharedService>(), s.GetRequiredService<ApiController>(), s.GetRequiredService<BroadcastScannerService>(), s.GetRequiredService<PairManager>())); collection.AddScoped<WindowMediatorSubscriberBase, SyncshellFinderUI>((s) => new SyncshellFinderUI(s.GetRequiredService<ILogger<SyncshellFinderUI>>(), s.GetRequiredService<LightlessMediator>(), s.GetRequiredService<PerformanceCollectorService>(), s.GetRequiredService<BroadcastService>(), s.GetRequiredService<UiSharedService>(), s.GetRequiredService<ApiController>(), s.GetRequiredService<BroadcastScannerService>(), s.GetRequiredService<PairManager>(), s.GetRequiredService<DalamudUtilService>()));
collection.AddScoped<IPopupHandler, BanUserPopupHandler>(); collection.AddScoped<IPopupHandler, BanUserPopupHandler>();
collection.AddScoped<IPopupHandler, CensusPopupHandler>(); collection.AddScoped<IPopupHandler, CensusPopupHandler>();
collection.AddScoped<CacheCreationService>(); collection.AddScoped<CacheCreationService>();

View File

@@ -1,4 +1,4 @@
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using Dalamud.Interface; using Dalamud.Interface;
using Dalamud.Interface.Colors; using Dalamud.Interface.Colors;
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
@@ -24,6 +24,7 @@ public class SyncshellFinderUI : WindowMediatorSubscriberBase
private readonly UiSharedService _uiSharedService; private readonly UiSharedService _uiSharedService;
private readonly BroadcastScannerService _broadcastScannerService; private readonly BroadcastScannerService _broadcastScannerService;
private readonly PairManager _pairManager; private readonly PairManager _pairManager;
private readonly DalamudUtilService _dalamudUtilService;
private readonly List<GroupJoinDto> _nearbySyncshells = []; private readonly List<GroupJoinDto> _nearbySyncshells = [];
private List<GroupFullInfoDto> _currentSyncshells = []; private List<GroupFullInfoDto> _currentSyncshells = [];
@@ -41,13 +42,15 @@ public class SyncshellFinderUI : WindowMediatorSubscriberBase
UiSharedService uiShared, UiSharedService uiShared,
ApiController apiController, ApiController apiController,
BroadcastScannerService broadcastScannerService, BroadcastScannerService broadcastScannerService,
PairManager pairManager) : base(logger, mediator, "Shellfinder###LightlessSyncshellFinderUI", performanceCollectorService) PairManager pairManager,
DalamudUtilService dalamudUtilService) : base(logger, mediator, "Shellfinder###LightlessSyncshellFinderUI", performanceCollectorService)
{ {
_broadcastService = broadcastService; _broadcastService = broadcastService;
_uiSharedService = uiShared; _uiSharedService = uiShared;
_apiController = apiController; _apiController = apiController;
_broadcastScannerService = broadcastScannerService; _broadcastScannerService = broadcastScannerService;
_pairManager = pairManager; _pairManager = pairManager;
_dalamudUtilService = dalamudUtilService;
IsOpen = false; IsOpen = false;
SizeConstraints = new() SizeConstraints = new()
@@ -102,8 +105,8 @@ public class SyncshellFinderUI : WindowMediatorSubscriberBase
if (ImGui.BeginTable("##NearbySyncshellsTable", 3, ImGuiTableFlags.Borders | ImGuiTableFlags.RowBg)) if (ImGui.BeginTable("##NearbySyncshellsTable", 3, ImGuiTableFlags.Borders | ImGuiTableFlags.RowBg))
{ {
ImGui.TableSetupColumn("Alias", ImGuiTableColumnFlags.WidthStretch); ImGui.TableSetupColumn("Syncshell", ImGuiTableColumnFlags.WidthStretch);
ImGui.TableSetupColumn("GID", ImGuiTableColumnFlags.WidthStretch); ImGui.TableSetupColumn("Broadcaster", ImGuiTableColumnFlags.WidthStretch);
ImGui.TableSetupColumn("Join", ImGuiTableColumnFlags.WidthFixed, 80f * ImGuiHelpers.GlobalScale); ImGui.TableSetupColumn("Join", ImGuiTableColumnFlags.WidthFixed, 80f * ImGuiHelpers.GlobalScale);
ImGui.TableHeadersRow(); ImGui.TableHeadersRow();
@@ -111,9 +114,21 @@ public class SyncshellFinderUI : WindowMediatorSubscriberBase
{ {
ImGui.TableNextRow(); ImGui.TableNextRow();
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGui.TextUnformatted(shell.Group.Alias ?? "(No Alias)");
var displayName = !string.IsNullOrEmpty(shell.Group.Alias) ? shell.Group.Alias : shell.Group.GID;
ImGui.TextUnformatted(displayName);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGui.TextUnformatted(shell.Group.GID); var broadcasts = _broadcastScannerService.GetActiveSyncshellBroadcasts();
var broadcast = broadcasts.FirstOrDefault(b => string.Equals(b.GID, shell.Group.GID, StringComparison.Ordinal));
var broadcasterName = "Unknown";
if (broadcast != null)
{
var playerInfo = _dalamudUtilService.FindPlayerByNameHash(broadcast.HashedCID);
broadcasterName = !string.IsNullOrEmpty(playerInfo.Name) ? playerInfo.Name : "Unknown Player";
}
ImGui.TextUnformatted(broadcasterName);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
var label = $"Join##{shell.Group.GID}"; var label = $"Join##{shell.Group.GID}";
@@ -123,8 +138,6 @@ public class SyncshellFinderUI : WindowMediatorSubscriberBase
if (!_currentSyncshells.Exists(g => string.Equals(g.GID, shell.GID, StringComparison.Ordinal))) if (!_currentSyncshells.Exists(g => string.Equals(g.GID, shell.GID, StringComparison.Ordinal)))
{ {
if (ImGui.Button(label)) if (ImGui.Button(label))
{ {
_logger.LogInformation($"Join requested for Syncshell {shell.Group.GID} ({shell.Group.Alias})"); _logger.LogInformation($"Join requested for Syncshell {shell.Group.GID} ({shell.Group.Alias})");