Files
@ 4778889395e8
Branch filter:
Location: ATITD-Tools/Desert-Paint-Codex/Models/ReactionSet.cs - annotation
4778889395e8
1.5 KiB
text/x-csharp
Change the displayed permeutation count to display using locale-specific number formatting (with comma / dot separators). Fix a crash when starting a new round of recipe generation after recipe generation completed during a previous run.
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.Collections.Generic;
namespace DesertPaintCodex.Models
{
public class ReactionSet
{
// ingredient -> [ingredient, reaction]
private readonly Dictionary<string, Dictionary<string, Reaction?>> _reactions = new();
public Reaction? Find(Reagent reagent1, Reagent reagent2)
{
Reaction? reaction = null;
_reactions.TryGetValue(reagent1.PracticalPaintName, out Dictionary<string, Reaction?>? secondReagentDict);
secondReagentDict?.TryGetValue(reagent2.PracticalPaintName, out reaction);
return reaction;
}
public void Set(Reagent reagent1, Reagent reagent2, Reaction? reaction)
{
_reactions.TryGetValue(reagent1.PracticalPaintName, out Dictionary<string, Reaction?>? secondReagentDict);
if (secondReagentDict == null)
{
secondReagentDict = new Dictionary<string, Reaction?>();
_reactions.Add(reagent1.PracticalPaintName, secondReagentDict);
}
secondReagentDict[reagent2.PracticalPaintName] = reaction;
}
public void Remove(Reagent reagent1, Reagent reagent2)
{
_reactions.TryGetValue(reagent1.PracticalPaintName, out Dictionary<string, Reaction?>? secondReagentDict);
secondReagentDict?.Remove(reagent2.PracticalPaintName);
}
public void Clear()
{
_reactions.Clear();
}
}
}
|