CurrencyAlertClassic/CurrencyAlert/DataModels/TrackedCurrency.cs

33 lines
816 B
C#

using System.Numerics;
using Dalamud.Interface.Textures.TextureWraps;
using ImGuiNET;
using KamiLib.Configuration;
namespace CurrencyAlert.DataModels;
public record TrackedCurrency(CurrencyName Name, Setting<int> Threshold, Setting<bool> Enabled)
{
private static DisplaySettings DisplaySettings => Service.Configuration.DisplaySettings;
public CurrencyInfo CurrencyInfo()
{
return new CurrencyInfo(Name);
}
public void DrawIcon()
{
var texture = CurrencyInfo().IconTexture;
if (texture != null && texture.TryGetWrap(out IDalamudTextureWrap? wrap, out _))
{
ImGui.Image(wrap.ImGuiHandle, new Vector2(20.0f));
}
}
public void DrawName(Vector4 color)
{
ImGui.TextColored(color, CurrencyInfo().ItemName);
}
}