CurrencyAlertClassic/CurrencyAlert/Windows/Components/TrackedCurrencySelectable.cs
MidoriKami e97fe36ba0
Complete Rework + Update (#15)
* Remove unused dalamud packager overrides

* Use category tags, add actual description

* Use .net7

* Update DalamudPackager, update for Api8

* Remove hardcoded images, we'll use lumina to get these dynamically

* Add KamiLib

* Refactor Currency Alert

* Add LocalizationManager.cs

* remove trailing comma

* Add No Decoration flag

* More touchups and features

* Increase Version Number 0.5.0.0

* Move Chat Notifications to its own category

* Hide overlay if not logged in or there are no warnings to show

* Increase update frequency to 4x per second
2023-01-10 21:07:57 +01:00

46 lines
1.3 KiB
C#

using System.Numerics;
using CurrencyAlert.DataModels;
using CurrencyAlert.Localization;
using Dalamud.Interface;
using ImGuiNET;
using KamiLib.Drawing;
using KamiLib.Interfaces;
namespace CurrencyAlert.Windows.Components;
public class TrackedCurrencySelectable : ISelectable, IDrawable
{
public IDrawable Contents => this;
public string ID { get; }
private readonly TrackedCurrency currency;
public TrackedCurrencySelectable(TrackedCurrency trackedCurrency)
{
currency = trackedCurrency;
ID = currency.CurrencyInfo().ItemName;
}
public void DrawLabel()
{
currency.DrawIcon();
ImGui.SameLine();
currency.DrawName(Colors.White);
}
public void Draw()
{
InfoBox.Instance
.AddTitle(Strings.CurrentlySelected)
.AddIcon(currency.CurrencyInfo().IconID, ImGuiHelpers.ScaledVector2(40.0f), 1.0f)
.SameLine()
.AddString(currency.CurrencyInfo().ItemName)
.Draw();
InfoBox.Instance
.AddTitle(Strings.CurrencyConfiguration, out var innerWidth)
.AddConfigCheckbox(Strings.Enabled, currency.Enabled)
.AddInputInt(Strings.Threshold, currency.Threshold, 0, 100000, 0, 0, innerWidth / 2.0f)
.Draw();
}
}