Fixed finder again.
This commit is contained in:
@@ -178,9 +178,9 @@ public class LightFinderUI : WindowMediatorSubscriberBase
|
||||
new("Debug", LightfinderTabDebug.Debug)
|
||||
};
|
||||
UiSharedService.Tab("LightfinderTabs", debugTabOptions, ref _selectedTabDebug);
|
||||
|
||||
|
||||
ImGuiHelpers.ScaledDummy(4f);
|
||||
|
||||
|
||||
switch (_selectedTabDebug)
|
||||
{
|
||||
case LightfinderTabDebug.NearbySyncshells:
|
||||
@@ -304,14 +304,14 @@ public class LightFinderUI : WindowMediatorSubscriberBase
|
||||
var nearbySyncshellCount = _nearbySyncshells.Count;
|
||||
var nearbySyncshellColor = nearbySyncshellCount > 0 ? UIColors.Get("LightlessPurple") : infoColor;
|
||||
DrawStatusCell(FontAwesomeIcon.Compass, nearbySyncshellColor, nearbySyncshellCount.ToString(), "Syncshells", infoColor, scale);
|
||||
|
||||
|
||||
// Nearby players cell (exclude self)
|
||||
string? myHashedCidForCount = null;
|
||||
try { myHashedCidForCount = _dalamudUtilService.GetCID().ToString().GetHash256(); } catch { }
|
||||
var nearbyPlayerCount = _broadcastScannerService.CountActiveBroadcasts(myHashedCidForCount);
|
||||
var nearbyPlayerColor = nearbyPlayerCount > 0 ? UIColors.Get("LightlessBlue") : infoColor;
|
||||
DrawStatusCell(FontAwesomeIcon.Users, nearbyPlayerColor, nearbyPlayerCount.ToString(), "Players", infoColor, scale);
|
||||
|
||||
|
||||
// Broadcasting syncshell cell
|
||||
var isBroadcastingSyncshell = _configService.Current.SyncshellFinderEnabled && isBroadcasting;
|
||||
var broadcastSyncshellColor = isBroadcastingSyncshell ? UIColors.Get("LightlessGreen") : infoColor;
|
||||
@@ -321,7 +321,7 @@ public class LightFinderUI : WindowMediatorSubscriberBase
|
||||
|
||||
// Enable/Disable button cell - right aligned
|
||||
ImGui.TableNextColumn();
|
||||
|
||||
|
||||
float cellWidth = ImGui.GetContentRegionAvail().X;
|
||||
float offsetX = cellWidth - buttonWidth;
|
||||
if (offsetX > 0)
|
||||
@@ -381,11 +381,11 @@ public class LightFinderUI : WindowMediatorSubscriberBase
|
||||
private void UpdateItemAnimations(IEnumerable<string> visibleItemIds)
|
||||
{
|
||||
var deltaTime = ImGui.GetIO().DeltaTime;
|
||||
|
||||
|
||||
_previousVisibleItems.Clear();
|
||||
foreach (var id in _currentVisibleItems)
|
||||
_previousVisibleItems.Add(id);
|
||||
|
||||
|
||||
_currentVisibleItems.Clear();
|
||||
foreach (var id in visibleItemIds)
|
||||
_currentVisibleItems.Add(id);
|
||||
@@ -395,7 +395,7 @@ public class LightFinderUI : WindowMediatorSubscriberBase
|
||||
{
|
||||
if (!_itemAlpha.ContainsKey(id))
|
||||
_itemAlpha[id] = 0f;
|
||||
|
||||
|
||||
_itemAlpha[id] = Math.Min(1f, _itemAlpha[id] + deltaTime * AnimationSpeed);
|
||||
}
|
||||
|
||||
@@ -410,7 +410,7 @@ public class LightFinderUI : WindowMediatorSubscriberBase
|
||||
toRemove.Add(id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach (var id in toRemove)
|
||||
_itemAlpha.Remove(id);
|
||||
}
|
||||
@@ -668,14 +668,14 @@ public class LightFinderUI : WindowMediatorSubscriberBase
|
||||
ImGui.PopID();
|
||||
}
|
||||
|
||||
private void DrawJoinButton(GroupJoinDto shell, bool fullWidth)
|
||||
private void DrawJoinButton(GroupJoinDto shell, bool fullWidth)
|
||||
{
|
||||
const string visibleLabel = "Join";
|
||||
var label = $"{visibleLabel}##{shell.Group.GID}";
|
||||
|
||||
var isAlreadyMember = _currentSyncshells.Exists(g => string.Equals(g.GID, shell.Group.GID, StringComparison.Ordinal));
|
||||
var isRecentlyJoined = _recentlyJoined.Contains(shell.Group.GID);
|
||||
var isOwnBroadcast = _configService.Current.SyncshellFinderEnabled
|
||||
var isOwnBroadcast = _configService.Current.SyncshellFinderEnabled
|
||||
&& _broadcastService.IsBroadcasting
|
||||
&& string.Equals(_configService.Current.SelectedFinderSyncshell, shell.Group.GID, StringComparison.Ordinal);
|
||||
|
||||
@@ -758,7 +758,7 @@ public class LightFinderUI : WindowMediatorSubscriberBase
|
||||
if (_joinDto == null || _joinInfo == null) return;
|
||||
|
||||
var scale = ImGuiHelpers.GlobalScale;
|
||||
|
||||
|
||||
// if not already open
|
||||
if (!ImGui.IsPopupOpen("JoinSyncshellModal"))
|
||||
ImGui.OpenPopup("JoinSyncshellModal");
|
||||
@@ -774,12 +774,12 @@ public class LightFinderUI : WindowMediatorSubscriberBase
|
||||
ImGui.SetNextWindowSize(new Vector2(modalWidth, modalHeight));
|
||||
ImGui.PushStyleVar(ImGuiStyleVar.WindowRounding, 6f * ImGuiHelpers.GlobalScale);
|
||||
ImGui.PushStyleColor(ImGuiCol.Border, Vector4.Zero);
|
||||
|
||||
|
||||
using ImRaii.Color modalBorder = ImRaii.PushColor(ImGuiCol.Border, UIColors.Get("LightlessPurple").WithAlpha(0.5f));
|
||||
using ImRaii.Style rounding = ImRaii.PushStyle(ImGuiStyleVar.WindowRounding, 8f * scale);
|
||||
using ImRaii.Style borderSize = ImRaii.PushStyle(ImGuiStyleVar.WindowBorderSize, 2f * scale);
|
||||
using ImRaii.Style padding = ImRaii.PushStyle(ImGuiStyleVar.WindowPadding, new Vector2(16f * scale, 16f * scale));
|
||||
|
||||
|
||||
ImGuiWindowFlags flags = ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoScrollbar;
|
||||
if (ImGui.BeginPopupModal("JoinSyncshellModal", ref _joinModalOpen, flags))
|
||||
{
|
||||
@@ -798,22 +798,22 @@ public class LightFinderUI : WindowMediatorSubscriberBase
|
||||
ImGui.TextColored(ImGuiColors.DalamudWhite, "Permissions");
|
||||
ImGuiHelpers.ScaledDummy(6f);
|
||||
|
||||
DrawPermissionToggleRow("Sounds", FontAwesomeIcon.VolumeUp,
|
||||
_joinInfo.GroupPermissions.IsPreferDisableSounds(),
|
||||
_ownPermissions.DisableGroupSounds,
|
||||
v => _ownPermissions.DisableGroupSounds = v,
|
||||
DrawPermissionToggleRow("Sounds", FontAwesomeIcon.VolumeUp,
|
||||
_joinInfo.GroupPermissions.IsPreferDisableSounds(),
|
||||
_ownPermissions.DisableGroupSounds,
|
||||
v => _ownPermissions.DisableGroupSounds = v,
|
||||
contentWidth);
|
||||
|
||||
DrawPermissionToggleRow("Animations", FontAwesomeIcon.Running,
|
||||
_joinInfo.GroupPermissions.IsPreferDisableAnimations(),
|
||||
_ownPermissions.DisableGroupAnimations,
|
||||
v => _ownPermissions.DisableGroupAnimations = v,
|
||||
DrawPermissionToggleRow("Animations", FontAwesomeIcon.Running,
|
||||
_joinInfo.GroupPermissions.IsPreferDisableAnimations(),
|
||||
_ownPermissions.DisableGroupAnimations,
|
||||
v => _ownPermissions.DisableGroupAnimations = v,
|
||||
contentWidth);
|
||||
|
||||
DrawPermissionToggleRow("VFX", FontAwesomeIcon.Magic,
|
||||
_joinInfo.GroupPermissions.IsPreferDisableVFX(),
|
||||
_ownPermissions.DisableGroupVFX,
|
||||
v => _ownPermissions.DisableGroupVFX = v,
|
||||
DrawPermissionToggleRow("VFX", FontAwesomeIcon.Magic,
|
||||
_joinInfo.GroupPermissions.IsPreferDisableVFX(),
|
||||
_ownPermissions.DisableGroupVFX,
|
||||
v => _ownPermissions.DisableGroupVFX = v,
|
||||
contentWidth);
|
||||
|
||||
ImGuiHelpers.ScaledDummy(12f);
|
||||
@@ -879,13 +879,13 @@ public class LightFinderUI : WindowMediatorSubscriberBase
|
||||
var scale = ImGuiHelpers.GlobalScale;
|
||||
float rowHeight = 28f * scale;
|
||||
bool isDifferent = current != suggested;
|
||||
|
||||
|
||||
using (ImRaii.PushStyle(ImGuiStyleVar.FrameRounding, 4f * scale))
|
||||
using (ImRaii.PushStyle(ImGuiStyleVar.ChildRounding, 4f * scale))
|
||||
using (ImRaii.PushColor(ImGuiCol.ChildBg, new Vector4(0.18f, 0.15f, 0.22f, 0.6f)))
|
||||
{
|
||||
ImGui.BeginChild($"PermRow_{label}", new Vector2(contentWidth, rowHeight), false, ImGuiWindowFlags.NoScrollbar);
|
||||
|
||||
|
||||
float innerPadding = 8f * scale;
|
||||
ImGui.SetCursorPos(new Vector2(innerPadding, (rowHeight - ImGui.GetTextLineHeight()) * 0.5f));
|
||||
|
||||
@@ -893,7 +893,7 @@ public class LightFinderUI : WindowMediatorSubscriberBase
|
||||
var enabledColor = UIColors.Get("LightlessGreen");
|
||||
var disabledColor = UIColors.Get("DimRed");
|
||||
var currentColor = !current ? enabledColor : disabledColor;
|
||||
|
||||
|
||||
_uiSharedService.IconText(icon, currentColor);
|
||||
ImGui.SameLine(0f, 6f * scale);
|
||||
ImGui.TextUnformatted(label);
|
||||
@@ -921,7 +921,7 @@ public class LightFinderUI : WindowMediatorSubscriberBase
|
||||
float applyX = contentWidth - 26f * scale;
|
||||
ImGui.SetCursorPosX(applyX);
|
||||
ImGui.SetCursorPosY((rowHeight - ImGui.GetFrameHeight()) * 0.5f);
|
||||
|
||||
|
||||
using (ImRaii.PushColor(ImGuiCol.Button, UIColors.Get("LightlessGreen").WithAlpha(0.6f)))
|
||||
using (ImRaii.PushColor(ImGuiCol.ButtonHovered, UIColors.Get("LightlessGreen")))
|
||||
using (ImRaii.PushColor(ImGuiCol.ButtonActive, UIColors.Get("LightlessGreenDefault")))
|
||||
@@ -1037,12 +1037,12 @@ public class LightFinderUI : WindowMediatorSubscriberBase
|
||||
}
|
||||
|
||||
private readonly record struct NearbyPlayerData(
|
||||
string HashedCid,
|
||||
string Name,
|
||||
string? World,
|
||||
nint Address,
|
||||
Pair? Pair,
|
||||
bool IsDirectlyPaired,
|
||||
string HashedCid,
|
||||
string Name,
|
||||
string? World,
|
||||
nint Address,
|
||||
Pair? Pair,
|
||||
bool IsDirectlyPaired,
|
||||
List<string> SharedSyncshells);
|
||||
|
||||
private void DrawNearbyPlayerRow(NearbyPlayerData data)
|
||||
@@ -1096,8 +1096,8 @@ public class LightFinderUI : WindowMediatorSubscriberBase
|
||||
ImGui.SetCursorPosX(startX);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.Users, UIColors.Get("LightlessPurple"));
|
||||
ImGui.SameLine(0f, 4f * ImGuiHelpers.GlobalScale);
|
||||
var shellText = data.SharedSyncshells.Count == 1
|
||||
? data.SharedSyncshells[0]
|
||||
var shellText = data.SharedSyncshells.Count == 1
|
||||
? data.SharedSyncshells[0]
|
||||
: $"{data.SharedSyncshells.Count} shared shells";
|
||||
ImGui.TextColored(UIColors.Get("LightlessPurple"), shellText);
|
||||
if (data.SharedSyncshells.Count > 1 && ImGui.IsItemHovered())
|
||||
@@ -1380,6 +1380,8 @@ public class LightFinderUI : WindowMediatorSubscriberBase
|
||||
ImGui.PopStyleVar();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void DrawDebugTab()
|
||||
{
|
||||
#if DEBUG
|
||||
@@ -1467,8 +1469,6 @@ public class LightFinderUI : WindowMediatorSubscriberBase
|
||||
#endif
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Data Refresh
|
||||
|
||||
private async Task RefreshSyncshellsAsync()
|
||||
@@ -1736,4 +1736,4 @@ public class LightFinderUI : WindowMediatorSubscriberBase
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user