예제 #1
0
        public virtual bool Update(Card card)
        {
            if (card.Type == "Spell")
            {
                HearthDb.Cards.All.TryGetValue(card.Id, out DbCard dbCard);

                if (dbCard?.SpellSchool > 0)
                {
                    if (SchoolList.ContainsKey(dbCard.SpellSchool))
                    {
                        SchoolList[dbCard.SpellSchool] = card.Clone() as Card;
                    }
                    else
                    {
                        SchoolList.Add(dbCard.SpellSchool, card.Clone() as Card);
                    }

                    Cards.Update(SchoolList.Values.ToList(), true);

                    Visibility = Visibility.Visible;

                    return(true);
                }
            }
            return(false);
        }
예제 #2
0
        public virtual bool Update(Card card)
        {
            CardLists[0].Add(card.Clone() as Card);
            Views[0].Cards.Update(CardLists[0], false);

            Visibility = Visibility.Visible;

            return(true);
        }
예제 #3
0
        public virtual bool Update(Card card)
        {
            Cards.Update(new List <Card> {
                card.Clone() as Card
            }, false);

            Visibility = Visibility.Visible;

            return(true);
        }
예제 #4
0
        public bool Update(Card card, bool isSpell = false)
        {
            if (card.Type != "Minion" && !isSpell)
            {
                return(false);
            }

            // Increment
            var match = Cards.FirstOrDefault(c => c.Name == card.Name);

            if (match != null)
            {
                match.Count++;
            }
            else
            {
                Cards.Add(card.Clone() as Card);
            }
            View.Update(Cards, false);

            Visibility = Visibility.Visible;

            return(true);
        }