Ejemplo n.º 1
0
 public BeadSupply(Colour colour)
 {
     InitializeComponent();
     m_Colour = colour;
     plcColour.SetColor(colour.Name);
     AssignValues();
 }
Ejemplo n.º 2
0
 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;
         }
     }
 }
Ejemplo n.º 3
0
        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();
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public void SwapMatches()
        {
            Colour b = BestMatch;
            int dif = BestDif;

            BestMatch = null;
            BestDif = int.MaxValue;

            BestMatch = SecondBest;
            BestDif = SecondDif;

            SecondBest = b;
            SecondDif = dif;
        }
Ejemplo n.º 5
0
 public void NewMatch(Colour match, int dif)
 {
     SecondBest = BestMatch;
     SecondDif = BestDif;
     BestMatch = match;
     BestDif = dif;
 }
Ejemplo n.º 6
0
 public void AbsorbMatch(Match other)
 {
     SecondBest = other.SecondBest;
     SecondDif = other.SecondDif;
     BestMatch = other.BestMatch;
     BestDif = other.BestDif;
 }