public void LoadInfo(List <Witcher3GwentCard> _baseGameCards, List <Witcher3GwentCard> OwnedUnitCards, List <Witcher3GwentCard> OwnedLeaderCards) { BaseGameCards = _baseGameCards; ObservableCollection <GwentCardViewModel> temp = new ObservableCollection <GwentCardViewModel>(); Dictionary <int, Witcher3GwentCard> OwnedCards = new Dictionary <int, Witcher3GwentCard>(); foreach (Witcher3GwentCard thecard in OwnedUnitCards) { OwnedCards[thecard.cardIndex] = thecard; } foreach (Witcher3GwentCard thecard in OwnedLeaderCards) { OwnedCards[thecard.cardIndex] = thecard; } numowned = 0; foreach (Witcher3GwentCard thecard in BaseGameCards) { bool isowned = false; if (OwnedCards.ContainsKey(thecard.cardIndex)) { Witcher3GwentCard owned = OwnedCards[thecard.cardIndex]; thecard.numCopies = owned.numCopies; isowned = true; numowned++; } GwentCardViewModel model = new GwentCardViewModel(thecard); model.IsChecked = isowned; temp.Add(model); } temp.Sort(); CollectEmAllStatus = "Collect 'em all: " + numowned.ToString() + "/" + BaseGameCards.Count.ToString(); _cards = temp; }
public int CompareTo(object o) { GwentCardViewModel a = this; GwentCardViewModel b = (GwentCardViewModel)o; //bool aChecked = a.IsChecked ?? false; //int ret = aChecked.CompareTo(b.IsChecked); //if (ret != 0) return -ret; return(a.Name.CompareTo(b.Name)); }
public void LoadInfo(List <Witcher3GwentCard> _baseGameCards) { BaseGameCards = _baseGameCards; ObservableCollection <GwentCardViewModel> temp = new ObservableCollection <GwentCardViewModel>(); numowned = 0; foreach (Witcher3GwentCard thecard in BaseGameCards) { GwentCardViewModel model = new GwentCardViewModel(thecard); model.IsChecked = false; temp.Add(model); } temp.Sort(); CollectEmAllStatus = "Collect 'em all: " + numowned.ToString() + "/" + BaseGameCards.Count.ToString(); _cards = temp; }