示例#1
0
        private void Moving(Point point)
        {
            PictureBox a = FirstSelect.Pop();

            a.Location = point;
            SecondSelect.Push(a);
            move++;
            label5.Text       = string.Format("Số bước đi : {0}", move);
            FirstSelect       = SecondSelect = null;
            ABoxPic.BackColor = BBoxPic.BackColor = CBoxPic.BackColor = System.Drawing.Color.Gray;

            if (RodC.Count == Level.Value && Level.Value != 9)
            {
                GiveUpButton.PerformClick();
                MessageBox.Show("Bạn đã qua màn này. Mời bạn chơi level tiếp theo  ", "CHÚC MỪNG!!!", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                Level.Value = Level.Value + 1;
                PlayButton.PerformClick();
            }
            else if (RodC.Count == Level.Value && Level.Value == 9)
            {
                GiveUpButton.PerformClick();
                MessageBox.Show("Bạn đã vượt qua 9 màn, trò chơi kết thúc  ", "CHÚC MỪNG!!!", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }            //if(Level.Value<8,)
                         //throw new NotImplementedException();
        }
示例#2
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();
        }
示例#3
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();
 }
示例#4
0
        private void BeginSolving()
        {
            gridIm.ResetPos();
            gridIm.Grid[0, 0] = 41;

            editingOn = true;
            SetSideButtonsEnabled(false);

            UpdateGridPanel();

            CancelSolvingButton.Show();
            GiveUpButton.Show();
            GridPanel.BringToFront();

            SetArrowButtonsEnabled(true);

            GridPanel.Focus();

            TimerCounter.Enabled = true;
        }
示例#5
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();
        }