seperate scanning service not relying on nameplate updates & other improvements/fixes

This commit is contained in:
2025-09-24 22:28:32 +09:00
parent d91f1a3356
commit 7569b15993
8 changed files with 253 additions and 252 deletions

View File

@@ -17,7 +17,7 @@ namespace LightlessSync.UI
private readonly LightlessConfigService _configService;
private readonly BroadcastService _broadcastService;
private readonly UiSharedService _uiSharedService;
private readonly NameplateService _nameplateService;
private readonly BroadcastScannerService _broadcastScannerService;
private IReadOnlyList<GroupFullInfoDto> _allSyncshells;
private string _userUid = string.Empty;
@@ -32,20 +32,20 @@ namespace LightlessSync.UI
LightlessConfigService configService,
UiSharedService uiShared,
ApiController apiController,
NameplateService nameplateService
BroadcastScannerService broadcastScannerService
) : base(logger, mediator, "Lightfinder###LightlessLightfinderUI", performanceCollectorService)
{
_broadcastService = broadcastService;
_uiSharedService = uiShared;
_configService = configService;
_apiController = apiController;
_nameplateService = nameplateService;
_broadcastScannerService = broadcastScannerService;
IsOpen = false;
this.SizeConstraints = new()
{
MinimumSize = new(590, 340),
MaximumSize = new(590, 340)
MinimumSize = new(600, 340),
MaximumSize = new(750, 400)
};
mediator.Subscribe<RefreshUiMessage>(this, async _ => await RefreshSyncshells());
@@ -126,9 +126,7 @@ namespace LightlessSync.UI
{
if (!_broadcastService.IsLightFinderAvailable)
{
ImGui.PushStyleColor(ImGuiCol.Text, UIColors.Get("LightlessYellow"));
ImGui.TextWrapped("This server doesn't support LightFinder.");
ImGui.PopStyleColor();
_uiSharedService.MediumText("This server doesn't support Lightfinder.", UIColors.Get("LightlessYellow"));
ImGuiHelpers.ScaledDummy(0.25f);
}
@@ -203,7 +201,7 @@ namespace LightlessSync.UI
else
ImGui.PushStyleColor(ImGuiCol.Button, UIColors.Get("PairBlue"));
if (isOnCooldown)
if (isOnCooldown || !_broadcastService.IsLightFinderAvailable)
ImGui.BeginDisabled();
string buttonText = isBroadcasting ? "Disable Lightfinder" : "Enable Lightfinder";
@@ -213,7 +211,7 @@ namespace LightlessSync.UI
_broadcastService.ToggleBroadcast();
}
if (isOnCooldown)
if (isOnCooldown || !_broadcastService.IsLightFinderAvailable)
ImGui.EndDisabled();
ImGui.PopStyleColor();
@@ -316,7 +314,7 @@ namespace LightlessSync.UI
{
ImGui.Text("Broadcast Cache");
if (ImGui.BeginTable("##BroadcastCacheTable", 4, ImGuiTableFlags.RowBg | ImGuiTableFlags.Borders | ImGuiTableFlags.ScrollY, new Vector2(-1, 200f)))
if (ImGui.BeginTable("##BroadcastCacheTable", 4, ImGuiTableFlags.RowBg | ImGuiTableFlags.Borders | ImGuiTableFlags.ScrollY, new Vector2(-1, 225f)))
{
ImGui.TableSetupColumn("CID", ImGuiTableColumnFlags.WidthStretch);
ImGui.TableSetupColumn("IsBroadcasting", ImGuiTableColumnFlags.WidthStretch);
@@ -326,7 +324,7 @@ namespace LightlessSync.UI
var now = DateTime.UtcNow;
foreach (var (cid, entry) in _nameplateService.BroadcastCache)
foreach (var (cid, entry) in _broadcastScannerService.BroadcastCache)
{
ImGui.TableNextRow();

View File

@@ -23,7 +23,7 @@ public class SyncshellFinderUI : WindowMediatorSubscriberBase
private readonly LightlessConfigService _configService;
private readonly BroadcastService _broadcastService;
private readonly UiSharedService _uiSharedService;
private readonly NameplateService _nameplateService;
private readonly BroadcastScannerService _broadcastScannerService;
private readonly List<GroupJoinDto> _nearbySyncshells = new();
private int _selectedNearbyIndex = -1;
@@ -40,23 +40,24 @@ public class SyncshellFinderUI : WindowMediatorSubscriberBase
LightlessConfigService configService,
UiSharedService uiShared,
ApiController apiController,
NameplateService nameplateService
BroadcastScannerService broadcastScannerService
) : base(logger, mediator, "Shellfinder###LightlessSyncshellFinderUI", performanceCollectorService)
{
_broadcastService = broadcastService;
_uiSharedService = uiShared;
_configService = configService;
_apiController = apiController;
_nameplateService = nameplateService;
_broadcastScannerService = broadcastScannerService;
IsOpen = false;
SizeConstraints = new()
{
MinimumSize = new(600, 400),
MaximumSize = new(600, 400)
MaximumSize = new(600, 550)
};
Mediator.Subscribe<SyncshellBroadcastsUpdatedMessage>(this, async _ => await RefreshSyncshellsAsync());
Mediator.Subscribe<BroadcastStatusChangedMessage>(this, async _ => await RefreshSyncshellsAsync());
}
public override async void OnOpen()
@@ -222,7 +223,7 @@ public class SyncshellFinderUI : WindowMediatorSubscriberBase
private async Task RefreshSyncshellsAsync()
{
var syncshellBroadcasts = _nameplateService.GetActiveSyncshellBroadcasts();
var syncshellBroadcasts = _broadcastScannerService.GetActiveSyncshellBroadcasts();
if (syncshellBroadcasts.Count == 0)
{

View File

@@ -13,6 +13,7 @@ namespace LightlessSync.UI
{ "LightlessPurpleDefault", "#9375d1" },
{ "ButtonDefault", "#323232" },
{ "FullBlack", "#000000" },
{ "LightlessBlue", "#a6c2ff" },
{ "LightlessYellow", "#ffe97a" },