compact ui design refactor with lightfinder redesign
This commit is contained in:
@@ -34,45 +34,65 @@ namespace LightlessSync.UI;
|
||||
|
||||
public class CompactUi : WindowMediatorSubscriberBase
|
||||
{
|
||||
private readonly CharacterAnalyzer _characterAnalyzer;
|
||||
#region Constants
|
||||
|
||||
private const float ConnectButtonHighlightThickness = 14f;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Services
|
||||
|
||||
private readonly ApiController _apiController;
|
||||
private readonly CharacterAnalyzer _characterAnalyzer;
|
||||
private readonly DalamudUtilService _dalamudUtilService;
|
||||
private readonly DrawEntityFactory _drawEntityFactory;
|
||||
private readonly FileUploadManager _fileTransferManager;
|
||||
private readonly IpcManager _ipcManager;
|
||||
private readonly LightFinderService _broadcastService;
|
||||
private readonly LightlessConfigService _configService;
|
||||
private readonly LightlessMediator _lightlessMediator;
|
||||
private readonly PairLedger _pairLedger;
|
||||
private readonly ConcurrentDictionary<GameObjectHandler, Dictionary<string, FileDownloadStatus>> _currentDownloads = new();
|
||||
private readonly DrawEntityFactory _drawEntityFactory;
|
||||
private readonly FileUploadManager _fileTransferManager;
|
||||
private readonly PlayerPerformanceConfigService _playerPerformanceConfig;
|
||||
private readonly PairUiService _pairUiService;
|
||||
private readonly SelectTagForPairUi _selectTagForPairUi;
|
||||
private readonly SelectTagForSyncshellUi _selectTagForSyncshellUi;
|
||||
private readonly SelectSyncshellForTagUi _selectSyncshellForTagUi;
|
||||
private readonly RenameSyncshellTagUi _renameSyncshellTagUi;
|
||||
private readonly SelectPairForTagUi _selectPairsForGroupUi;
|
||||
private readonly RenamePairTagUi _renamePairTagUi;
|
||||
private readonly IpcManager _ipcManager;
|
||||
private readonly PlayerPerformanceConfigService _playerPerformanceConfig;
|
||||
private readonly ServerConfigurationManager _serverManager;
|
||||
private readonly TopTabMenu _tabMenu;
|
||||
private readonly TagHandler _tagHandler;
|
||||
private readonly UiSharedService _uiSharedService;
|
||||
private readonly LightFinderService _broadcastService;
|
||||
private readonly DalamudUtilService _dalamudUtilService;
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region UI Components
|
||||
|
||||
private readonly AnimatedHeader _animatedHeader = new();
|
||||
private readonly RenamePairTagUi _renamePairTagUi;
|
||||
private readonly RenameSyncshellTagUi _renameSyncshellTagUi;
|
||||
private readonly SelectPairForTagUi _selectPairsForGroupUi;
|
||||
private readonly SelectSyncshellForTagUi _selectSyncshellForTagUi;
|
||||
private readonly SelectTagForPairUi _selectTagForPairUi;
|
||||
private readonly SelectTagForSyncshellUi _selectTagForSyncshellUi;
|
||||
private readonly SeluneBrush _seluneBrush = new();
|
||||
private readonly TopTabMenu _tabMenu;
|
||||
|
||||
#endregion
|
||||
|
||||
#region State
|
||||
|
||||
private readonly ConcurrentDictionary<GameObjectHandler, Dictionary<string, FileDownloadStatus>> _currentDownloads = new();
|
||||
private List<IDrawFolder> _drawFolders;
|
||||
private Pair? _focusedPair;
|
||||
private Pair? _lastAddedUser;
|
||||
private string _lastAddedUserComment = string.Empty;
|
||||
private Vector2 _lastPosition = Vector2.One;
|
||||
private Vector2 _lastSize = Vector2.One;
|
||||
private int _pendingFocusFrame = -1;
|
||||
private Pair? _pendingFocusPair;
|
||||
private bool _showModalForUserAddition;
|
||||
private float _transferPartHeight;
|
||||
private bool _wasOpen;
|
||||
private float _windowContentWidth;
|
||||
private readonly SeluneBrush _seluneBrush = new();
|
||||
private readonly AnimatedHeader _animatedHeader = new();
|
||||
private const float _connectButtonHighlightThickness = 14f;
|
||||
private Pair? _focusedPair;
|
||||
private Pair? _pendingFocusPair;
|
||||
private int _pendingFocusFrame = -1;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
public CompactUi(
|
||||
ILogger<CompactUi> logger,
|
||||
@@ -156,6 +176,10 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
_lightlessMediator = mediator;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Lifecycle
|
||||
|
||||
public override void OnClose()
|
||||
{
|
||||
ForceReleaseFocus();
|
||||
@@ -297,6 +321,10 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Content Drawing
|
||||
|
||||
private void DrawPairs()
|
||||
{
|
||||
float ySize = Math.Abs(_transferPartHeight) < 0.0001f
|
||||
@@ -410,11 +438,9 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
return new DownloadSummary(totalFiles, transferredFiles, transferredBytes, totalBytes);
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Auto)]
|
||||
private readonly record struct DownloadSummary(int TotalFiles, int TransferredFiles, long TransferredBytes, long TotalBytes)
|
||||
{
|
||||
public bool HasDownloads => TotalFiles > 0 || TotalBytes > 0;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Header Drawing
|
||||
|
||||
private void DrawUIDHeader()
|
||||
{
|
||||
@@ -626,6 +652,8 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
clipPadding: padding,
|
||||
highlightColorOverride: vanityGlowColor,
|
||||
highlightAlphaOverride: 0.05f);
|
||||
|
||||
ImGui.SetTooltip("Click to copy");
|
||||
}
|
||||
|
||||
if (headerItemClicked)
|
||||
@@ -633,8 +661,6 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
ImGui.SetClipboardText(uidText);
|
||||
}
|
||||
|
||||
UiSharedService.AttachToolTip("Click to copy");
|
||||
|
||||
// Connect/Disconnect button next to big UID (use screen pos to avoid affecting layout)
|
||||
DrawConnectButton(uidTextRectMin.Y + textVerticalOffset, uidTextSize.Y);
|
||||
|
||||
@@ -756,7 +782,7 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
ImGui.GetItemRectMax(),
|
||||
SeluneHighlightMode.Both,
|
||||
borderOnly: true,
|
||||
borderThicknessOverride: _connectButtonHighlightThickness,
|
||||
borderThicknessOverride: ConnectButtonHighlightThickness,
|
||||
exactSize: true,
|
||||
clipToElement: true,
|
||||
roundingOverride: ImGui.GetStyle().FrameRounding);
|
||||
@@ -766,6 +792,10 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Folder Building
|
||||
|
||||
private IEnumerable<IDrawFolder> DrawFolders
|
||||
{
|
||||
get
|
||||
@@ -901,6 +931,10 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Filtering & Sorting
|
||||
|
||||
private static bool PassesFilter(PairUiEntry entry, string filter)
|
||||
{
|
||||
if (string.IsNullOrEmpty(filter)) return true;
|
||||
@@ -1044,10 +1078,11 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
return SortGroupEntries(entries, group);
|
||||
}
|
||||
|
||||
private void UiSharedService_GposeEnd()
|
||||
{
|
||||
IsOpen = _wasOpen;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region GPose Handlers
|
||||
|
||||
private void UiSharedService_GposeEnd() => IsOpen = _wasOpen;
|
||||
|
||||
private void UiSharedService_GposeStart()
|
||||
{
|
||||
@@ -1055,6 +1090,10 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
IsOpen = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Focus Tracking
|
||||
|
||||
private void RegisterFocusCharacter(Pair pair)
|
||||
{
|
||||
_pendingFocusPair = pair;
|
||||
@@ -1100,4 +1139,16 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
_pendingFocusPair = null;
|
||||
_pendingFocusFrame = -1;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Helper Types
|
||||
|
||||
[StructLayout(LayoutKind.Auto)]
|
||||
private readonly record struct DownloadSummary(int TotalFiles, int TransferredFiles, long TransferredBytes, long TotalBytes)
|
||||
{
|
||||
public bool HasDownloads => TotalFiles > 0 || TotalBytes > 0;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user