Пример #1
0
        /// <summary>
        /// On game draw, all information is saved into their respective databases.
        /// </summary>
        /// <param name="playerDB"></param>
        /// <param name="recordDB"></param>
        /// <param name="gameDB"></param>
        public void SaveDraw(PlayerDAO playerDB, RecordDAO recordDB, GameDAO gameDB)
        {
            // Updates player table information.
            playerDB.UpdateBalance(Player);
            // Updates record table information.
            Record record = recordDB.ReadRecordByUserName(Player.UserName);

            record.GamesPlayed++;
            record.Draws++;
            recordDB.UpdateRecord(record);
            // Updates game table information.
            gameDB.AddNewGame(new Game(Player.UserName, Result.DRAW, GameBalance / 2));
        }