Revert legacy tattoo changes.

This commit is contained in:
Ottermandias 2024-07-16 23:30:02 +02:00
parent c75315f0f7
commit a5f35dbd17
2 changed files with 40 additions and 18 deletions

View file

@ -1,14 +1,13 @@
using Dalamud.Interface.Internal;
using Dalamud.Interface.Textures;
using Dalamud.Interface.Textures;
using Dalamud.Interface.Textures.TextureWraps;
using Dalamud.Interface.Utility;
using Dalamud.Plugin;
using Dalamud.Plugin.Services;
using Glamourer.GameData;
using Glamourer.Services;
using Glamourer.Unlocks;
using ImGuiNET;
using OtterGui;
using OtterGui.Classes;
using OtterGui.Raii;
using Penumbra.GameData.Enums;
using Penumbra.GameData.Structs;
@ -16,15 +15,16 @@ using Penumbra.GameData.Structs;
namespace Glamourer.Gui.Customization;
public partial class CustomizationDrawer(
TextureCache textureCache,
ITextureProvider textures,
CustomizeService _service,
CodeService _codes,
Configuration _config,
FavoriteManager _favorites,
HeightService _heightService)
: IDisposable
{
private readonly Vector4 _redTint = new(0.6f, 0.3f, 0.3f, 1f);
private readonly ISharedImmediateTexture? _legacyTattoo = GetLegacyTattooIcon(textureCache);
private readonly Vector4 _redTint = new(0.6f, 0.3f, 0.3f, 1f);
private readonly IDalamudTextureWrap? _legacyTattoo = GetLegacyTattooIcon(textures);
private Exception? _terminate;
@ -49,6 +49,9 @@ public partial class CustomizationDrawer(
private float _raceSelectorWidth;
private bool _withApply;
public void Dispose()
=> _legacyTattoo?.Dispose();
public bool Draw(CustomizeArray current, bool locked, bool lockedRedraw)
{
_withApply = false;
@ -189,6 +192,16 @@ public partial class CustomizationDrawer(
_raceSelectorWidth = _inputIntSize + _comboSelectorSize - _framedIconSize.X;
}
private static ISharedImmediateTexture? GetLegacyTattooIcon(TextureCache icons)
=> icons.TextureProvider.GetFromManifestResource(Assembly.GetExecutingAssembly(), "Glamourer.LegacyTattoo.raw");
private static IDalamudTextureWrap? GetLegacyTattooIcon(ITextureProvider textures)
{
using var resource = Assembly.GetExecutingAssembly().GetManifestResourceStream("Glamourer.LegacyTattoo.raw");
if (resource == null)
return null;
var rawImage = new byte[resource.Length];
var length = resource.Read(rawImage, 0, (int)resource.Length);
return length == resource.Length
? textures.CreateFromRaw(RawImageSpecification.Rgba32(192, 192), rawImage, "Glamourer.LegacyTattoo")
: null;
}
}