public BeadSupply(Colour colour) { InitializeComponent(); m_Colour = colour; plcColour.SetColor(colour.Name); AssignValues(); }
public void UpdateColour(Colour col, int number) { for (int i = 0; i < Colours.Count; ++i) { if (col.Name == Colours[i].Name) { Colours[i].Used += number; } } }
public void UpdateColor(Colour col, Dictionary<Color, Match> FoundMatches) { Color BestMatch = col.Color; Match BestColour = new Match(); int lowest = int.MaxValue; for(int i = 0; i < FoundMatches.Keys.Count;++i) { if (FoundMatches.Values.ElementAt(i).BestMatch == col) { if (FoundMatches.Values.ElementAt(i).BestDif < lowest) { BestMatch = FoundMatches.Keys.ElementAt(i); BestColour = FoundMatches.Values.ElementAt(i); lowest = FoundMatches.Values.ElementAt(i).BestDif; } } } for (int i = 0; i < FoundMatches.Keys.Count; ++i) { if (FoundMatches.Values.ElementAt(i).BestMatch== col) { if (FoundMatches.Keys.ElementAt(i) != BestMatch && FoundMatches.Values.ElementAt(i).SecondDif < BestColour.SecondDif) { FoundMatches.Values.ElementAt(i).SwapMatches(); } } } }
public void SwapMatches() { Colour b = BestMatch; int dif = BestDif; BestMatch = null; BestDif = int.MaxValue; BestMatch = SecondBest; BestDif = SecondDif; SecondBest = b; SecondDif = dif; }
public void NewMatch(Colour match, int dif) { SecondBest = BestMatch; SecondDif = BestDif; BestMatch = match; BestDif = dif; }
public void AbsorbMatch(Match other) { SecondBest = other.SecondBest; SecondDif = other.SecondDif; BestMatch = other.BestMatch; BestDif = other.BestDif; }