sigma update

This commit is contained in:
2026-01-16 11:00:58 +09:00
parent 59ed03a825
commit 96123d00a2
51 changed files with 6640 additions and 1382 deletions

View File

@@ -22,13 +22,16 @@ public class DrawGroupedGroupFolder : IDrawFolder
private readonly ApiController _apiController;
private readonly SelectSyncshellForTagUi _selectSyncshellForTagUi;
private readonly RenameSyncshellTagUi _renameSyncshellTagUi;
private readonly HashSet<string> _onlinePairBuffer = new(StringComparer.Ordinal);
private IImmutableList<DrawUserPair>? _drawPairsCache;
private int? _totalPairsCache;
private bool _wasHovered = false;
private float _menuWidth;
private bool _rowClickArmed;
public IImmutableList<DrawUserPair> DrawPairs => _groups.SelectMany(g => g.GroupDrawFolder.DrawPairs).ToImmutableList();
public int OnlinePairs => _groups.SelectMany(g => g.GroupDrawFolder.DrawPairs).Where(g => g.Pair.IsOnline).DistinctBy(g => g.Pair.UserData.UID).Count();
public int TotalPairs => _groups.Sum(g => g.GroupDrawFolder.TotalPairs);
public IImmutableList<DrawUserPair> DrawPairs => _drawPairsCache ??= _groups.SelectMany(g => g.GroupDrawFolder.DrawPairs).ToImmutableList();
public int OnlinePairs => CountOnlinePairs(DrawPairs);
public int TotalPairs => _totalPairsCache ??= _groups.Sum(g => g.GroupDrawFolder.TotalPairs);
public DrawGroupedGroupFolder(IEnumerable<GroupFolder> groups, TagHandler tagHandler, ApiController apiController, UiSharedService uiSharedService, SelectSyncshellForTagUi selectSyncshellForTagUi, RenameSyncshellTagUi renameSyncshellTagUi, string tag)
{
@@ -50,6 +53,10 @@ public class DrawGroupedGroupFolder : IDrawFolder
}
using var id = ImRaii.PushId(_id);
var drawPairs = DrawPairs;
var onlinePairs = CountOnlinePairs(drawPairs);
var totalPairs = TotalPairs;
var hasPairs = drawPairs.Count > 0;
var color = ImRaii.PushColor(ImGuiCol.ChildBg, ImGui.GetColorU32(ImGuiCol.FrameBgHovered), _wasHovered);
var allowRowClick = string.IsNullOrEmpty(_tag);
var suppressRowToggle = false;
@@ -85,10 +92,10 @@ public class DrawGroupedGroupFolder : IDrawFolder
{
ImGui.SameLine();
ImGui.AlignTextToFramePadding();
ImGui.TextUnformatted("[" + OnlinePairs.ToString() + "]");
ImGui.TextUnformatted("[" + onlinePairs.ToString() + "]");
}
UiSharedService.AttachToolTip(OnlinePairs + " online in all of your joined syncshells" + Environment.NewLine +
TotalPairs + " pairs combined in all of your joined syncshells");
UiSharedService.AttachToolTip(onlinePairs + " online in all of your joined syncshells" + Environment.NewLine +
totalPairs + " pairs combined in all of your joined syncshells");
ImGui.SameLine();
ImGui.AlignTextToFramePadding();
if (_tag != "")
@@ -96,7 +103,7 @@ public class DrawGroupedGroupFolder : IDrawFolder
ImGui.TextUnformatted(_tag);
ImGui.SameLine();
DrawPauseButton();
DrawPauseButton(hasPairs);
ImGui.SameLine();
DrawMenu(ref suppressRowToggle);
} else
@@ -104,7 +111,7 @@ public class DrawGroupedGroupFolder : IDrawFolder
ImGui.TextUnformatted("All Syncshells");
ImGui.SameLine();
DrawPauseButton();
DrawPauseButton(hasPairs);
}
}
color.Dispose();
@@ -151,9 +158,9 @@ public class DrawGroupedGroupFolder : IDrawFolder
}
}
protected void DrawPauseButton()
protected void DrawPauseButton(bool hasPairs)
{
if (DrawPairs.Count > 0)
if (hasPairs)
{
var isPaused = _groups.Select(g => g.GroupFullInfo).All(g => g.GroupUserPermissions.IsPaused());
FontAwesomeIcon pauseIcon = isPaused ? FontAwesomeIcon.Play : FontAwesomeIcon.Pause;
@@ -179,6 +186,27 @@ public class DrawGroupedGroupFolder : IDrawFolder
}
}
private int CountOnlinePairs(IImmutableList<DrawUserPair> drawPairs)
{
if (drawPairs.Count == 0)
{
return 0;
}
_onlinePairBuffer.Clear();
foreach (var pair in drawPairs)
{
if (!pair.Pair.IsOnline)
{
continue;
}
_onlinePairBuffer.Add(pair.Pair.UserData.UID);
}
return _onlinePairBuffer.Count;
}
protected void ChangePauseStateGroups()
{
foreach(var group in _groups)