Example #1
0
        void falloRealizado()
        {
            if (this.intentos.Equals(4))
            {
                // Image myImage = Resources._2;
                this.pictureBoxAhorcado.Image = Resources._2;
            }
            else if (this.intentos.Equals(3))
            {
                this.pictureBoxAhorcado.Image = Resources._3;
            }
            else if (this.intentos.Equals(2))
            {
                this.pictureBoxAhorcado.Image = Resources._4;
            }
            else if (this.intentos.Equals(1))
            {
                this.pictureBoxAhorcado.Image = Resources._5;
            }

            this.intentos--;
            this.labelIntentosRestantes.Text = this.labelIntentosRestantes.Text.Substring(0, (this.labelIntentosRestantes.Text.Length - 1)) + this.intentos;

            if (this.intentos.Equals(0))
            {
                this.Visible = false;
                PantallaFinal nuevaInterfaz = new PantallaFinal(antiguoForm, "Has Perdido");
                nuevaInterfaz.Visible = true;
            }
        }
Example #2
0
        void aciertoRealizado()
        {
            this.respuestaAvance = "";
            bool letraExistente = false;

            this.labelrespuesta.Text = "";
            foreach (char caracter in this.respuesta)
            {
                letraExistente = false;

                foreach (char caracterYaIntroducido in this.caracteresAcertados)
                {
                    if (caracter.Equals(caracterYaIntroducido))
                    {
                        this.respuestaAvance += caracterYaIntroducido + " ";
                        cantidadAciertos++;
                        letraExistente = true;
                    }
                }

                if (!letraExistente)
                {
                    this.respuestaAvance += "_ ";
                }
            }

            this.labelrespuesta.Text = this.respuestaAvance;

            if (cantidadAciertos.Equals(this.respuesta.Length))
            {
                this.Visible = false;
                PantallaFinal nuevaInterfaz = new PantallaFinal(antiguoForm, "Has Ganado");
                nuevaInterfaz.Visible = true;
            }
            cantidadAciertos = 0;
        }