top menu cleanup, removed duplicate old code

This commit is contained in:
choco
2026-01-03 02:08:28 +01:00
parent f7bb73bcd1
commit 9ba45670c5

View File

@@ -187,7 +187,7 @@ public class TopTabMenu
var textPos = new Vector2(badgeCenter.X - textSize.X * 0.45f, badgeCenter.Y - textSize.Y * 0.55f);
drawList.AddText(textPos, ImGui.GetColorU32(new Vector4(1, 1, 1, 1)), badgeText);
}
UiSharedService.AttachToolTip(GetLightfinderTooltip());
UiSharedService.AttachToolTip(nearbyCount > 0 ? $"Lightfinder ({nearbyCount} nearby)" : "Open Lightfinder");
ImGui.SameLine();
using (ImRaii.PushFont(UiBuilder.IconFont))
@@ -781,58 +781,13 @@ public class TopTabMenu
}
}
}
private void DrawLightfinderMenu(float availableWidth, float spacingX)
{
var lightfinderLabel = GetLightfinderTooltip();
if (_uiSharedService.IconTextButton(FontAwesomeIcon.PersonCirclePlus, lightfinderLabel, availableWidth, center: true))
{
_lightlessMediator.Publish(new UiToggleMessage(typeof(LightFinderUI)));
}
}
private string GetLightfinderTooltip()
{
if (!_lightFinderService.IsBroadcasting)
return "Open Lightfinder";
string? myHashedCid = null;
try
{
var cid = _dalamudUtilService.GetCID();
myHashedCid = cid.ToString().GetHash256();
}
catch (Exception)
{
// Couldnt get own CID, log and return default table
}
var nearbyCount = _lightFinderScannerService
.GetActiveSyncshellBroadcasts()
.Where(b =>
!string.IsNullOrEmpty(b.GID) &&
!string.Equals(b.HashedCID, myHashedCid, StringComparison.Ordinal))
.Select(b => b.GID!)
.Distinct(StringComparer.Ordinal)
.Count();
return nearbyCount > 0 ? $"Lightfinder ({nearbyCount} nearby)" : "Open Lightfinder";
}
private int GetNearbySyncshellCount()
{
if (!_lightFinderService.IsBroadcasting)
return 0;
string? myHashedCid = null;
try
{
var cid = _dalamudUtilService.GetCID();
myHashedCid = cid.ToString().GetHash256();
}
catch (Exception)
{
}
var myHashedCid = _dalamudUtilService.GetCID().ToString().GetHash256();
return _lightFinderScannerService
.GetActiveSyncshellBroadcasts()