示例#1
0
        public void PlayCard(Card card)
        {
            int index = mCardCollection.IndexOf(card);
            if (index == -1)
                return;

            card.Played = true;
            mCardCollection[index] = card;
        }
示例#2
0
        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();
        }
示例#3
0
 public void PickRandomCard()
 {
     mCurrentCard = Program.CardBase.GetRandomCard();
     if (mCurrentCard.Equals(Card.Empty)) {
         Program.CardBase.ResetReleventCards();
         mCurrentCard = Program.CardBase.GetRandomCard();
     }
 }
示例#4
0
        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();
            }
        }
示例#5
0
 public bool IsCardSuperCategoryOmitted(Card card)
 {
     return !mActiveSuperCategories.Contains(card.SuperCategory, StringComparer.CurrentCultureIgnoreCase);
 }
示例#6
0
        public void FinishRound()
        {
            Program.CardBase.PlayCard(mCurrentCard);

            mLastCard = mCurrentCard;
            mPlayedRounds++;

            Program.CardBase.Save();
            SaveGame();
        }
示例#7
0
 public void Remove(Card card)
 {
     this.List.Remove(card);
 }
示例#8
0
 public int IndexOf(Card card)
 {
     return this.List.IndexOf(card);
 }
示例#9
0
 public void Add(Card card)
 {
     this.List.Add(card);
 }