mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
chore: Clean up a couple more todos
- Remove AddNotification from UiBuilder - Change MateriaGrade to just Bytes now.
This commit is contained in:
parent
3b8ef2c8e8
commit
b85914c54c
2 changed files with 2 additions and 47 deletions
|
|
@ -106,10 +106,8 @@ public unsafe struct GameInventoryItem : IEquatable<GameInventoryItem>
|
|||
/// <summary>
|
||||
/// Gets the array of materia grades.
|
||||
/// </summary>
|
||||
// TODO: Replace with MateriaGradeBytes
|
||||
[Api10ToDo(Api10ToDoAttribute.DeleteCompatBehavior)]
|
||||
public ReadOnlySpan<ushort> MateriaGrade =>
|
||||
this.MateriaGradeBytes.ToArray().Select(g => (ushort)g).ToArray().AsSpan();
|
||||
public ReadOnlySpan<byte> MateriaGrade =>
|
||||
new(Unsafe.AsPointer(ref Unsafe.AsRef(in this.InternalItem.MateriaGrade[0])), 5);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the address of native inventory item in the game.<br />
|
||||
|
|
@ -151,9 +149,6 @@ public unsafe struct GameInventoryItem : IEquatable<GameInventoryItem>
|
|||
/// </summary>
|
||||
internal ulong CrafterContentId => this.InternalItem.CrafterContentID;
|
||||
|
||||
private ReadOnlySpan<byte> MateriaGradeBytes =>
|
||||
new(Unsafe.AsPointer(ref Unsafe.AsRef(in this.InternalItem.MateriaGrade[0])), 5);
|
||||
|
||||
public static bool operator ==(in GameInventoryItem l, in GameInventoryItem r) => l.Equals(r);
|
||||
|
||||
public static bool operator !=(in GameInventoryItem l, in GameInventoryItem r) => !l.Equals(r);
|
||||
|
|
|
|||
|
|
@ -586,52 +586,12 @@ public sealed class UiBuilder : IDisposable
|
|||
autoRebuildMode,
|
||||
isGlobalScaled));
|
||||
|
||||
/// <summary>
|
||||
/// Add a notification to the notification queue.
|
||||
/// </summary>
|
||||
/// <param name="content">The content of the notification.</param>
|
||||
/// <param name="title">The title of the notification.</param>
|
||||
/// <param name="type">The type of the notification.</param>
|
||||
/// <param name="msDelay">The time the notification should be displayed for.</param>
|
||||
[Obsolete($"Use {nameof(INotificationManager)}.", false)]
|
||||
[Api10ToDo(Api10ToDoAttribute.DeleteCompatBehavior)]
|
||||
public async void AddNotification(
|
||||
string content,
|
||||
string? title = null,
|
||||
NotificationType type = NotificationType.None,
|
||||
uint msDelay = 3000)
|
||||
{
|
||||
var nm = await Service<NotificationManager>.GetAsync();
|
||||
var an = nm.AddNotification(
|
||||
new()
|
||||
{
|
||||
Content = content,
|
||||
Title = title,
|
||||
Type = type,
|
||||
InitialDuration = TimeSpan.FromMilliseconds(msDelay),
|
||||
},
|
||||
this.localPlugin);
|
||||
_ = this.notifications.TryAdd(an, 0);
|
||||
an.Dismiss += a => this.notifications.TryRemove(a.Notification, out _);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unregister the UiBuilder. Do not call this in plugin code.
|
||||
/// </summary>
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
this.scopedFinalizer.Dispose();
|
||||
|
||||
// Taken from NotificationManagerPluginScoped.
|
||||
// TODO: remove on API 10.
|
||||
while (!this.notifications.IsEmpty)
|
||||
{
|
||||
foreach (var n in this.notifications.Keys)
|
||||
{
|
||||
this.notifications.TryRemove(n, out _);
|
||||
((ActiveNotification)n).RemoveNonDalamudInvocations();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Clean up resources allocated by this instance of <see cref="UiBuilder"/>.</summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue