Esempio n. 1
0
        /// <summary>
        /// Finishes the game
        /// </summary>
        /// <param name="won"></param>
        private void FinishGame(bool won)
        {
            double time = ResetTimer();

            if (gameActive && won)
            {
                var result = MessageBox.Show(russian ? $"Вы нашли путь!\nВаше время: {time:F1}\nХотите сохранить ваш результат?" : $"You found the route!\nYour time: {time:F1}\nDo you wish to save your result?", "Circular Route", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    SaveResult(time);
                }
            }
            if (!won)
            {
                // play the loss sound effect
                MessageBox.Show(russian ? "Вы проиграли! Удачи в следующий раз..." : "You lost! Better luck next time...", "Circular Route");
            }
            gameActive = false;
            UpdateTimer();
            SetArrowButtonsEnabled(false);
            ResetPicDir();
            SetSideButtonsEnabled(true);
            CancelSolvingButton.Hide();
            GiveUpButton.Hide();
        }
Esempio n. 2
0
 private void CancelSolvingButton_Click(object sender, EventArgs e)
 {
     gridIm.SolvingAllowed = false;
     CancelSolvingButton.Hide();
     GiveUpButton.Hide();
     ResetTimer();
     SetArrowButtonsEnabled(false);
     SetSideButtonsEnabled(true);
     GiveUpButton.Text    = "Give up";
     GiveUpButton.Enabled = true;
     ResetPicDir();
 }
Esempio n. 3
0
        /// <summary>
        /// Initializes the form
        /// </summary>
        /// <param name="side">The side of the grid</param>
        /// <param name="russian">True if the text should be in russian</param>
        public void Initialize(int side, bool russian)
        {
            CenterToScreen();

            gameActive = false;
            editingOn  = false;
            SetSideButtonsEnabled(true);

            this.russian = russian;
            this.side    = side;
            ResetTimer();

            if (side == 6)
            {
                Size = new Size(816 + 10, 489 + 10);
            }
            else
            {
                Size = new Size(926 + 10, 579 + 10);
            }

            UpdateName();

            if (russian)
            {
                CreateGridButton.Text    = "Создать свое поле";
                LoadGridButton.Text      = "Загрузить";
                RandomButton.Text        = "Случайное поле";
                ChangeNameButton.Text    = "Поменять имя";
                LeaderboardsButton.Text  = "Рекорды";
                CloseButton.Text         = "Закрыть";
                ControlTipLabel.Text     = "Подсказка управления:\nВы можете использовать кнопки направления на вашей клавиатуре или кнопки снизу чтобы выстраивать ваш маршрут.";
                GiveUpButton.Text        = "Сдаться";
                CancelSolvingButton.Text = "Отмена";
            }
            else
            {
                CreateGridButton.Text    = "Create your grid";
                LoadGridButton.Text      = "Load";
                RandomButton.Text        = "Solve random";
                ChangeNameButton.Text    = "Change Name";
                LeaderboardsButton.Text  = "Leaderoards";
                CloseButton.Text         = "Close";
                ControlTipLabel.Text     = "Control tip:\nYou can use the arrow keys on your keyboard or the arrow buttons down below to navigate your route.";
                GiveUpButton.Text        = "Give up";
                CancelSolvingButton.Text = "Cancel";
            }



            try
            {
                leaders6 = PlayerInfo.Load(leaderboards6Path);
            }
            catch (IOException)
            {
                leaders6 = new List <PlayerInfo>
                {
                    new PlayerInfo("Bob", 6, 300)
                };
                PlayerInfo.Save(leaders6, leaderboards6Path);
            }

            try
            {
                leaders8 = PlayerInfo.Load(leaderboards8Path);
            }
            catch (IOException)
            {
                leaders8 = new List <PlayerInfo>
                {
                    new PlayerInfo("Bob", 8, 600)
                };
                PlayerInfo.Save(leaders8, leaderboards8Path);
            }


            SetArrowButtonsEnabled(false);

            SaveButton.Hide();
            CancelCreatingButton.Hide();
            CancelSolvingButton.Hide();
            GiveUpButton.Hide();


            FillPanel();
            ShowDialog();
        }