public bool Deserialize(string s, Deck deck) { Dictionary <string, string> dict = StaticHelpers.DeserializeDictionary(s); if (dict == null) { return(false); } string sHand = dict["Hand"]; _type = (PlayerType)Enum.Parse(typeof(PlayerType), dict["Type"], true); List <CardView> cards = StaticHelpers.DeserializeToList(sHand, deck);; _hand = new Hand(cards); _hasCrib = Convert.ToBoolean(dict["HasCrib"]); if (_hasCrib) { _crib = new Crib(); _crib.Cards = StaticHelpers.DeserializeToList(dict["Crib"], deck); } _score = Convert.ToInt32(dict["Score"]); return(true); }
public bool Deserialize(Dictionary <string, string> dict) { if (dict == null) { return(false); } // _playerHand = StaticHelpers.DeserializeToList(dict["PlayerHand"], false); // _computerHand = StaticHelpers.DeserializeToList(dict["ComputerHand"], true); _runCards = StaticHelpers.DeserializeToList(dict["RunCards"]); _countedCards = StaticHelpers.DeserializeToList(dict["CountedCards"]); foreach (CardView card in _countedCards) { if (StaticHelpers.RemoveCardByValueFromList(_playerHand, card) == false) { StaticHelpers.RemoveCardByValueFromList(_computerHand, card); } } return(true); }
public bool Deserialize(string s, Deck deck) { Dictionary <string, string> dict = StaticHelpers.DeserializeDictionary(s); if (dict == null) { return(false); } _runCards = StaticHelpers.DeserializeToList(dict["RunCards"], deck); _countedCards = StaticHelpers.DeserializeToList(dict["CountedCards"], deck); foreach (CardView card in _countedCards) { if (StaticHelpers.RemoveCardByValueFromList(_playerHand, card) == false) { StaticHelpers.RemoveCardByValueFromList(_computerHand, card); } } return(true); }