public override void LoadSet(SavedSet payLoad) { HandList.ReplaceRange(payLoad.CardList); _setType = payLoad.SetType; _useSecond = payLoad.UseSecond; }
//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); }
public override void LoadSet(SavedSet current) { _player = current.Player; HandList.ReplaceRange(current.CardList); }
public override void LoadSet(SavedSet payLoad) { _setType = payLoad.WhatType; HandList.ReplaceRange(payLoad.CardList); }
protected async override Task ContinueOpenSavedAsync() { //anything else you need will be here GlobalClass.Stock !.HandList.ReplaceRange(SaveRoot.StockCards); await base.ContinueOpenSavedAsync(); }
public override void LoadSet(SavedSet payLoad) { HandList.ReplaceRange(payLoad.CardList); }
internal static void PopulateDeals(this PaydayGameContainer gameContainer, PaydayVMData model) { var tempList = gameContainer.SingleInfo !.Hand.GetMailOrDealList <DealCard>(EnumCardCategory.Deal); model !.CurrentDealList !.HandList.ReplaceRange(tempList); }
protected override void PopulateDeck(IEnumerableDeck <SolitaireCard> leftOverList) { GlobalClass.Stock !.HandList.ReplaceRange(leftOverList); }
private void PopulateMails() { var tempList = _gameContainer.SingleInfo !.Hand.GetMailOrDealList <MailCard>(EnumCardCategory.Mail); _model !.CurrentMailList !.HandList.ReplaceRange(tempList); }
public void CreateSet(IDeckDict <ChinazoCard> thisList, RummyProcesses <EnumSuitList, EnumColorList, ChinazoCard> .EnumRummyType whichSet, bool useSecond) { _whatSet = whichSet; _useSecond = useSecond; var wildCol = thisList.Where(items => items.IsObjectWild == true).ToRegularDeckDict(); thisList.ForEach(thisCard => { thisCard.IsSelected = false; thisCard.Drew = false; }); if (_whatSet != RummyProcesses <EnumSuitList, EnumColorList, ChinazoCard> .EnumRummyType.Runs) { HandList.ReplaceRange(thisList); if (HandList.Count == 0) { throw new BasicBlankException("the hand list was blank"); } return; } EnumSuitList suitOfSet = thisList.First(items => items.IsObjectWild == false).Suit; int originalNumber = thisList.Count; var tempCol = thisList.Where(items => items.IsObjectWild == false).ToRegularDeckDict(); if (useSecond == true) { tempCol = tempCol.OrderBy(items => items.SecondNumber).ToRegularDeckDict(); } int firstNum; if (useSecond == true) { tempCol.First().UsedAs = (int)tempCol.First().SecondNumber; } else { tempCol.First().UsedAs = (int)tempCol.First().Value; } firstNum = tempCol.First().UsedAs; if (firstNum > 12) { throw new BasicBlankException("The first number cannot be higher than 12 for runs."); } tempCol.Last().UsedAs = (int)tempCol.Last().Value; int whatFirst = firstNum; int lastNum = tempCol.Last().UsedAs; int y = tempCol.Count; ChinazoCard tempCard; for (int x = 2; x <= y; x++) { firstNum += 1; tempCard = tempCol[x - 1]; if ((int)tempCard.Value != firstNum) { tempCard = wildCol.First(); tempCard.UsedAs = firstNum; tempCard.Suit = suitOfSet; //hopefully that is okay (?) tempCol.Add(tempCard); wildCol.RemoveSpecificItem(tempCard); //hopefully still works. x--; } else { if (useSecond == true) { tempCard.UsedAs = (int)tempCard.SecondNumber; } else { tempCard.UsedAs = (int)tempCard.Value; } } if (tempCard.UsedAs > 14) { throw new BasicBlankException("The use as cannot be higher than 14 ever"); } } if (wildCol.Count > 0) { lastNum += 1; for (int x = lastNum; x <= 14; x++) { if (wildCol.Count == 0) { break; } tempCard = wildCol.First(); tempCard.UsedAs = x; tempCard.Suit = suitOfSet; tempCol.Add(tempCard); wildCol.RemoveSpecificItem(tempCard); } whatFirst--; for (int x = whatFirst; x >= 1; x += -1) { if (wildCol.Count == 0) { break; } tempCard = wildCol.First(); //hopefully still okay. tempCard.UsedAs = x; tempCard.Suit = suitOfSet; tempCol.Add(tempCard); wildCol.RemoveSpecificItem(tempCard); } if (tempCol.Count != originalNumber) { throw new BasicBlankException("Must have the same number of cards sent for creating set"); } } if (tempCol.Any(items => items.UsedAs == 0)) { throw new BasicBlankException("You must have accounted for all used. Rethink"); } var tempList = tempCol.OrderBy(items => items.UsedAs).ToRegularDeckDict(); HandList.ReplaceRange(tempList); if (HandList.Count == 0) { throw new BasicBlankException("HandList Blank"); } _firstNumber = HandList.First().UsedAs; }
void IDealProcesses.PopulateDeals() { var tempList = _gameContainer.SingleInfo !.Hand.GetMailOrDealList <DealCard>(EnumCardCategory.Deal); _model !.CurrentDealList !.HandList.ReplaceRange(tempList); }
public void CreateSet(IDeckDict <RegularRummyCard> thisList) { thisList.ForEach(thisCard => UpdateCard(thisCard)); HandList.ReplaceRange(thisList); }
public override void LoadSet(SavedSet Object) { WhatSet = Object.WhatSet; HandList.ReplaceRange(Object.CardList); }