Пример #1
0
        private static void ProcessGame()
        {
            bool isExit = true;

            while (isExit)
            {
                int seletedGameManagment = view.DrawGameBoard(model);
                switch (seletedGameManagment)
                {
                //возврат назад
                case (int)GameManagment.Back:
                    model.StopTimer();
                    isExit = false;
                    break;

                //открыти ячейки
                case (int)GameManagment.Open:
                    model.OpenCell(view.X, view.Y);
                    break;

                //отмтить/убрать флаг
                case (int)GameManagment.Flag:
                    model.SetFlagCoordinate(view.X, view.Y);
                    break;
                }

                //проверка статуса игры посл хода
                if (model.GetStatusGame() == GameStatus.GameOver)
                {
                    view.DrawGameOver();
                    seletedGameManagment = view.DrawGameBoard(model);
                    isExit = false;
                }
                if (model.GetStatusGame() == GameStatus.Win)
                {
                    view.DrawWin();
                    string name = view.SetNameHightScore(model.CheckResult());
                    model.SaveResultHightScore(name);
                    seletedGameManagment = view.DrawGameBoard(model);
                    isExit = false;
                }
            }
        }