Files
@ d6859ea7177f
Branch filter:
Location: ATITD-Tools/Desert-Paint-Codex/Models/RecipeItem.cs - annotation
d6859ea7177f
2.2 KiB
text/x-csharp
Add some sanity checks on min/max concentration and min/max reagents in recipe generation. Also, clear out the search queue when generation has finished so the queue isn't loaded next time. This fixes the start/resume button state when entering the recipe generator after a prior run had finished.
40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 | using System.ComponentModel;
using System.Runtime.CompilerServices;
using JetBrains.Annotations;
namespace DesertPaintCodex.Models
{
public class RecipeItem : INotifyPropertyChanged
{
private const uint PigmentMax = 25;
private Reagent _reagent;
public Reagent Reagent
{
get => _reagent;
set
{
_reagent = value;
NotifyPropertyChanged(nameof(Reagent));
}
}
private uint _quantity;
public uint Quantity
{
get => _quantity;
set
{
_quantity = value;
NotifyPropertyChanged(nameof(Quantity));
}
}
private uint _maxQty;
public uint MaxQty
{
get => _maxQty;
set
{
_maxQty = value;
NotifyPropertyChanged(nameof(MaxQty));
}
}
private bool _first;
public bool First
{
get => _first;
set
{
_first = value;
NotifyPropertyChanged(nameof(First));
}
}
private bool _last;
public bool Last
{
get => _last;
set
{
_last = value;
NotifyPropertyChanged(nameof(Last));
}
}
private bool _unused;
public bool Unused
{
get => _unused;
set
{
_unused = value;
NotifyPropertyChanged(nameof(Unused));
}
}
public RecipeItem(Reagent reagent, uint quantity)
{
_reagent = reagent;
Quantity = quantity;
MaxQty = reagent.IsCatalyst ? 1 : PigmentMax;
}
public override string ToString()
{
return $"{Reagent.Name} {Quantity}";
}
public event PropertyChangedEventHandler? PropertyChanged;
[NotifyPropertyChangedInvocator]
private void NotifyPropertyChanged([CallerMemberName] string? propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
|