name attribute
This commit is contained in:
parent
577ced24a4
commit
74e44d7092
14
SamplePlugin/Attribute/NameAttribute.cs
Normal file
14
SamplePlugin/Attribute/NameAttribute.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
|
||||
namespace CurrencyAlert.Enum
|
||||
{
|
||||
internal class NameAttribute : Attribute
|
||||
{
|
||||
public NameAttribute(string v)
|
||||
{
|
||||
Value = v;
|
||||
}
|
||||
|
||||
public string Value { get; }
|
||||
}
|
||||
}
|
@ -9,7 +9,7 @@ namespace CurrencyAlert
|
||||
[Serializable]
|
||||
public class Configuration : IPluginConfiguration
|
||||
{
|
||||
public int Version { get; set; } = 2;
|
||||
public int Version { get; set; } = 4;
|
||||
|
||||
public Dictionary<Currency, bool> AlertEnabled { get; set; } = new Dictionary<Currency, bool>();
|
||||
public Dictionary<Currency, int> Threshold { get; set; } = new Dictionary<Currency , int>();
|
||||
|
@ -8,25 +8,19 @@ namespace CurrencyAlert.Enum
|
||||
{
|
||||
public enum Currency
|
||||
{
|
||||
[Slot(1), DefaultThreshold(75000)]
|
||||
StormSeal,
|
||||
|
||||
[Slot(2), DefaultThreshold(75000)]
|
||||
SerpentSeal,
|
||||
|
||||
[Slot(3), DefaultThreshold(75000)]
|
||||
FlameSeal,
|
||||
|
||||
[Slot(4), DefaultThreshold(18000)]
|
||||
WolfMark,
|
||||
|
||||
[Slot(6), DefaultThreshold(1500)]
|
||||
[Name("Tomestones of Poetics"), Slot(6), DefaultThreshold(1500)]
|
||||
TomestoneOfPoetics,
|
||||
|
||||
[Slot(8), DefaultThreshold(3500)]
|
||||
AlliedSeal,
|
||||
|
||||
[Slot(10), DefaultThreshold(1500)]
|
||||
TomestoneOfAstronomy
|
||||
[Name("Tomestones of Astronomy"), Slot(10), DefaultThreshold(1500)]
|
||||
TomestoneOfAstronomy,
|
||||
[Name("Storm Seals"), Slot(1), DefaultThreshold(75000)]
|
||||
StormSeal,
|
||||
[Name("Serpent Seals"), Slot(2), DefaultThreshold(75000)]
|
||||
SerpentSeal,
|
||||
[Name("Flame Seals"), Slot(3), DefaultThreshold(75000)]
|
||||
FlameSeal,
|
||||
[Name("Wolf Marks"), Slot(4), DefaultThreshold(18000)]
|
||||
WolfMark,
|
||||
[Name("Allied Seals"), Slot(8), DefaultThreshold(3500)]
|
||||
AlliedSeal
|
||||
}
|
||||
}
|
||||
|
@ -70,7 +70,8 @@ namespace CurrencyAlert
|
||||
ImGuiWindowFlags.NoFocusOnAppearing
|
||||
))
|
||||
{
|
||||
ImGui.Text($"You need to spend your {currency}");
|
||||
var name = EnumHelper.GetAttributeOfType<NameAttribute>(currency).Value;
|
||||
ImGui.Text($"You need to spend your {name}");
|
||||
}
|
||||
|
||||
ImGui.End();
|
||||
@ -85,9 +86,10 @@ namespace CurrencyAlert
|
||||
{
|
||||
EnumHelper.Each<Currency>(currency =>
|
||||
{
|
||||
var name = EnumHelper.GetAttributeOfType<NameAttribute>(currency).Value;
|
||||
var alertEnabled = this.configuration.AlertEnabled[currency];
|
||||
|
||||
if (ImGui.Checkbox($"{currency.ToString()} Alert Enabled", ref alertEnabled))
|
||||
if (ImGui.Checkbox($"{name} Alert Enabled", ref alertEnabled))
|
||||
{
|
||||
this.configuration.AlertEnabled[currency] = alertEnabled;
|
||||
this.configuration.Save();
|
||||
@ -95,7 +97,7 @@ namespace CurrencyAlert
|
||||
|
||||
var thresholdValue = this.configuration.Threshold[currency];
|
||||
|
||||
if (ImGui.InputInt($"{currency.ToString()} Threshold Value", ref thresholdValue, 1, 1,
|
||||
if (ImGui.InputInt($"{name} Threshold Value", ref thresholdValue, 1, 1,
|
||||
this.configuration.AlertEnabled[currency] ? ImGuiInputTextFlags.None : ImGuiInputTextFlags.ReadOnly))
|
||||
{
|
||||
this.configuration.Threshold[currency] = thresholdValue;
|
||||
|
Loading…
Reference in New Issue
Block a user