private void buttonReturn_Click(object sender, EventArgs e) { InitializeComponent(); m3grado = new Menu3erGrado(); m3grado.Show(); this.Hide(); }
private void CheckForWinner() //Revisa que los colores de las imagenes y el fondo NO sean iguales { // Go through all of the labels in the TableLayoutPanel, // checking each one to see if its icon is matched foreach (Control control in tableLayoutPanel3erGrado.Controls) { Label iconLabel = control as Label; if (iconLabel != null) { //Para que solo se gane cuando el tablero esté vacío if (iconLabel.ForeColor != iconLabel.BackColor) { return; } } } // If the loop didn’t return, it didn't find // any unmatched icons // That means the user won. Show a message and close the form sonidos.sonidoTerminarBien(); MyMsgBox.Show("YOU MATCHED ALL THE WORDS!", ":)", "OK"); InitializeComponent(); m3grado = new Menu3erGrado(); m3grado.Show(); this.Hide(); //Close(); }
//Devolverse al menu anterior private void labelReturn_Click(object sender, EventArgs e) { InitializeComponent(); m3er = new Menu3erGrado(); m3er.Show(); this.Hide(); }
//Que esto ocurra siempre que el juego inicie y cuando se confirme que una respuesta es correcta private void asignarPregYResp() { sameBackColor(); if (i + 1 < questions.Length) { i++; } else { if (score > 6) { sonidos.sonidoTerminarBien(); } else { sonidos.sonidoTerminar(); } MyMsgBox.Show("FINISH!\nFinal score: " + +score + " / " + questions.Length.ToString(), "", "OK"); InitializeComponent(); m3er = new Menu3erGrado(); m3er.Show(); this.Hide(); return; } KeyValuePair <string[], int> pair; labelQuant.Text = (i + 1).ToString() + " / " + questions.Length.ToString() + " Score: " + score + " / " + questions.Length.ToString(); labelQuestion.Text = questions[i]; Image im = imageList1.Images[i]; //La imagen de la lista de imagenes labelQuestion.Image = im; int cant; Random rand = new Random(); numbers = new int[4] { 0, 1, 2, 3 }; pair = allAnswers.ElementAt(i); labelAnswer1.Text = pair.Key[numbers[cant = rand.Next(0, numbers.Length)]]; numbers = numbers.Where(w => w != numbers[cant]).ToArray(); labelAnswer2.Text = pair.Key[numbers[cant = rand.Next(0, numbers.Length)]]; numbers = numbers.Where(w => w != numbers[cant]).ToArray(); labelAnswer3.Text = pair.Key[numbers[cant = rand.Next(0, numbers.Length)]]; numbers = numbers.Where(w => w != numbers[cant]).ToArray(); labelAnswer4.Text = pair.Key[numbers[cant = rand.Next(0, numbers.Length)]]; //numbers = numbers.Where(w => w != numbers[cant]).ToArray(); labelNext.Visible = false; }