diff --git a/MareSynchronos/MareSynchronos.csproj b/MareSynchronos/MareSynchronos.csproj index 0637064..b91b866 100644 --- a/MareSynchronos/MareSynchronos.csproj +++ b/MareSynchronos/MareSynchronos.csproj @@ -3,7 +3,7 @@ - 0.7.10 + 0.7.11 https://github.com/Penumbra-Sync/client diff --git a/MareSynchronos/Plugin.cs b/MareSynchronos/Plugin.cs index 6cff991..775ced9 100644 --- a/MareSynchronos/Plugin.cs +++ b/MareSynchronos/Plugin.cs @@ -182,20 +182,19 @@ public sealed class Plugin : IDalamudPlugin if (string.Equals(splitArgs[0], "toggle", StringComparison.OrdinalIgnoreCase)) { - var _serverConfigurationManager = _serviceProvider.GetRequiredService(); - var _apiController = _serviceProvider.GetRequiredService(); - if (_serverConfigurationManager.CurrentServer == null) return; + var serverConfigurationManager = _serviceProvider.GetRequiredService(); + if (serverConfigurationManager.CurrentServer == null) return; var fullPause = splitArgs.Length > 1 ? splitArgs[1] switch { "on" => false, "off" => true, - _ => !_serverConfigurationManager.CurrentServer.FullPause, - } : !_serverConfigurationManager.CurrentServer.FullPause; + _ => !serverConfigurationManager.CurrentServer.FullPause, + } : !serverConfigurationManager.CurrentServer.FullPause; - if (fullPause != _serverConfigurationManager.CurrentServer.FullPause) + if (fullPause != serverConfigurationManager.CurrentServer.FullPause) { - _serverConfigurationManager.CurrentServer.FullPause = fullPause; - _serverConfigurationManager.Save(); + serverConfigurationManager.CurrentServer.FullPause = fullPause; + serverConfigurationManager.Save(); _ = _serviceProvider.GetRequiredService().CreateConnections(); } } diff --git a/MareSynchronos/UI/Components/PairGroupsUi.cs b/MareSynchronos/UI/Components/PairGroupsUi.cs index 37f1e91..a80c8f2 100644 --- a/MareSynchronos/UI/Components/PairGroupsUi.cs +++ b/MareSynchronos/UI/Components/PairGroupsUi.cs @@ -31,19 +31,22 @@ namespace MareSynchronos.UI.Components UiShared.DrawWithID("$group-VisibleCustomTag", () => DrawCategory(TagHandler.CustomVisibleTag, visibleUsers)); foreach (var tag in tagsWithPairsInThem) { - UiShared.DrawWithID($"group-{tag}", () => DrawCategory(tag, onlineUsers)); + UiShared.DrawWithID($"group-{tag}", () => DrawCategory(tag, onlineUsers, visibleUsers)); } UiShared.DrawWithID($"group-OnlineCustomTag", () => DrawCategory(TagHandler.CustomOnlineTag, onlineUsers.Where(u => !_tagHandler.HasAnyTag(u.UserPair!)).ToList())); UiShared.DrawWithID($"group-OfflineCustomTag", () => DrawCategory(TagHandler.CustomOfflineTag, offlineUsers)); } - private void DrawCategory(string tag, List users) + private void DrawCategory(string tag, List users, List? visibleUsers = null) { List usersInThisTag; HashSet? otherUidsTaggedWithTag = null; + bool isSpecialTag = false; + int visibleInThisTag = 0; if (tag is TagHandler.CustomOfflineTag or TagHandler.CustomOnlineTag or TagHandler.CustomVisibleTag) { usersInThisTag = users; + isSpecialTag = true; } else { @@ -51,12 +54,14 @@ namespace MareSynchronos.UI.Components usersInThisTag = users .Where(pair => otherUidsTaggedWithTag.Contains(pair.UserData.UID)) .ToList(); + visibleInThisTag = visibleUsers?.Count(p => otherUidsTaggedWithTag.Contains(p.UserData.UID)) ?? 0; } - if (!usersInThisTag.Any()) return; + if (isSpecialTag && !usersInThisTag.Any()) return; - DrawName(tag, usersInThisTag.Count, otherUidsTaggedWithTag?.Count); - UiShared.DrawWithID($"group-{tag}-buttons", () => DrawButtons(tag, usersInThisTag)); + DrawName(tag, isSpecialTag, visibleInThisTag, usersInThisTag.Count, otherUidsTaggedWithTag?.Count); + if (!isSpecialTag) + UiShared.DrawWithID($"group-{tag}-buttons", () => DrawButtons(tag, usersInThisTag)); if (!_tagHandler.IsTagOpen(tag)) return; @@ -65,7 +70,7 @@ namespace MareSynchronos.UI.Components ImGui.Unindent(20); } - private void DrawName(string tag, int count, int? total) + private void DrawName(string tag, bool isSpecialTag, int visible, int online, int? total) { string displayedName = tag switch { @@ -75,7 +80,7 @@ namespace MareSynchronos.UI.Components _ => tag }; - string resultFolderName = total != null ? $"{displayedName} ({count}/{total} Pairs)" : $"{displayedName} ({count} Pairs)"; + string resultFolderName = !isSpecialTag ? $"{displayedName} ({visible}/{online}/{total} Pairs)" : $"{displayedName} ({online} Pairs)"; // FontAwesomeIcon.CaretSquareDown : FontAwesomeIcon.CaretSquareRight var icon = _tagHandler.IsTagOpen(tag) ? FontAwesomeIcon.CaretSquareDown : FontAwesomeIcon.CaretSquareRight; @@ -90,6 +95,17 @@ namespace MareSynchronos.UI.Components { ToggleTagOpen(tag); } + + if (!isSpecialTag && ImGui.IsItemHovered()) + { + ImGui.BeginTooltip(); + ImGui.TextUnformatted($"Group {tag}"); + ImGui.Separator(); + ImGui.TextUnformatted($"{visible} Pairs visible"); + ImGui.TextUnformatted($"{online} Pairs online"); + ImGui.TextUnformatted($"{total} Pairs total"); + ImGui.EndTooltip(); + } } private void DrawButtons(string tag, List availablePairsInThisTag)