top menu cleanup, removed duplicate old code
This commit is contained in:
@@ -187,7 +187,7 @@ public class TopTabMenu
|
|||||||
var textPos = new Vector2(badgeCenter.X - textSize.X * 0.45f, badgeCenter.Y - textSize.Y * 0.55f);
|
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);
|
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();
|
ImGui.SameLine();
|
||||||
using (ImRaii.PushFont(UiBuilder.IconFont))
|
using (ImRaii.PushFont(UiBuilder.IconFont))
|
||||||
@@ -782,57 +782,12 @@ 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()
|
private int GetNearbySyncshellCount()
|
||||||
{
|
{
|
||||||
if (!_lightFinderService.IsBroadcasting)
|
if (!_lightFinderService.IsBroadcasting)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
string? myHashedCid = null;
|
var myHashedCid = _dalamudUtilService.GetCID().ToString().GetHash256();
|
||||||
try
|
|
||||||
{
|
|
||||||
var cid = _dalamudUtilService.GetCID();
|
|
||||||
myHashedCid = cid.ToString().GetHash256();
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
return _lightFinderScannerService
|
return _lightFinderScannerService
|
||||||
.GetActiveSyncshellBroadcasts()
|
.GetActiveSyncshellBroadcasts()
|
||||||
|
|||||||
Reference in New Issue
Block a user