Merge branch '1.12.3' of https://git.lightless-sync.org/Lightless-Sync/LightlessClient into 1.12.3
This commit is contained in:
@@ -22,13 +22,12 @@ public class DownloadUi : WindowMediatorSubscriberBase
|
||||
private readonly UiSharedService _uiShared;
|
||||
private readonly PairProcessingLimiter _pairProcessingLimiter;
|
||||
private readonly ConcurrentDictionary<GameObjectHandler, bool> _uploadingPlayers = new();
|
||||
private readonly NotificationService _notificationService;
|
||||
private bool _notificationDismissed = true;
|
||||
private int _lastDownloadStateHash = 0;
|
||||
|
||||
public DownloadUi(ILogger<DownloadUi> logger, DalamudUtilService dalamudUtilService, LightlessConfigService configService,
|
||||
PairProcessingLimiter pairProcessingLimiter, FileUploadManager fileTransferManager, LightlessMediator mediator, UiSharedService uiShared,
|
||||
PerformanceCollectorService performanceCollectorService, NotificationService notificationService)
|
||||
PerformanceCollectorService performanceCollectorService)
|
||||
: base(logger, mediator, "Lightless Sync Downloads", performanceCollectorService)
|
||||
{
|
||||
_dalamudUtilService = dalamudUtilService;
|
||||
@@ -36,7 +35,6 @@ public class DownloadUi : WindowMediatorSubscriberBase
|
||||
_pairProcessingLimiter = pairProcessingLimiter;
|
||||
_fileTransferManager = fileTransferManager;
|
||||
_uiShared = uiShared;
|
||||
_notificationService = notificationService;
|
||||
|
||||
SizeConstraints = new WindowSizeConstraints()
|
||||
{
|
||||
@@ -359,7 +357,7 @@ public class DownloadUi : WindowMediatorSubscriberBase
|
||||
_lastDownloadStateHash = currentHash;
|
||||
if (downloadStatus.Count > 0 || queueWaiting > 0)
|
||||
{
|
||||
_notificationService.ShowPairDownloadNotification(downloadStatus, queueWaiting);
|
||||
Mediator.Publish(new PairDownloadStatusMessage(downloadStatus, queueWaiting));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,17 +15,17 @@ using Dalamud.Bindings.ImGui;
|
||||
|
||||
namespace LightlessSync.UI;
|
||||
|
||||
public class LightlessNotificationUI : WindowMediatorSubscriberBase
|
||||
public class LightlessNotificationUi : WindowMediatorSubscriberBase
|
||||
{
|
||||
private const float NotificationMinHeight = 60f;
|
||||
private const float NotificationMaxHeight = 250f;
|
||||
private const float WindowPaddingOffset = 6f;
|
||||
private const float SlideAnimationDistance = 100f;
|
||||
private const float OutAnimationSpeedMultiplier = 0.7f;
|
||||
private const float ContentPaddingX = 10f;
|
||||
private const float ContentPaddingY = 6f;
|
||||
private const float TitleMessageSpacing = 4f;
|
||||
private const float ActionButtonSpacing = 8f;
|
||||
private const float _notificationMinHeight = 60f;
|
||||
private const float _notificationMaxHeight = 250f;
|
||||
private const float _windowPaddingOffset = 6f;
|
||||
private const float _slideAnimationDistance = 100f;
|
||||
private const float _outAnimationSpeedMultiplier = 0.7f;
|
||||
private const float _contentPaddingX = 10f;
|
||||
private const float _contentPaddingY = 6f;
|
||||
private const float _titleMessageSpacing = 4f;
|
||||
private const float _actionButtonSpacing = 8f;
|
||||
|
||||
private readonly List<LightlessNotification> _notifications = new();
|
||||
private readonly object _notificationLock = new();
|
||||
@@ -33,7 +33,7 @@ public class LightlessNotificationUI : WindowMediatorSubscriberBase
|
||||
private readonly Dictionary<string, float> _notificationYOffsets = new();
|
||||
private readonly Dictionary<string, float> _notificationTargetYOffsets = new();
|
||||
|
||||
public LightlessNotificationUI(ILogger<LightlessNotificationUI> logger, LightlessMediator mediator, PerformanceCollectorService performanceCollector, LightlessConfigService configService)
|
||||
public LightlessNotificationUi(ILogger<LightlessNotificationUi> logger, LightlessMediator mediator, PerformanceCollectorService performanceCollector, LightlessConfigService configService)
|
||||
: base(logger, mediator, "Lightless Notifications##LightlessNotifications", performanceCollector)
|
||||
{
|
||||
_configService = configService;
|
||||
@@ -155,8 +155,8 @@ public class LightlessNotificationUI : WindowMediatorSubscriberBase
|
||||
var width = _configService.Current.NotificationWidth;
|
||||
|
||||
float posX = corner == NotificationCorner.Left
|
||||
? viewport.WorkPos.X + offsetX - WindowPaddingOffset
|
||||
: viewport.WorkPos.X + viewport.WorkSize.X - width - offsetX - WindowPaddingOffset;
|
||||
? viewport.WorkPos.X + offsetX - _windowPaddingOffset
|
||||
: viewport.WorkPos.X + viewport.WorkSize.X - width - offsetX - _windowPaddingOffset;
|
||||
|
||||
return new Vector2(posX, viewport.WorkPos.Y);
|
||||
}
|
||||
@@ -274,7 +274,7 @@ public class LightlessNotificationUI : WindowMediatorSubscriberBase
|
||||
else if (notification.IsAnimatingOut && notification.AnimationProgress > 0f)
|
||||
{
|
||||
notification.AnimationProgress = Math.Max(0f,
|
||||
notification.AnimationProgress - deltaTime * _configService.Current.NotificationAnimationSpeed * OutAnimationSpeedMultiplier);
|
||||
notification.AnimationProgress - deltaTime * _configService.Current.NotificationAnimationSpeed * _outAnimationSpeedMultiplier);
|
||||
}
|
||||
else if (!notification.IsAnimatingOut && !notification.IsDismissed)
|
||||
{
|
||||
@@ -289,7 +289,7 @@ public class LightlessNotificationUI : WindowMediatorSubscriberBase
|
||||
|
||||
private Vector2 CalculateSlideOffset(float alpha)
|
||||
{
|
||||
var distance = (1f - alpha) * SlideAnimationDistance;
|
||||
var distance = (1f - alpha) * _slideAnimationDistance;
|
||||
var corner = _configService.Current.NotificationCorner;
|
||||
return corner == NotificationCorner.Left ? new Vector2(-distance, 0) : new Vector2(distance, 0);
|
||||
}
|
||||
@@ -466,7 +466,7 @@ public class LightlessNotificationUI : WindowMediatorSubscriberBase
|
||||
|
||||
private void DrawNotificationText(LightlessNotification notification, float alpha)
|
||||
{
|
||||
var contentPos = new Vector2(ContentPaddingX, ContentPaddingY);
|
||||
var contentPos = new Vector2(_contentPaddingX, _contentPaddingY);
|
||||
var windowSize = ImGui.GetWindowSize();
|
||||
var contentWidth = CalculateContentWidth(windowSize.X);
|
||||
|
||||
@@ -483,7 +483,7 @@ public class LightlessNotificationUI : WindowMediatorSubscriberBase
|
||||
}
|
||||
|
||||
private float CalculateContentWidth(float windowWidth) =>
|
||||
windowWidth - (ContentPaddingX * 2);
|
||||
windowWidth - (_contentPaddingX * 2);
|
||||
|
||||
private bool HasActions(LightlessNotification notification) =>
|
||||
notification.Actions.Count > 0;
|
||||
@@ -491,9 +491,9 @@ public class LightlessNotificationUI : WindowMediatorSubscriberBase
|
||||
private void PositionActionsAtBottom(float windowHeight)
|
||||
{
|
||||
var actionHeight = ImGui.GetFrameHeight();
|
||||
var bottomY = windowHeight - ContentPaddingY - actionHeight;
|
||||
var bottomY = windowHeight - _contentPaddingY - actionHeight;
|
||||
ImGui.SetCursorPosY(bottomY);
|
||||
ImGui.SetCursorPosX(ContentPaddingX);
|
||||
ImGui.SetCursorPosX(_contentPaddingX);
|
||||
}
|
||||
|
||||
private float DrawTitle(LightlessNotification notification, float contentWidth, float alpha)
|
||||
@@ -530,7 +530,7 @@ public class LightlessNotificationUI : WindowMediatorSubscriberBase
|
||||
{
|
||||
if (string.IsNullOrEmpty(notification.Message)) return;
|
||||
|
||||
var messagePos = contentPos + new Vector2(0f, titleHeight + TitleMessageSpacing);
|
||||
var messagePos = contentPos + new Vector2(0f, titleHeight + _titleMessageSpacing);
|
||||
var messageColor = new Vector4(0.9f, 0.9f, 0.9f, alpha);
|
||||
|
||||
ImGui.SetCursorPos(messagePos);
|
||||
@@ -563,13 +563,13 @@ public class LightlessNotificationUI : WindowMediatorSubscriberBase
|
||||
|
||||
private float CalculateActionButtonWidth(int actionCount, float availableWidth)
|
||||
{
|
||||
var totalSpacing = (actionCount - 1) * ActionButtonSpacing;
|
||||
var totalSpacing = (actionCount - 1) * _actionButtonSpacing;
|
||||
return (availableWidth - totalSpacing) / actionCount;
|
||||
}
|
||||
|
||||
private void PositionActionButton(int index, float startX, float buttonWidth)
|
||||
{
|
||||
var xPosition = startX + index * (buttonWidth + ActionButtonSpacing);
|
||||
var xPosition = startX + index * (buttonWidth + _actionButtonSpacing);
|
||||
ImGui.SetCursorPosX(xPosition);
|
||||
}
|
||||
|
||||
@@ -687,7 +687,7 @@ public class LightlessNotificationUI : WindowMediatorSubscriberBase
|
||||
height += 12f;
|
||||
}
|
||||
|
||||
return Math.Clamp(height, NotificationMinHeight, NotificationMaxHeight);
|
||||
return Math.Clamp(height, _notificationMinHeight, _notificationMaxHeight);
|
||||
}
|
||||
|
||||
private float CalculateTitleHeight(LightlessNotification notification, float contentWidth)
|
||||
|
||||
@@ -63,7 +63,6 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
private readonly IProgress<(int, int, FileCacheEntity)> _validationProgress;
|
||||
private readonly NameplateService _nameplateService;
|
||||
private readonly NameplateHandler _nameplateHandler;
|
||||
private readonly NotificationService _lightlessNotificationService;
|
||||
private (int, int, FileCacheEntity) _currentProgress;
|
||||
private bool _deleteAccountPopupModalShown = false;
|
||||
private bool _deleteFilesPopupModalShown = false;
|
||||
@@ -107,8 +106,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
IpcManager ipcManager, CacheMonitor cacheMonitor,
|
||||
DalamudUtilService dalamudUtilService, HttpClient httpClient,
|
||||
NameplateService nameplateService,
|
||||
NameplateHandler nameplateHandler,
|
||||
NotificationService lightlessNotificationService) : base(logger, mediator, "Lightless Sync Settings",
|
||||
NameplateHandler nameplateHandler) : base(logger, mediator, "Lightless Sync Settings",
|
||||
performanceCollector)
|
||||
{
|
||||
_configService = configService;
|
||||
@@ -130,7 +128,6 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
_uiShared = uiShared;
|
||||
_nameplateService = nameplateService;
|
||||
_nameplateHandler = nameplateHandler;
|
||||
_lightlessNotificationService = lightlessNotificationService;
|
||||
AllowClickthrough = false;
|
||||
AllowPinning = true;
|
||||
_validationProgress = new Progress<(int, int, FileCacheEntity)>(v => _currentProgress = v);
|
||||
@@ -3616,20 +3613,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
{
|
||||
if (ImGui.Button($"{FontAwesomeIcon.Play.ToIconString()}##test_pair", new Vector2(availableWidth, 0)))
|
||||
{
|
||||
_lightlessNotificationService.ShowPairRequestNotification(
|
||||
"Test User",
|
||||
"test-uid-123",
|
||||
() =>
|
||||
{
|
||||
Mediator.Publish(new NotificationMessage("Accepted", "You accepted the test pair request.",
|
||||
NotificationType.Info));
|
||||
},
|
||||
() =>
|
||||
{
|
||||
Mediator.Publish(new NotificationMessage("Declined", "You declined the test pair request.",
|
||||
NotificationType.Info));
|
||||
}
|
||||
);
|
||||
Mediator.Publish(new PairRequestReceivedMessage("test-uid-123", "Test User wants to pair with you."));
|
||||
}
|
||||
}
|
||||
UiSharedService.AttachToolTip("Test pair request notification");
|
||||
@@ -3652,15 +3636,14 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
{
|
||||
if (ImGui.Button($"{FontAwesomeIcon.Play.ToIconString()}##test_download", new Vector2(availableWidth, 0)))
|
||||
{
|
||||
_lightlessNotificationService.ShowPairDownloadNotification(
|
||||
new List<(string playerName, float progress, string status)>
|
||||
{
|
||||
Mediator.Publish(new PairDownloadStatusMessage(
|
||||
[
|
||||
("Player One", 0.35f, "downloading"),
|
||||
("Player Two", 0.75f, "downloading"),
|
||||
("Player Three", 1.0f, "downloading")
|
||||
},
|
||||
queueWaiting: 2
|
||||
);
|
||||
],
|
||||
2
|
||||
));
|
||||
}
|
||||
}
|
||||
UiSharedService.AttachToolTip("Test download progress notification");
|
||||
|
||||
@@ -52,12 +52,12 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
|
||||
private float _particleSpawnTimer;
|
||||
private readonly Random _random = new();
|
||||
|
||||
private const float HeaderHeight = 150f;
|
||||
private const float ParticleSpawnInterval = 0.2f;
|
||||
private const int MaxParticles = 50;
|
||||
private const int MaxTrailLength = 50;
|
||||
private const float EdgeFadeDistance = 30f;
|
||||
private const float ExtendedParticleHeight = 40f;
|
||||
private const float _headerHeight = 150f;
|
||||
private const float _particleSpawnInterval = 0.2f;
|
||||
private const int _maxParticles = 50;
|
||||
private const int _maxTrailLength = 50;
|
||||
private const float _edgeFadeDistance = 30f;
|
||||
private const float _extendedParticleHeight = 40f;
|
||||
|
||||
public UpdateNotesUi(ILogger<UpdateNotesUi> logger,
|
||||
LightlessMediator mediator,
|
||||
@@ -111,16 +111,16 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
|
||||
var headerWidth = (800f * ImGuiHelpers.GlobalScale) - (windowPadding.X * 2);
|
||||
|
||||
var headerStart = windowPos + new Vector2(windowPadding.X, windowPadding.Y);
|
||||
var headerEnd = headerStart + new Vector2(headerWidth, HeaderHeight);
|
||||
var headerEnd = headerStart + new Vector2(headerWidth, _headerHeight);
|
||||
|
||||
var extendedParticleSize = new Vector2(headerWidth, HeaderHeight + ExtendedParticleHeight);
|
||||
var extendedParticleSize = new Vector2(headerWidth, _headerHeight + _extendedParticleHeight);
|
||||
|
||||
DrawGradientBackground(headerStart, headerEnd);
|
||||
DrawHeaderText(headerStart);
|
||||
DrawHeaderButtons(headerStart, headerWidth);
|
||||
DrawBottomGradient(headerStart, headerEnd, headerWidth);
|
||||
|
||||
ImGui.SetCursorPosY(windowPadding.Y + HeaderHeight + 5);
|
||||
ImGui.SetCursorPosY(windowPadding.Y + _headerHeight + 5);
|
||||
ImGui.SetCursorPosX(20);
|
||||
using (ImRaii.PushFont(UiBuilder.IconFont))
|
||||
{
|
||||
@@ -260,7 +260,7 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
|
||||
var deltaTime = ImGui.GetIO().DeltaTime;
|
||||
_particleSpawnTimer += deltaTime;
|
||||
|
||||
if (_particleSpawnTimer > ParticleSpawnInterval && _particles.Count < MaxParticles)
|
||||
if (_particleSpawnTimer > _particleSpawnInterval && _particles.Count < _maxParticles)
|
||||
{
|
||||
SpawnParticle(bannerSize);
|
||||
_particleSpawnTimer = 0f;
|
||||
@@ -282,7 +282,7 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
|
||||
if (particle.Type == ParticleType.ShootingStar && particle.Trail != null)
|
||||
{
|
||||
particle.Trail.Insert(0, particle.Position);
|
||||
if (particle.Trail.Count > MaxTrailLength)
|
||||
if (particle.Trail.Count > _maxTrailLength)
|
||||
particle.Trail.RemoveAt(particle.Trail.Count - 1);
|
||||
}
|
||||
|
||||
@@ -316,12 +316,12 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
|
||||
var lifeFade = Math.Min(fadeIn, fadeOut);
|
||||
|
||||
var edgeFadeX = Math.Min(
|
||||
Math.Min(1f, (particle.Position.X + EdgeFadeDistance) / EdgeFadeDistance),
|
||||
Math.Min(1f, (bannerSize.X - particle.Position.X + EdgeFadeDistance) / EdgeFadeDistance)
|
||||
Math.Min(1f, (particle.Position.X + _edgeFadeDistance) / _edgeFadeDistance),
|
||||
Math.Min(1f, (bannerSize.X - particle.Position.X + _edgeFadeDistance) / _edgeFadeDistance)
|
||||
);
|
||||
var edgeFadeY = Math.Min(
|
||||
Math.Min(1f, (particle.Position.Y + EdgeFadeDistance) / EdgeFadeDistance),
|
||||
Math.Min(1f, (bannerSize.Y - particle.Position.Y + EdgeFadeDistance) / EdgeFadeDistance)
|
||||
Math.Min(1f, (particle.Position.Y + _edgeFadeDistance) / _edgeFadeDistance),
|
||||
Math.Min(1f, (bannerSize.Y - particle.Position.Y + _edgeFadeDistance) / _edgeFadeDistance)
|
||||
);
|
||||
var edgeFade = Math.Min(edgeFadeX, edgeFadeY);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user