private DeckRegularDict <HeapSolitaireCardInfo> GetFirstList()
        {
            DeckRegularDict <HeapSolitaireCardInfo> output = new DeckRegularDict <HeapSolitaireCardInfo>();
            EnumColorList newColor  = (EnumColorList)_rs.GetRandomNumber(2);
            int           newNumber = 7;

            do
            {
                if (output.Count < 13)
                {
                    if (newColor == EnumColorList.Black)
                    {
                        newColor = EnumColorList.Red;
                    }
                    else
                    {
                        newColor = EnumColorList.Black;
                    }
                    var finalCard = _cardList.First(items => (int)items.Value == newNumber && items.Color == newColor);
                    output.Add(finalCard);
                    _cardList.RemoveSpecificItem(finalCard);
                    if (output.Count == 13)
                    {
                        return(output);
                    }
                    newNumber++;
                    if (newNumber > 13)
                    {
                        newNumber = 1;
                    }
                }
            } while (true);
        }
        //private readonly BasicData _thisData;
        public void CreateSet(IDeckDict <Phase10CardInformation> thisCol, EnumWhatSets whatType)
        {
            _whatSet = whatType;
            thisCol.ForEach(items =>
            {
                items.Drew       = false;
                items.IsSelected = false;
            });
            if (_whatSet != EnumWhatSets.Runs)
            {
                HandList.ReplaceRange(thisCol);
                return;
            }
            DeckRegularDict <Phase10CardInformation> tempList = thisCol.ToRegularDeckDict();
            DeckRegularDict <Phase10CardInformation> wildCol  = thisCol.Where(items => items.CardCategory == EnumCardCategory.Wild).ToRegularDeckDict();

            thisCol.KeepConditionalItems(items => items.CardCategory == EnumCardCategory.None);
            int firstNum  = thisCol.First().Number;
            int whatFirst = firstNum;
            int lastNum   = thisCol.Last().Number;
            int x;
            var loopTo = thisCol.Count;
            Phase10CardInformation thisCard;

            for (x = 2; x <= loopTo; x++)
            {
                firstNum += 1;
                thisCard  = thisCol[x - 1];
                if (thisCard.Number != firstNum)
                {
                    thisCard        = wildCol.First();
                    thisCard.Number = firstNum; // will put back when new round (?)
                    wildCol.RemoveSpecificItem(thisCard);
                    x -= 1;
                }
            }
            if (wildCol.Count > 0)
            {
                lastNum += 1;
                for (x = lastNum; x <= 11; x++)
                {
                    if (wildCol.Count == 0)
                    {
                        break;
                    }
                    thisCard        = wildCol.First();
                    thisCard.Number = x;
                    wildCol.RemoveSpecificItem(thisCard);
                }
                whatFirst -= 1;
                for (x = whatFirst; x >= 2; x += -1)
                {
                    if (wildCol.Count == 0)
                    {
                        break;
                    }
                    thisCard        = wildCol.First();
                    thisCard.Number = x;
                    wildCol.RemoveSpecificItem(thisCard);
                }
            }
            var Fins = tempList.OrderBy(Items => Items.Number);

            HandList.ReplaceRange(Fins);
        }
Esempio n. 3
0
 public void RemoveFromUnknown(SolitaireCard thisCard)
 {
     _listUnknownCards.RemoveSpecificItem(thisCard); //i think.
     thisCard.IsUnknown = false;
 }