Files
@ dd8780bb11c5
Branch filter:
Location: ATITD-Tools/Desert-Paint-Codex/Models/GeneratorRecipe.cs - annotation
dd8780bb11c5
1.5 KiB
text/x-csharp
Correct an error when computing the clipped value on white shifts. It was incorrectly detecting a white shift on single-color clips, resulting in a bad reaction computation. Also don't display the wrong 'observed' color after clearing a reaction.
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 System.Text;
using JetBrains.Annotations;
namespace DesertPaintCodex.Models
{
public class GeneratorRecipe : INotifyPropertyChanged
{
private PaintColor _color;
public PaintColor Color { get => _color; set { _color = value; NotifyPropertyChanged(nameof(Color)); } }
private string _recipe = "";
public string Recipe { get => _recipe; set { _recipe = value; NotifyPropertyChanged(nameof(Recipe)); } }
public GeneratorRecipe(PaintColor color)
{
_color = color;
}
public void DraftRecipe(PaintRecipe recipe)
{
StringBuilder sb = new();
for (int i = 0; i < recipe.Reagents.Count; i++)
{
sb.Append(recipe.Reagents[i].Quantity);
sb.Append(' ');
sb.Append(recipe.Reagents[i].Name);
if (i != recipe.Reagents.Count - 1)
{
sb.Append(", ");
}
}
Recipe = sb.ToString();
}
public void ClearRecipe()
{
Recipe = "";
}
public event PropertyChangedEventHandler? PropertyChanged;
[NotifyPropertyChangedInvocator]
private void NotifyPropertyChanged([CallerMemberName] string? propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
|