コード例 #1
0
 private void backButton_Click(object sender, EventArgs e)
 {
     menu = new Menu();
     this.Hide();
     menu.Show();
 }
コード例 #2
0
ファイル: Creditos.cs プロジェクト: AlexMethod/Visual-Project
 private void label2_Click(object sender, EventArgs e)
 {
     this.Hide();
     menu.Show();
 }
コード例 #3
0
ファイル: Juego.cs プロジェクト: AlexMethod/Visual-Project
 private void label1_Click(object sender, EventArgs e)
 {
     //Boton menu, esconde la forma actual y muestra el menu
     this.Hide();
     menu.Show();
 }
コード例 #4
0
        public override void Close()
        {
            base.Close();

            nextMenu.Show();
        }
コード例 #5
0
ファイル: Options.cs プロジェクト: macieslik/Space-Shooter
        private void Options_KeyDown(object sender, KeyEventArgs e)
        {
            // Removing border from the previous button
            menuButtons[currentButtonIndex].FlatAppearance.BorderSize = 0;

            switch (e.KeyCode)
            {
            case Keys.Up:
                if (currentButtonIndex > 0)
                {
                    currentButtonIndex--;
                }
                else if (currentButtonIndex <= 0)
                {
                    currentButtonIndex = menuButtons.Count - 1;
                }
                SoundEffects.button.Play();
                break;

            case Keys.Down:
                if (currentButtonIndex < menuButtons.Count - 1)
                {
                    currentButtonIndex++;
                }
                else if (currentButtonIndex >= menuButtons.Count - 1)
                {
                    currentButtonIndex = 0;
                }
                SoundEffects.button.Play();
                break;

            case Keys.Left:
                if (currentButtonIndex == 0)
                {
                    if (Globals.selectedSpaceship > 0)
                    {
                        Globals.selectedSpaceship--;
                    }
                    else if (Globals.selectedSpaceship <= 0)
                    {
                        Globals.selectedSpaceship = Globals.spaceships.Count - 1;
                    }
                    // Update text with newly selected ship's info
                    lblShip.Text      = Globals.spaceships[Globals.selectedSpaceship].Name;
                    lblShip.Location  = new Point(Consts.FORM_WIDTH / 2 - lblShip.Width / 2, Consts.MARGIN_TOP + Consts.LABEL_OFF);
                    lblShip.ForeColor = Globals.spaceships[Globals.selectedSpaceship].Color;

                    btnShip.Text = $"SHIP\n{char.ConvertFromUtf32(0x2190)} {Globals.spaceships[Globals.selectedSpaceship].Name} " +
                                   $"{char.ConvertFromUtf32(0x2192)}";
                }

                if (currentButtonIndex == 1)
                {
                    if (Globals.selectedLevel > 0)
                    {
                        Globals.selectedLevel--;
                    }
                    else if (Globals.selectedLevel <= 0)
                    {
                        Globals.selectedLevel = Globals.allLevels.Count - 1;
                    }
                    // Update text with newly selected level's index
                    btnLevel.Text = $"LEVEL\n{char.ConvertFromUtf32(0x2190)} {Globals.selectedLevel} {char.ConvertFromUtf32(0x2192)}";
                }

                SoundEffects.button.Play();
                break;

            case Keys.Right:
                if (currentButtonIndex == 0)
                {
                    if (Globals.selectedSpaceship < Globals.spaceships.Count - 1)
                    {
                        Globals.selectedSpaceship++;
                    }
                    else if (Globals.selectedSpaceship >= Globals.spaceships.Count - 1)
                    {
                        Globals.selectedSpaceship = 0;
                    }
                    // Update text with newly selected ship's info
                    lblShip.Text      = Globals.spaceships[Globals.selectedSpaceship].Name;
                    lblShip.Location  = new Point(Consts.FORM_WIDTH / 2 - lblShip.Width / 2, Consts.MARGIN_TOP + Consts.LABEL_OFF);
                    lblShip.ForeColor = Globals.spaceships[Globals.selectedSpaceship].Color;

                    btnShip.Text = $"SHIP\n{char.ConvertFromUtf32(0x2190)} {Globals.spaceships[Globals.selectedSpaceship].Name} " +
                                   $"{char.ConvertFromUtf32(0x2192)}";
                }

                if (currentButtonIndex == 1)
                {
                    if (Globals.selectedLevel < Globals.allLevels.Count - 1)
                    {
                        Globals.selectedLevel++;
                    }
                    else if (Globals.selectedLevel >= Globals.allLevels.Count - 1)
                    {
                        Globals.selectedLevel = 0;
                    }
                    // Update text with newly selected level's index
                    btnLevel.Text = $"LEVEL\n{char.ConvertFromUtf32(0x2190)} {Globals.selectedLevel} {char.ConvertFromUtf32(0x2192)}";
                }

                SoundEffects.button.Play();
                break;

            case Keys.Enter:
                if (currentButtonIndex == 2)
                {
                    SoundEffects.button.Play();
                    this.Hide();
                    Menu menu = new Menu();
                    menu.Show();
                }
                break;
            }
            // Setting border for the newly selected button
            menuButtons[currentButtonIndex].FlatAppearance.BorderSize = 1;
        }