Files
@ dd8780bb11c5
Branch filter:
Location: ATITD-Tools/Desert-Paint-Codex/Models/ReactionTestService.cs - annotation
dd8780bb11c5
2.0 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 f419334a476f 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;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using DesertPaintCodex.Services;
using DynamicData;
namespace DesertPaintCodex.Models
{
public static class ReactionTestService
{
private static readonly List<ReactionTest> _allTests = new();
static ReactionTestService()
{
}
public static void Initialize()
{
_allTests.Clear();
PlayerProfile? profile = ProfileManager.CurrentProfile;
Debug.Assert(profile != null);
List<string> reagentNames = ReagentService.Names;
foreach (Reagent reagent1 in reagentNames.Select(ReagentService.GetReagent))
{
foreach (Reagent reagent2 in reagentNames.Select(ReagentService.GetReagent))
{
if (reagent1 == reagent2) continue;
Reaction? reaction = profile.FindReaction(reagent1, reagent2);
ClipType clipType = profile.PairClipStatus(reagent1, reagent2);
ReactionTest test = new(reagent1, reagent2, reaction, clipType)
{
Clipped = clipType,
Reaction = reaction,
};
_allTests.Add(test);
}
}
}
public static void PopulateRemainingTests(ObservableCollection<ReactionTest> collection)
{
collection.Clear();
collection.AddRange(_allTests.Where(test => test.State != ReactionTest.TestState.Saved).OrderBy(test => test));
}
public static void PopulateCompletedTests(ObservableCollection<ReactionTest> collection)
{
collection.Clear();
collection.AddRange(_allTests.Where(test => test.State == ReactionTest.TestState.Saved).OrderBy(test => test));
}
}
}
|