Esempio n. 1
0
        /// <summary>
        /// Choose to begin a new game or to go to the menu
        /// </summary>
        /// <param name="progMenu">Program Menu</param>
        /// <param name="menuForm">User Table</param>
        public void GameWinMoveYesNo(ProgramMenu progMenu, MenuForm menuForm)
        {
            bool ch = true;

            while (ch)
            {
                Action action = UserAction.GetUserAction();
                switch (action)
                {
                case Action.Left:
                    progMenu.MoveYesNo(menuForm, -1);
                    break;

                case Action.Right:
                    progMenu.MoveYesNo(menuForm, 1);
                    break;

                case Action.Enter:
                    ch = false;
                    break;
                }
            }
            if (progMenu.CursorYesNo == 0)
            {
                Program.controller.RunForm(GameForms.SetInfo);
            }
            else
            {
                Program.controller.RunForm(GameForms.Menu);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Exit from game
        /// </summary>
        /// <param name="strExit">Picture of Exit</param>
        /// <param name="pm">Program Menu</param>
        /// <param name="mn">User Table</param>
        /// <param name="playingField">Program Table</param>
        /// <returns>Program state</returns>
        private bool GameExit()
        {
            bool        EndGame  = false;
            ProgramMenu progMenu = new ProgramMenu();
            MenuForm    menuForm = new MenuForm();

            Console.Clear();
            Console.WriteLine(_strExit);
            progMenu.MoveYesNoExit(menuForm, 0);
            bool bl = true;

            while (bl)
            {
                action = UserAction.GetUserAction();
                switch (action)
                {
                case Action.Left:
                    progMenu.MoveYesNoExit(menuForm, -1);
                    break;

                case Action.Right:
                    progMenu.MoveYesNoExit(menuForm, 1);
                    break;

                case Action.Enter:

                    if (progMenu.CursorYesNoExit == 0)
                    {
                        EndGame = false;
                        bl      = false;
                    }
                    else
                    {
                        EndGame = true;
                        bl      = false;
                    }
                    break;
                }
            }
            return(EndGame);
        }
Esempio n. 3
0
        /// <summary>
        /// If user wins/loses game
        /// </summary>
        /// <param name="playingField">Program Table</param>
        /// <returns>Program state</returns>
        public void WinGame()
        {
            ProgramMenu progMenu = new ProgramMenu();
            MenuForm    menuForm = new MenuForm();

            Console.Clear();
            Console.Write(_strWinLose);

            if (_state == GameState.Win)
            {
                Console.SetCursorPosition(19, 13);
                Console.WriteLine(" Поздравляю, вы победили! ");
            }
            if (_state == GameState.Lose)
            {
                Console.SetCursorPosition(24, 13);
                Console.WriteLine(" Вы проиграли! ");
            }
            progMenu.MoveYesNo(menuForm, 0);
            Console.SetCursorPosition(38, 12);

            GameWinMoveYesNo(progMenu, menuForm);
        }
Esempio n. 4
0
 public ProgramMenuControl(string strMenu, ProgramMenu progMenu, MenuForm menuForm)
 {
     _strMenu  = strMenu;
     _progMenu = progMenu;
     _menuForm = menuForm;
 }