Ejemplo n.º 1
0
        //Cada vez que se tenga que verificar si una respuesta es correcta
        private void labelNext_Click(object sender, EventArgs e)
        {
            if (verResp.Equals(quizAnswers[i])) //REVISAR
            {
                sonidos.sonidoGanarSebastian();
                MyMsgBox.Show("CORRECT!", ":)", "OK");
                score++;
                asignarPregYResp();
            }

            else
            {
                sonidos.sonidoPerderSebastian();
                MyMsgBox.Show("Incorrect...\nCorrect answer: " + quizAnswers[i], ":(", "OK");
                asignarPregYResp();
            }
        }
Ejemplo n.º 2
0
        private void button1Answer_Click(object sender, EventArgs e)
        {
            //verify

            if (questionsCounter <= 12)
            {
                Button b = sender as Button;
                if (b.Text == words[currentImage])
                {
                    //correct
                    sounds.sonidoGanarSebastian();
                    try
                    {
                        sonidos[currentImage].Play();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Error " + ex.Message);
                    }
                    pictureBoxRespuesta.Image = Properties.Resources.check;
                    Task taskA = Task.Factory.StartNew(() => imagenRespuesta());
                    taskA.Wait();
                }
                else
                {
                    //bad
                    sounds.sonidoPerder();
                    pictureBoxRespuesta.Image = Properties.Resources.equis;
                    Task taskA = Task.Factory.StartNew(() => imagenRespuesta());
                    taskA.Wait();
                }
                pictureBoxRespuesta.Image = null;
                mostrar();
            }
            else
            {
                playButton.Show();
            }
        }
Ejemplo n.º 3
0
        private void label_Click(object sender, EventArgs e) //Esto hace que cuando se les dé click aparezcan las imagenes
        {
            // The timer is only on after two non-matching
            // icons have been shown to the player,
            // so ignore any clicks if the timer is running
            if (timer1.Enabled == true)
            {
                return;
            }

            Label clickedLabel = sender as Label; //sender importante

            if (clickedLabel != null)
            {
                /*
                 * // If the clicked label is black, the player clicked
                 * // an icon that's already been revealed --
                 * // ignore the click
                 * if (clickedLabel.ForeColor == Color.Black)
                 *  return;
                 *
                 */

                //Si la imagen es del mismo color del fondo ya se encontró
                //Se ignora el click
                if (clickedLabel.ForeColor == clickedLabel.BackColor)
                {
                    return;
                }


                // If firstClicked is null, this is the first icon
                // in the pair that the player clicked,
                // so set firstClicked to the label that the player
                // clicked, change its color to black, and return

                //Si firstClicked es null, es el primero en recibir un click
                //Se le asigna el label que el usuario clickeó, cambia de color y se retorna
                if (firstClicked == null)
                {
                    sonidos.sonidoOpcion();
                    firstClicked           = clickedLabel;
                    firstClicked.ForeColor = Color.Yellow;

                    return;
                }

                //Si se llega hasta acá, firstClick no es null y le toca a secondClicked
                //Se le asigna el label que el usuario clickeó y cambia de color
                sonidos.sonidoOpcion();
                secondClicked           = clickedLabel;
                secondClicked.ForeColor = Color.Yellow;


                // If the player clicked two matching icons, keep them
                // black and reset firstClicked and secondClicked
                // so the player can click another icon

                //Si se encuentran dos iconos iguales, desaparecen y
                //firstClicked y secondClicked se ponen en null

                //Si uno esta en español y el otro esté en ingles
                if (pairsFamilySpanishReal.ContainsKey(firstClicked.Text) &&
                    pairsFamilyEnglishReal.ContainsKey(secondClicked.Text))
                {
                    if (pairsFamilySpanishReal[firstClicked.Text] == pairsFamilyEnglishReal[secondClicked.Text])
                    {
                        sonidos.sonidoGanarSebastian();
                        firstClicked.ForeColor  = firstClicked.BackColor;
                        secondClicked.ForeColor = firstClicked.BackColor;
                        //Verificar si ya se ganó el juego
                        CheckForWinner();
                        firstClicked  = null;
                        secondClicked = null;
                        return;
                    }
                }
                else if //Si uno esta en ingles y el otro este en español
                (pairsFamilyEnglishReal.ContainsKey(firstClicked.Text) &&
                 pairsFamilySpanishReal.ContainsKey(secondClicked.Text))
                {
                    if (pairsFamilyEnglishReal[firstClicked.Text] == pairsFamilySpanishReal[secondClicked.Text])
                    {
                        sonidos.sonidoGanarSebastian();
                        firstClicked.ForeColor  = firstClicked.BackColor;
                        secondClicked.ForeColor = firstClicked.BackColor;
                        //Verificar si ya se ganó el juego
                        CheckForWinner();
                        firstClicked  = null;
                        secondClicked = null;
                        return;
                    }
                }

                // If the player gets this far, the player
                // clicked two different icons, so start the
                // timer (which will wait three quarters of
                // a second, and then hide the icons)
                timer1.Start();
            }
        }