Partially revert Mare 0.9 UI/API changes
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
using Dalamud.Interface;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Numerics;
|
||||
using System.Reflection;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Colors;
|
||||
using Dalamud.Interface.Components;
|
||||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
using Dalamud.Utility;
|
||||
using ImGuiNET;
|
||||
using MareSynchronos.API.Data.Extensions;
|
||||
using MareSynchronos.API.Dto.Group;
|
||||
using MareSynchronos.API.Dto.User;
|
||||
using MareSynchronos.MareConfiguration;
|
||||
using MareSynchronos.PlayerData.Handlers;
|
||||
using MareSynchronos.PlayerData.Pairs;
|
||||
@@ -19,10 +23,6 @@ using MareSynchronos.WebAPI.Files;
|
||||
using MareSynchronos.WebAPI.Files.Models;
|
||||
using MareSynchronos.WebAPI.SignalR.Utils;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Globalization;
|
||||
using System.Numerics;
|
||||
using System.Reflection;
|
||||
|
||||
namespace MareSynchronos.UI;
|
||||
|
||||
@@ -33,16 +33,18 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
private readonly ApiController _apiController;
|
||||
private readonly MareConfigService _configService;
|
||||
private readonly ConcurrentDictionary<GameObjectHandler, Dictionary<string, FileDownloadStatus>> _currentDownloads = new();
|
||||
private readonly DrawEntityFactory _drawEntityFactory;
|
||||
private readonly FileUploadManager _fileTransferManager;
|
||||
private readonly GroupPanel _groupPanel;
|
||||
private readonly PairGroupsUi _pairGroupsUi;
|
||||
private readonly PairManager _pairManager;
|
||||
private readonly SelectTagForPairUi _selectGroupForPairUi;
|
||||
private readonly SelectPairForTagUi _selectPairsForGroupUi;
|
||||
private readonly SelectGroupForPairUi _selectGroupForPairUi;
|
||||
private readonly SelectPairForGroupUi _selectPairsForGroupUi;
|
||||
private readonly ServerConfigurationManager _serverManager;
|
||||
private readonly TagHandler _tagHandler;
|
||||
private readonly Stopwatch _timeout = new();
|
||||
private readonly UidDisplayHandler _uidDisplayHandler;
|
||||
private readonly UiSharedService _uiShared;
|
||||
private bool _buttonState;
|
||||
private string _characterOrCommentFilter = string.Empty;
|
||||
private List<IDrawFolder> _drawFolders;
|
||||
private Pair? _lastAddedUser;
|
||||
private string _lastAddedUserComment = string.Empty;
|
||||
private Vector2 _lastPosition = Vector2.One;
|
||||
@@ -50,12 +52,11 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
private string _pairToAdd = string.Empty;
|
||||
private int _secretKeyIdx = -1;
|
||||
private bool _showModalForUserAddition;
|
||||
private bool _showSyncShells;
|
||||
private bool _wasOpen;
|
||||
|
||||
public CompactUi(ILogger<CompactUi> logger, UiSharedService uiShared, MareConfigService configService, ApiController apiController, PairManager pairManager,
|
||||
ServerConfigurationManager serverManager, MareMediator mediator, FileUploadManager fileTransferManager,
|
||||
TagHandler tagHandler, DrawEntityFactory drawEntityFactory, SelectTagForPairUi selectTagForPairUi, SelectPairForTagUi selectPairForTagUi)
|
||||
: base(logger, mediator, "###MareSynchronosMainUI")
|
||||
ServerConfigurationManager serverManager, MareMediator mediator, FileUploadManager fileTransferManager, UidDisplayHandler uidDisplayHandler) : base(logger, mediator, "###MareSynchronosMainUI")
|
||||
{
|
||||
_uiShared = uiShared;
|
||||
_configService = configService;
|
||||
@@ -63,12 +64,13 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
_pairManager = pairManager;
|
||||
_serverManager = serverManager;
|
||||
_fileTransferManager = fileTransferManager;
|
||||
_tagHandler = tagHandler;
|
||||
_drawEntityFactory = drawEntityFactory;
|
||||
_selectGroupForPairUi = selectTagForPairUi;
|
||||
_selectPairsForGroupUi = selectPairForTagUi;
|
||||
_uidDisplayHandler = uidDisplayHandler;
|
||||
var tagHandler = new TagHandler(_serverManager);
|
||||
|
||||
_drawFolders = GetDrawFolders().ToList();
|
||||
_groupPanel = new(this, uiShared, _pairManager, uidDisplayHandler, _serverManager);
|
||||
_selectGroupForPairUi = new(tagHandler, uidDisplayHandler);
|
||||
_selectPairsForGroupUi = new(tagHandler, uidDisplayHandler);
|
||||
_pairGroupsUi = new(configService, tagHandler, apiController, _selectPairsForGroupUi);
|
||||
|
||||
#if DEBUG
|
||||
string dev = "Dev Build";
|
||||
@@ -85,7 +87,6 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
Mediator.Subscribe<CutsceneEndMessage>(this, (_) => UiSharedService_GposeEnd());
|
||||
Mediator.Subscribe<DownloadStartedMessage>(this, (msg) => _currentDownloads[msg.DownloadId] = msg.DownloadStatus);
|
||||
Mediator.Subscribe<DownloadFinishedMessage>(this, (msg) => _currentDownloads.TryRemove(msg.DownloadId, out _));
|
||||
Mediator.Subscribe<RefreshUiMessage>(this, (msg) => _drawFolders = GetDrawFolders().ToList());
|
||||
|
||||
Flags |= ImGuiWindowFlags.NoDocking;
|
||||
|
||||
@@ -106,11 +107,8 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
var unsupported = "UNSUPPORTED VERSION";
|
||||
var uidTextSize = ImGui.CalcTextSize(unsupported);
|
||||
ImGui.SetCursorPosX((ImGui.GetWindowContentRegionMax().X + ImGui.GetWindowContentRegionMin().X) / 2 - uidTextSize.X / 2);
|
||||
using (ImRaii.PushFont(_uiShared.UidFont, _uiShared.UidFontBuilt))
|
||||
{
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextColored(ImGuiColors.DalamudRed, unsupported);
|
||||
}
|
||||
if (_uiShared.UidFontBuilt) ImGui.PopFont();
|
||||
UiSharedService.ColorTextWrapped($"Your Mare Synchronos installation is out of date, the current version is {ver.Major}.{ver.Minor}.{ver.Build}. " +
|
||||
$"It is highly recommended to keep Mare Synchronos up to date. Open /xlplugins and update the plugin.", ImGuiColors.DalamudRed);
|
||||
}
|
||||
@@ -118,12 +116,55 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
UiSharedService.DrawWithID("header", DrawUIDHeader);
|
||||
ImGui.Separator();
|
||||
UiSharedService.DrawWithID("serverstatus", DrawServerStatus);
|
||||
ImGui.Separator();
|
||||
|
||||
if (_apiController.ServerState is ServerState.Connected)
|
||||
{
|
||||
UiSharedService.DrawWithID("pairlist", DrawPairList);
|
||||
var hasShownSyncShells = _showSyncShells;
|
||||
|
||||
ImGui.PushFont(UiBuilder.IconFont);
|
||||
if (!hasShownSyncShells)
|
||||
{
|
||||
ImGui.PushStyleColor(ImGuiCol.Button, ImGui.GetStyle().Colors[(int)ImGuiCol.ButtonHovered]);
|
||||
}
|
||||
if (ImGui.Button(FontAwesomeIcon.User.ToIconString(), new Vector2((UiSharedService.GetWindowContentRegionWidth() - ImGui.GetWindowContentRegionMin().X) / 2, 30 * ImGuiHelpers.GlobalScale)))
|
||||
{
|
||||
_showSyncShells = false;
|
||||
}
|
||||
if (!hasShownSyncShells)
|
||||
{
|
||||
ImGui.PopStyleColor();
|
||||
}
|
||||
ImGui.PopFont();
|
||||
UiSharedService.AttachToolTip("Individual pairs");
|
||||
|
||||
ImGui.SameLine();
|
||||
|
||||
ImGui.PushFont(UiBuilder.IconFont);
|
||||
if (hasShownSyncShells)
|
||||
{
|
||||
ImGui.PushStyleColor(ImGuiCol.Button, ImGui.GetStyle().Colors[(int)ImGuiCol.ButtonHovered]);
|
||||
}
|
||||
if (ImGui.Button(FontAwesomeIcon.UserFriends.ToIconString(), new Vector2((UiSharedService.GetWindowContentRegionWidth() - ImGui.GetWindowContentRegionMin().X) / 2, 30 * ImGuiHelpers.GlobalScale)))
|
||||
{
|
||||
_showSyncShells = true;
|
||||
}
|
||||
if (hasShownSyncShells)
|
||||
{
|
||||
ImGui.PopStyleColor();
|
||||
}
|
||||
ImGui.PopFont();
|
||||
|
||||
UiSharedService.AttachToolTip("Syncshells");
|
||||
|
||||
ImGui.Separator();
|
||||
if (!hasShownSyncShells)
|
||||
{
|
||||
UiSharedService.DrawWithID("pairlist", DrawPairList);
|
||||
}
|
||||
else
|
||||
{
|
||||
UiSharedService.DrawWithID("syncshells", _groupPanel.DrawSyncshells);
|
||||
}
|
||||
ImGui.Separator();
|
||||
UiSharedService.DrawWithID("transfers", DrawTransfers);
|
||||
TransferPartHeight = ImGui.GetCursorPosY() - TransferPartHeight;
|
||||
@@ -172,6 +213,12 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnClose()
|
||||
{
|
||||
_uidDisplayHandler.Clear();
|
||||
base.OnClose();
|
||||
}
|
||||
|
||||
private void DrawAddCharacter()
|
||||
{
|
||||
ImGui.Dummy(new(10));
|
||||
@@ -203,15 +250,18 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
|
||||
private void DrawAddPair()
|
||||
{
|
||||
var buttonSize = UiSharedService.GetIconButtonSize(FontAwesomeIcon.UserPlus);
|
||||
var usersButtonSize = UiSharedService.GetIconButtonSize(FontAwesomeIcon.Users);
|
||||
ImGui.SetNextItemWidth(UiSharedService.GetWindowContentRegionWidth() - ImGui.GetWindowContentRegionMin().X - buttonSize.X - ImGui.GetStyle().ItemSpacing.X - usersButtonSize.X);
|
||||
var buttonSize = UiSharedService.GetIconButtonSize(FontAwesomeIcon.Plus);
|
||||
ImGui.SetNextItemWidth(UiSharedService.GetWindowContentRegionWidth() - ImGui.GetWindowContentRegionMin().X - buttonSize.X);
|
||||
ImGui.InputTextWithHint("##otheruid", "Other players UID/Alias", ref _pairToAdd, 20);
|
||||
ImGui.SameLine();
|
||||
var alreadyExisting = _pairManager.DirectPairs.Exists(p => string.Equals(p.UserData.UID, _pairToAdd, StringComparison.Ordinal) || string.Equals(p.UserData.Alias, _pairToAdd, StringComparison.Ordinal));
|
||||
using (ImRaii.Disabled(alreadyExisting || string.IsNullOrEmpty(_pairToAdd)))
|
||||
ImGui.SameLine(ImGui.GetWindowContentRegionMin().X + UiSharedService.GetWindowContentRegionWidth() - buttonSize.X);
|
||||
var canAdd = !_pairManager.DirectPairs.Any(p => string.Equals(p.UserData.UID, _pairToAdd, StringComparison.Ordinal) || string.Equals(p.UserData.Alias, _pairToAdd, StringComparison.Ordinal));
|
||||
if (!canAdd)
|
||||
{
|
||||
if (ImGuiComponents.IconButton(FontAwesomeIcon.UserPlus))
|
||||
ImGuiComponents.DisabledButton(FontAwesomeIcon.Plus);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ImGuiComponents.IconButton(FontAwesomeIcon.Plus))
|
||||
{
|
||||
_ = _apiController.UserAddPair(new(new(_pairToAdd)));
|
||||
_pairToAdd = string.Empty;
|
||||
@@ -219,48 +269,76 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
UiSharedService.AttachToolTip("Pair with " + (_pairToAdd.IsNullOrEmpty() ? "other user" : _pairToAdd));
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
if (ImGuiComponents.IconButton(FontAwesomeIcon.Users))
|
||||
{
|
||||
ImGui.OpenPopup("Syncshell Menu");
|
||||
}
|
||||
UiSharedService.AttachToolTip("Syncshell Menu");
|
||||
|
||||
if (ImGui.BeginPopup("Syncshell Menu"))
|
||||
{
|
||||
using (ImRaii.Disabled(_pairManager.GroupPairs.Select(k => k.Key).Distinct()
|
||||
.Count(g => string.Equals(g.OwnerUID, _apiController.UID, StringComparison.Ordinal)) >= _apiController.ServerInfo.MaxGroupsCreatedByUser))
|
||||
{
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Plus, "Create new Syncshell", _syncshellMenuSize, true))
|
||||
{
|
||||
Mediator.Publish(new OpenCreateSyncshellPopupMessage());
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
}
|
||||
|
||||
using (ImRaii.Disabled(_pairManager.GroupPairs.Select(k => k.Key).Distinct().Count() >= _apiController.ServerInfo.MaxGroupsJoinedByUser))
|
||||
{
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Users, "Join existing Syncshell", _syncshellMenuSize, true))
|
||||
{
|
||||
Mediator.Publish(new JoinSyncshellPopupMessage());
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
}
|
||||
_syncshellMenuSize = ImGui.GetWindowContentRegionMax().X - ImGui.GetWindowContentRegionMin().X;
|
||||
ImGui.EndPopup();
|
||||
}
|
||||
|
||||
ImGuiHelpers.ScaledDummy(2);
|
||||
}
|
||||
|
||||
private float _syncshellMenuSize = 0;
|
||||
|
||||
private void DrawFilter()
|
||||
{
|
||||
ImGui.SetNextItemWidth(WindowContentWidth);
|
||||
if (ImGui.InputTextWithHint("##filter", "Filter for UID/notes", ref _characterOrCommentFilter, 255))
|
||||
var buttonSize = UiSharedService.GetIconButtonSize(FontAwesomeIcon.ArrowUp);
|
||||
var playButtonSize = UiSharedService.GetIconButtonSize(FontAwesomeIcon.Play);
|
||||
|
||||
var users = GetFilteredUsers();
|
||||
var userCount = users.Count;
|
||||
|
||||
var spacing = userCount > 0
|
||||
? playButtonSize.X + ImGui.GetStyle().ItemSpacing.X
|
||||
: 0;
|
||||
|
||||
ImGui.SetNextItemWidth(WindowContentWidth - spacing);
|
||||
ImGui.InputTextWithHint("##filter", "Filter for UID/notes", ref _characterOrCommentFilter, 255);
|
||||
|
||||
if (userCount == 0) return;
|
||||
|
||||
var pausedUsers = users.Where(u => u.UserPair!.OwnPermissions.IsPaused() && u.UserPair.OtherPermissions.IsPaired()).ToList();
|
||||
var resumedUsers = users.Where(u => !u.UserPair!.OwnPermissions.IsPaused() && u.UserPair.OtherPermissions.IsPaired()).ToList();
|
||||
|
||||
if (!pausedUsers.Any() && !resumedUsers.Any()) return;
|
||||
ImGui.SameLine();
|
||||
|
||||
switch (_buttonState)
|
||||
{
|
||||
Mediator.Publish(new RefreshUiMessage());
|
||||
case true when !pausedUsers.Any():
|
||||
_buttonState = false;
|
||||
break;
|
||||
|
||||
case false when !resumedUsers.Any():
|
||||
_buttonState = true;
|
||||
break;
|
||||
|
||||
case true:
|
||||
users = pausedUsers;
|
||||
break;
|
||||
|
||||
case false:
|
||||
users = resumedUsers;
|
||||
break;
|
||||
}
|
||||
|
||||
var button = _buttonState ? FontAwesomeIcon.Play : FontAwesomeIcon.Pause;
|
||||
|
||||
if (!_timeout.IsRunning || _timeout.ElapsedMilliseconds > 15000)
|
||||
{
|
||||
_timeout.Reset();
|
||||
|
||||
if (ImGuiComponents.IconButton(button) && UiSharedService.CtrlPressed())
|
||||
{
|
||||
foreach (var entry in users)
|
||||
{
|
||||
var perm = entry.UserPair!.OwnPermissions;
|
||||
perm.SetPaused(!perm.IsPaused());
|
||||
_ = _apiController.UserSetPairPermissions(new UserPermissionsDto(entry.UserData, perm));
|
||||
}
|
||||
|
||||
_timeout.Start();
|
||||
_buttonState = !_buttonState;
|
||||
}
|
||||
UiSharedService.AttachToolTip($"Hold Control to {(button == FontAwesomeIcon.Play ? "resume" : "pause")} pairing with {users.Count} out of {userCount} displayed users.");
|
||||
}
|
||||
else
|
||||
{
|
||||
var availableAt = (15000 - _timeout.ElapsedMilliseconds) / 1000;
|
||||
ImGuiComponents.DisabledButton(button);
|
||||
UiSharedService.AttachToolTip($"Next execution is available at {availableAt} seconds");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,13 +355,19 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
var ySize = TransferPartHeight == 0
|
||||
? 1
|
||||
: (ImGui.GetWindowContentRegionMax().Y - ImGui.GetWindowContentRegionMin().Y) - TransferPartHeight - ImGui.GetCursorPosY();
|
||||
var users = GetFilteredUsers()
|
||||
.OrderBy(
|
||||
u => _configService.Current.ShowCharacterNameInsteadOfNotesForVisible && !string.IsNullOrEmpty(u.PlayerName)
|
||||
? (_configService.Current.PreferNotesOverNamesForVisible ? u.GetNote() : u.PlayerName)
|
||||
: (u.GetNote() ?? u.UserData.AliasOrUID), StringComparer.OrdinalIgnoreCase).ToList();
|
||||
|
||||
var onlineUsers = users.Where(u => u.IsOnline || u.UserPair!.OwnPermissions.IsPaused()).Select(c => new DrawUserPair("Online" + c.UserData.UID, c, _uidDisplayHandler, _apiController, Mediator, _selectGroupForPairUi)).ToList();
|
||||
var visibleUsers = users.Where(u => u.IsVisible).Select(c => new DrawUserPair("Visible" + c.UserData.UID, c, _uidDisplayHandler, _apiController, Mediator, _selectGroupForPairUi)).ToList();
|
||||
var offlineUsers = users.Where(u => !u.IsOnline && !u.UserPair!.OwnPermissions.IsPaused()).Select(c => new DrawUserPair("Offline" + c.UserData.UID, c, _uidDisplayHandler, _apiController, Mediator, _selectGroupForPairUi)).ToList();
|
||||
|
||||
ImGui.BeginChild("list", new Vector2(WindowContentWidth, ySize), border: false);
|
||||
|
||||
foreach (var item in _drawFolders)
|
||||
{
|
||||
item.Draw();
|
||||
}
|
||||
_pairGroupsUi.Draw(visibleUsers, onlineUsers, offlineUsers);
|
||||
|
||||
ImGui.EndChild();
|
||||
}
|
||||
@@ -475,119 +559,15 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<IDrawFolder> GetDrawFolders()
|
||||
private List<Pair> GetFilteredUsers()
|
||||
{
|
||||
List<IDrawFolder> drawFolders = [];
|
||||
|
||||
var users = GetFilteredGroupUsers()
|
||||
.ToDictionary(g => g.Key, g => g.Value);
|
||||
|
||||
if (_configService.Current.ShowVisibleUsersSeparately)
|
||||
{
|
||||
var visibleUsers = users.Where(u => u.Key.IsVisible)
|
||||
.OrderBy(
|
||||
u => _configService.Current.ShowCharacterNameInsteadOfNotesForVisible && !string.IsNullOrEmpty(u.Key.PlayerName)
|
||||
? (_configService.Current.PreferNotesOverNamesForVisible ? u.Key.GetNote() : u.Key.PlayerName)
|
||||
: (u.Key.GetNote() ?? u.Key.UserData.AliasOrUID), StringComparer.OrdinalIgnoreCase)
|
||||
.ToDictionary(k => k.Key, k => k.Value);
|
||||
|
||||
drawFolders.Add(_drawEntityFactory.CreateDrawTagFolder(TagHandler.CustomVisibleTag, visibleUsers));
|
||||
}
|
||||
|
||||
List<IDrawFolder> groupFolders = new();
|
||||
foreach (var group in _pairManager.GroupPairs.Select(g => g.Key).OrderBy(g => g.GroupAliasOrGID, StringComparer.Ordinal))
|
||||
{
|
||||
var groupUsers2 = users.Where(v => v.Value.Exists(g => string.Equals(g.GID, group.GID, StringComparison.Ordinal))
|
||||
&& (v.Key.IsOnline || (!v.Key.IsOnline && !_configService.Current.ShowOfflineUsersSeparately)
|
||||
|| v.Key.UserPair.OwnPermissions.IsPaused()))
|
||||
.OrderByDescending(u => u.Key.IsOnline)
|
||||
.ThenBy(u =>
|
||||
{
|
||||
if (string.Equals(u.Key.UserData.UID, group.OwnerUID, StringComparison.Ordinal)) return 0;
|
||||
if (group.GroupPairUserInfos.TryGetValue(u.Key.UserData.UID, out var info))
|
||||
{
|
||||
if (info.IsModerator()) return 1;
|
||||
if (info.IsPinned()) return 2;
|
||||
}
|
||||
return u.Key.IsVisible ? 3 : 4;
|
||||
})
|
||||
.ThenBy(
|
||||
u => _configService.Current.ShowCharacterNameInsteadOfNotesForVisible && !string.IsNullOrEmpty(u.Key.PlayerName)
|
||||
? (_configService.Current.PreferNotesOverNamesForVisible ? u.Key.GetNote() : u.Key.PlayerName)
|
||||
: (u.Key.GetNote() ?? u.Key.UserData.AliasOrUID), StringComparer.Ordinal)
|
||||
.ToDictionary(k => k.Key, k => k.Value);
|
||||
|
||||
groupFolders.Add(_drawEntityFactory.CreateDrawGroupFolder(group, groupUsers2));
|
||||
}
|
||||
|
||||
if (_configService.Current.GroupUpSyncshells)
|
||||
drawFolders.Add(new DrawGroupedGroupFolder(groupFolders, _tagHandler));
|
||||
else
|
||||
drawFolders.AddRange(groupFolders);
|
||||
|
||||
var tags = _tagHandler.GetAllTagsSorted();
|
||||
HashSet<Pair> alreadyInTags = [];
|
||||
foreach (var tag in tags)
|
||||
{
|
||||
var tagUsers = users.Where(u => u.Key.IsDirectlyPaired && !u.Key.IsOneSidedPair && _tagHandler.HasTag(u.Key.UserData.UID, tag)
|
||||
&& (u.Key.IsOnline || (!u.Key.IsOnline && !_configService.Current.ShowOfflineUsersSeparately)
|
||||
|| u.Key.UserPair.OwnPermissions.IsPaused()))
|
||||
.OrderByDescending(u => u.Key.IsVisible)
|
||||
.ThenByDescending(u => u.Key.IsOnline)
|
||||
.ThenBy(
|
||||
u => _configService.Current.ShowCharacterNameInsteadOfNotesForVisible && !string.IsNullOrEmpty(u.Key.PlayerName)
|
||||
? (_configService.Current.PreferNotesOverNamesForVisible ? u.Key.GetNote() : u.Key.PlayerName)
|
||||
: (u.Key.GetNote() ?? u.Key.UserData.AliasOrUID), StringComparer.OrdinalIgnoreCase)
|
||||
.ToDictionary(u => u.Key, u => u.Value);
|
||||
|
||||
drawFolders.Add(_drawEntityFactory.CreateDrawTagFolder(tag, tagUsers.Select(u =>
|
||||
{
|
||||
alreadyInTags.Add(u.Key);
|
||||
return (u.Key, u.Value);
|
||||
}).ToDictionary(u => u.Key, u => u.Value)));
|
||||
}
|
||||
|
||||
var onlineDirectPairedUsersNotInTags = users.Where(u => u.Key.IsDirectlyPaired && !u.Key.IsOneSidedPair && !_tagHandler.HasAnyTag(u.Key.UserData.UID)
|
||||
&& (u.Key.IsOnline || (!u.Key.IsOnline && !_configService.Current.ShowOfflineUsersSeparately)
|
||||
|| u.Key.UserPair.OwnPermissions.IsPaused()))
|
||||
.OrderByDescending(u => u.Key.IsVisible)
|
||||
.ThenByDescending(u => u.Key.IsOnline)
|
||||
.ThenBy(
|
||||
u => _configService.Current.ShowCharacterNameInsteadOfNotesForVisible && !string.IsNullOrEmpty(u.Key.PlayerName)
|
||||
? (_configService.Current.PreferNotesOverNamesForVisible ? u.Key.GetNote() : u.Key.PlayerName)
|
||||
: (u.Key.GetNote() ?? u.Key.UserData.AliasOrUID), StringComparer.OrdinalIgnoreCase)
|
||||
.ToDictionary(u => u.Key, u => u.Value);
|
||||
|
||||
drawFolders.Add(_drawEntityFactory.CreateDrawTagFolder((_configService.Current.ShowOfflineUsersSeparately ? TagHandler.CustomOnlineTag : TagHandler.CustomAllTag),
|
||||
onlineDirectPairedUsersNotInTags));
|
||||
|
||||
if (_configService.Current.ShowOfflineUsersSeparately)
|
||||
{
|
||||
var offlineUsersEntries = users.Where(u => (!u.Key.IsOneSidedPair || u.Value.Any()) && !u.Key.IsOnline && !u.Key.UserPair.OwnPermissions.IsPaused()).OrderBy(
|
||||
u => _configService.Current.ShowCharacterNameInsteadOfNotesForVisible && !string.IsNullOrEmpty(u.Key.PlayerName)
|
||||
? (_configService.Current.PreferNotesOverNamesForVisible ? u.Key.GetNote() : u.Key.PlayerName)
|
||||
: (u.Key.GetNote() ?? u.Key.UserData.AliasOrUID), StringComparer.OrdinalIgnoreCase)
|
||||
.ToDictionary(u => u.Key, u => u.Value);
|
||||
|
||||
drawFolders.Add(_drawEntityFactory.CreateDrawTagFolder(TagHandler.CustomOfflineTag, offlineUsersEntries));
|
||||
}
|
||||
|
||||
drawFolders.Add(_drawEntityFactory.CreateDrawTagFolder(TagHandler.CustomUnpairedTag, users.Where(u => u.Key.IsOneSidedPair).ToDictionary(u => u.Key, u => u.Value)));
|
||||
|
||||
return drawFolders;
|
||||
}
|
||||
|
||||
private Dictionary<Pair, List<GroupFullInfoDto>> GetFilteredGroupUsers()
|
||||
{
|
||||
if (string.IsNullOrEmpty(_characterOrCommentFilter)) return _pairManager.PairsWithGroups;
|
||||
|
||||
return _pairManager.PairsWithGroups.Where(p =>
|
||||
return _pairManager.DirectPairs.Where(p =>
|
||||
{
|
||||
if (_characterOrCommentFilter.IsNullOrEmpty()) return true;
|
||||
return p.Key.UserData.AliasOrUID.Contains(_characterOrCommentFilter, StringComparison.OrdinalIgnoreCase) ||
|
||||
(p.Key.GetNote()?.Contains(_characterOrCommentFilter, StringComparison.OrdinalIgnoreCase) ?? false) ||
|
||||
(p.Key.PlayerName?.Contains(_characterOrCommentFilter, StringComparison.OrdinalIgnoreCase) ?? false);
|
||||
}).ToDictionary(k => k.Key, k => k.Value);
|
||||
return p.UserData.AliasOrUID.Contains(_characterOrCommentFilter, StringComparison.OrdinalIgnoreCase) ||
|
||||
(p.GetNote()?.Contains(_characterOrCommentFilter, StringComparison.OrdinalIgnoreCase) ?? false) ||
|
||||
(p.PlayerName?.Contains(_characterOrCommentFilter, StringComparison.OrdinalIgnoreCase) ?? false);
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
private string GetServerError()
|
||||
|
||||
Reference in New Issue
Block a user