Smoothed download bar, fixed many warnings
This commit is contained in:
@@ -463,12 +463,16 @@ internal sealed partial class CharaDataHubUi
|
||||
else
|
||||
{
|
||||
var desc = pose.Description;
|
||||
if (ImGui.InputTextWithHint("##description", "Description", ref desc, 100))
|
||||
if (desc != null)
|
||||
{
|
||||
pose.Description = desc;
|
||||
updateDto.UpdatePoseList();
|
||||
if (ImGui.InputTextWithHint("##description", "Description", ref desc, 100))
|
||||
{
|
||||
pose.Description = desc;
|
||||
updateDto.UpdatePoseList();
|
||||
}
|
||||
ImGui.SameLine();
|
||||
}
|
||||
ImGui.SameLine();
|
||||
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Trash, "Delete"))
|
||||
{
|
||||
updateDto.RemovePose(pose);
|
||||
|
||||
@@ -23,6 +23,7 @@ public class DownloadUi : WindowMediatorSubscriberBase
|
||||
private readonly UiSharedService _uiShared;
|
||||
private readonly PairProcessingLimiter _pairProcessingLimiter;
|
||||
private readonly ConcurrentDictionary<GameObjectHandler, bool> _uploadingPlayers = new();
|
||||
private readonly Dictionary<GameObjectHandler, Vector2> _smoothed = [];
|
||||
private bool _notificationDismissed = true;
|
||||
private int _lastDownloadStateHash = 0;
|
||||
|
||||
@@ -204,8 +205,18 @@ public class DownloadUi : WindowMediatorSubscriberBase
|
||||
|
||||
foreach (var transfer in _currentDownloads.ToList())
|
||||
{
|
||||
var screenPos = _dalamudUtilService.WorldToScreen(transfer.Key.GetGameObject());
|
||||
if (screenPos == Vector2.Zero) continue;
|
||||
var transferKey = transfer.Key;
|
||||
var rawPos = _dalamudUtilService.WorldToScreen(transferKey.GetGameObject());
|
||||
//If RawPos is zero, remove it from smoothed dictionary
|
||||
if (rawPos == Vector2.Zero)
|
||||
{
|
||||
_smoothed.Remove(transferKey);
|
||||
continue;
|
||||
}
|
||||
//Smoothing out the movement and fix jitter around the position.
|
||||
Vector2 screenPos = _smoothed.TryGetValue(transferKey, out var lastPos) ? (rawPos - lastPos).Length() < 4f ? lastPos : rawPos : rawPos;
|
||||
_smoothed[transferKey] = screenPos;
|
||||
|
||||
|
||||
var totalBytes = transfer.Value.Sum(c => c.Value.TotalBytes);
|
||||
var transferredBytes = transfer.Value.Sum(c => c.Value.TransferredBytes);
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
namespace LightlessSync.UI.Models
|
||||
{
|
||||
public class ChangelogFile
|
||||
{
|
||||
public string Tagline { get; init; } = string.Empty;
|
||||
public string Subline { get; init; } = string.Empty;
|
||||
public List<ChangelogEntry> Changelog { get; init; } = new();
|
||||
public List<CreditCategory>? Credits { get; init; }
|
||||
}
|
||||
|
||||
public class ChangelogEntry
|
||||
{
|
||||
public string Name { get; init; } = string.Empty;
|
||||
public string Date { get; init; } = string.Empty;
|
||||
public string Tagline { get; init; } = string.Empty;
|
||||
public bool? IsCurrent { get; init; }
|
||||
public string? Message { get; init; }
|
||||
public List<ChangelogVersion>? Versions { get; init; }
|
||||
}
|
||||
|
||||
public class ChangelogVersion
|
||||
{
|
||||
public string Number { get; init; } = string.Empty;
|
||||
public List<string> Items { get; init; } = new();
|
||||
}
|
||||
|
||||
public class CreditCategory
|
||||
{
|
||||
public string Category { get; init; } = string.Empty;
|
||||
public List<CreditItem> Items { get; init; } = new();
|
||||
}
|
||||
|
||||
public class CreditItem
|
||||
{
|
||||
public string Name { get; init; } = string.Empty;
|
||||
public string Role { get; init; } = string.Empty;
|
||||
}
|
||||
|
||||
public class CreditsFile
|
||||
{
|
||||
public List<CreditCategory> Credits { get; init; } = new();
|
||||
}
|
||||
}
|
||||
12
LightlessSync/UI/Models/ChangelogEntry.cs
Normal file
12
LightlessSync/UI/Models/ChangelogEntry.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace LightlessSync.UI.Models
|
||||
{
|
||||
public class ChangelogEntry
|
||||
{
|
||||
public string Name { get; init; } = string.Empty;
|
||||
public string Date { get; init; } = string.Empty;
|
||||
public string Tagline { get; init; } = string.Empty;
|
||||
public bool? IsCurrent { get; init; }
|
||||
public string? Message { get; init; }
|
||||
public List<ChangelogVersion>? Versions { get; init; }
|
||||
}
|
||||
}
|
||||
10
LightlessSync/UI/Models/ChangelogFile.cs
Normal file
10
LightlessSync/UI/Models/ChangelogFile.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace LightlessSync.UI.Models
|
||||
{
|
||||
public class ChangelogFile
|
||||
{
|
||||
public string Tagline { get; init; } = string.Empty;
|
||||
public string Subline { get; init; } = string.Empty;
|
||||
public List<ChangelogEntry> Changelog { get; init; } = new();
|
||||
public List<CreditCategory>? Credits { get; init; }
|
||||
}
|
||||
}
|
||||
8
LightlessSync/UI/Models/ChangelogVersion.cs
Normal file
8
LightlessSync/UI/Models/ChangelogVersion.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace LightlessSync.UI.Models
|
||||
{
|
||||
public class ChangelogVersion
|
||||
{
|
||||
public string Number { get; init; } = string.Empty;
|
||||
public List<string> Items { get; init; } = [];
|
||||
}
|
||||
}
|
||||
8
LightlessSync/UI/Models/CreditCategory.cs
Normal file
8
LightlessSync/UI/Models/CreditCategory.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace LightlessSync.UI.Models
|
||||
{
|
||||
public class CreditCategory
|
||||
{
|
||||
public string Category { get; init; } = string.Empty;
|
||||
public List<CreditItem> Items { get; init; } = [];
|
||||
}
|
||||
}
|
||||
8
LightlessSync/UI/Models/CreditItem.cs
Normal file
8
LightlessSync/UI/Models/CreditItem.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace LightlessSync.UI.Models
|
||||
{
|
||||
public class CreditItem
|
||||
{
|
||||
public string Name { get; init; } = string.Empty;
|
||||
public string Role { get; init; } = string.Empty;
|
||||
}
|
||||
}
|
||||
7
LightlessSync/UI/Models/CreditsFile.cs
Normal file
7
LightlessSync/UI/Models/CreditsFile.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace LightlessSync.UI.Models
|
||||
{
|
||||
public class CreditsFile
|
||||
{
|
||||
public List<CreditCategory> Credits { get; init; } = [];
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
using Dalamud.Interface;
|
||||
using LightlessSync.LightlessConfiguration.Models;
|
||||
using System.Numerics;
|
||||
|
||||
namespace LightlessSync.UI.Models;
|
||||
|
||||
public class LightlessNotification
|
||||
{
|
||||
public string Id { get; set; } = Guid.NewGuid().ToString();
|
||||
@@ -20,13 +20,3 @@ public class LightlessNotification
|
||||
public bool IsAnimatingOut { get; set; } = false;
|
||||
public uint? SoundEffectId { get; set; } = null;
|
||||
}
|
||||
public class LightlessNotificationAction
|
||||
{
|
||||
public string Id { get; set; } = Guid.NewGuid().ToString();
|
||||
public string Label { get; set; } = string.Empty;
|
||||
public FontAwesomeIcon Icon { get; set; } = FontAwesomeIcon.None;
|
||||
public Vector4 Color { get; set; } = Vector4.One;
|
||||
public Action<LightlessNotification> OnClick { get; set; } = _ => { };
|
||||
public bool IsPrimary { get; set; } = false;
|
||||
public bool IsDestructive { get; set; } = false;
|
||||
}
|
||||
15
LightlessSync/UI/Models/LightlessNotificationAction.cs
Normal file
15
LightlessSync/UI/Models/LightlessNotificationAction.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Dalamud.Interface;
|
||||
using System.Numerics;
|
||||
|
||||
namespace LightlessSync.UI.Models;
|
||||
|
||||
public class LightlessNotificationAction
|
||||
{
|
||||
public string Id { get; set; } = Guid.NewGuid().ToString();
|
||||
public string Label { get; set; } = string.Empty;
|
||||
public FontAwesomeIcon Icon { get; set; } = FontAwesomeIcon.None;
|
||||
public Vector4 Color { get; set; } = Vector4.One;
|
||||
public Action<LightlessNotification> OnClick { get; set; } = _ => { };
|
||||
public bool IsPrimary { get; set; } = false;
|
||||
public bool IsDestructive { get; set; } = false;
|
||||
}
|
||||
@@ -96,10 +96,10 @@ namespace LightlessSync.UI
|
||||
public static Vector4 HexToRgba(string hexColor)
|
||||
{
|
||||
hexColor = hexColor.TrimStart('#');
|
||||
int r = int.Parse(hexColor.Substring(0, 2), NumberStyles.HexNumber);
|
||||
int g = int.Parse(hexColor.Substring(2, 2), NumberStyles.HexNumber);
|
||||
int b = int.Parse(hexColor.Substring(4, 2), NumberStyles.HexNumber);
|
||||
int a = hexColor.Length == 8 ? int.Parse(hexColor.Substring(6, 2), NumberStyles.HexNumber) : 255;
|
||||
int r = int.Parse(hexColor[..2], NumberStyles.HexNumber);
|
||||
int g = int.Parse(hexColor[2..4], NumberStyles.HexNumber);
|
||||
int b = int.Parse(hexColor[4..6], NumberStyles.HexNumber);
|
||||
int a = hexColor.Length == 8 ? int.Parse(hexColor[6..8], NumberStyles.HexNumber) : 255;
|
||||
return new Vector4(r / 255f, g / 255f, b / 255f, a / 255f);
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
private bool _isOneDrive = false;
|
||||
private bool _isPenumbraDirectory = false;
|
||||
private bool _moodlesExists = false;
|
||||
private Dictionary<string, DateTime> _oauthTokenExpiry = new();
|
||||
private readonly Dictionary<string, DateTime> _oauthTokenExpiry = [];
|
||||
private bool _penumbraExists = false;
|
||||
private bool _petNamesExists = false;
|
||||
private int _serverSelectionIndex = -1;
|
||||
@@ -1067,7 +1067,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
{
|
||||
using (ImRaii.Disabled(_discordOAuthUIDs == null))
|
||||
{
|
||||
var aliasPairs = _discordOAuthUIDs?.Result?.Select(t => new UIDAliasPair(t.Key, t.Value)).ToList() ?? [new UIDAliasPair(item.UID ?? null, null)];
|
||||
var aliasPairs = _discordOAuthUIDs?.Result?.Select(t => new UidAliasPair(t.Key, t.Value)).ToList() ?? [new UidAliasPair(item.UID ?? null, null)];
|
||||
var uidComboName = "UID###" + item.CharacterName + item.WorldId + serverUri + indexOffset + aliasPairs.Count;
|
||||
DrawCombo(uidComboName, aliasPairs,
|
||||
(v) =>
|
||||
@@ -1253,6 +1253,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
UidFont.Dispose();
|
||||
GameFont.Dispose();
|
||||
MediumFont.Dispose();
|
||||
_discordOAuthGetCts.Dispose();
|
||||
}
|
||||
|
||||
private static void CenterWindow(float width, float height, ImGuiCond cond = ImGuiCond.None)
|
||||
@@ -1325,6 +1326,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public sealed record IconScaleData(Vector2 IconSize, Vector2 NormalizedIconScale, float OffsetX, float IconScaling);
|
||||
private record UIDAliasPair(string? UID, string? Alias);
|
||||
private sealed record UidAliasPair(string? UID, string? Alias);
|
||||
}
|
||||
@@ -742,7 +742,7 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
|
||||
using var changelogStream = assembly.GetManifestResourceStream("LightlessSync.Changelog.changelog.yaml");
|
||||
if (changelogStream != null)
|
||||
{
|
||||
using var reader = new StreamReader(changelogStream, Encoding.UTF8, true, 128);
|
||||
using var reader = new StreamReader(changelogStream, Encoding.UTF8, detectEncodingFromByteOrderMarks: true, 128);
|
||||
var yaml = reader.ReadToEnd();
|
||||
_changelog = deserializer.Deserialize<ChangelogFile>(yaml) ?? new();
|
||||
}
|
||||
@@ -751,7 +751,7 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
|
||||
using var creditsStream = assembly.GetManifestResourceStream("LightlessSync.Changelog.credits.yaml");
|
||||
if (creditsStream != null)
|
||||
{
|
||||
using var reader = new StreamReader(creditsStream, Encoding.UTF8, true, 128);
|
||||
using var reader = new StreamReader(creditsStream, Encoding.UTF8, detectEncodingFromByteOrderMarks: true, 128);
|
||||
var yaml = reader.ReadToEnd();
|
||||
_credits = deserializer.Deserialize<CreditsFile>(yaml) ?? new();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user