public void PlayCard(Card card) { int index = mCardCollection.IndexOf(card); if (index == -1) return; card.Played = true; mCardCollection[index] = card; }
public void Load() { mCardCollection.Clear(); List<string> playedCategories = new List<string>(GetPlayedCategories()); CSVReader reader = new CSVReader("cards.csv"); foreach (string[] row in reader.Values) { Card card = new Card(row[0], row[1]); if (playedCategories.Contains(card.Category, StringComparer.CurrentCultureIgnoreCase)) card.Played = true; mCardCollection.Add(card); } mSuperCategories = GetSuperCategories(); }
public void PickRandomCard() { mCurrentCard = Program.CardBase.GetRandomCard(); if (mCurrentCard.Equals(Card.Empty)) { Program.CardBase.ResetReleventCards(); mCurrentCard = Program.CardBase.GetRandomCard(); } }
public void LoadGame() { FileStream fs = null; BinaryReader br = null; try { fs = new FileStream("save.dat", FileMode.Open); br = new BinaryReader(fs); mRoundDuration = br.ReadInt32(); mPlayedRounds = br.ReadInt32(); mLastCard = new Card(br.ReadString(), br.ReadString()); mPlayers.Clear(); int numPlayers = br.ReadInt32(); for (int i = 0; i < numPlayers; i++) { Player p = new Player(br.ReadString(), br.ReadInt32()); mPlayers.Add(p); } int numSuperCategories = br.ReadInt32(); mActiveSuperCategories = new string[numSuperCategories]; for (int i = 0; i < numSuperCategories; i++) mActiveSuperCategories[i] = br.ReadString(); } catch { } finally { if (br != null) br.Close(); if (fs != null) fs.Close(); } }
public bool IsCardSuperCategoryOmitted(Card card) { return !mActiveSuperCategories.Contains(card.SuperCategory, StringComparer.CurrentCultureIgnoreCase); }
public void FinishRound() { Program.CardBase.PlayCard(mCurrentCard); mLastCard = mCurrentCard; mPlayedRounds++; Program.CardBase.Save(); SaveGame(); }
public void Remove(Card card) { this.List.Remove(card); }
public int IndexOf(Card card) { return this.List.IndexOf(card); }
public void Add(Card card) { this.List.Add(card); }