/// <summary> /// Новая игра. /// </summary> public void NewGame() { Clear(); MovesManager.NewGame(); ScoreManager.InitNewGame(); Deck deck = new Deck104(); List <Card> cards = deck.Cast <Card>().ToList(); // Добавляем карты в таблицы. int addCardsCount = 9; for (int i = 0; i < Tableaus - 1; i++) { Util.Move(cards, _tableau[i].GetList(), addCardsCount); addCardsCount--; } // Переворачиваем верхние карты. for (int i = 0; i < Tableaus - 1; i++) { _tableau[i].GetTopCard().SetFaceUp(); } // Добавляем оставшиеся 67 карт в запас. _stock.AddCards(cards); }
/// <summary> /// Перезапустить игру. /// </summary> /// <param name="clearMoves">очищать ли историю ходов и очки</param> public void RestartGame(bool clearMoves = true) { if (!clearMoves) { ScoreManager.FreezeScore(); } while (MovesManager.GetMoveIndex() > 0) { Undo(); } if (clearMoves) { MovesManager.NewGame(); ScoreManager.InitNewGame(); } }