mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-22 07:47:45 +01:00
Switch INotificationManager and ITitleScreenMenu to use ISharedImmediateTexture (#1879)
* Switch INotificationManager and ITitleScreenMenu to use ISharedImmediateTexture #1879 * Remove SetIconTexture Remove some remarks that no longer apply * Cleanup StyleCop warnings
This commit is contained in:
parent
577977350f
commit
19ba6a961f
13 changed files with 176 additions and 274 deletions
|
|
@ -0,0 +1,50 @@
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Dalamud.Interface.Textures.TextureWraps;
|
||||
using Dalamud.Storage.Assets;
|
||||
|
||||
namespace Dalamud.Interface.Textures;
|
||||
|
||||
/// <summary>
|
||||
/// Wraps a dalamud texture allowing interoperability with certain services. Only use this if you need to provide a texture that has been created or rented as a ISharedImmediateTexture.
|
||||
/// </summary>
|
||||
public class ForwardingSharedImmediateTexture : ISharedImmediateTexture
|
||||
{
|
||||
private readonly IDalamudTextureWrap textureWrap;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ForwardingSharedImmediateTexture"/> class.
|
||||
/// </summary>
|
||||
/// <param name="textureWrap">A textureWrap that has been created or provided by RentAsync.</param>
|
||||
public ForwardingSharedImmediateTexture(IDalamudTextureWrap textureWrap)
|
||||
{
|
||||
this.textureWrap = textureWrap;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IDalamudTextureWrap GetWrapOrEmpty()
|
||||
{
|
||||
return this.textureWrap;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IDalamudTextureWrap? GetWrapOrDefault(IDalamudTextureWrap? defaultWrap = null)
|
||||
{
|
||||
return this.textureWrap;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool TryGetWrap(out IDalamudTextureWrap? texture, out Exception? exception)
|
||||
{
|
||||
texture = this.textureWrap;
|
||||
exception = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Task<IDalamudTextureWrap> RentAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
return Task.FromResult(this.textureWrap);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue