Пример #1
0
 public void Add(Player player)
 {
     this.List.Add(player);
 }
Пример #2
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();
            }
        }