private void btnAceptarConfigInicial_Click(object sender, EventArgs e) { if (txtNombreJu.Text != null && cmbSeleccionarDificultad.SelectedIndex > -1) { String dificultad = cmbSeleccionarDificultad.SelectedItem.ToString(); DatosJugador nuevoJugador = new DatosJugador(txtNombreJu.Text, dificultad); Boolean entradaPorVoz; if (rBtnVoz.Checked) { entradaPorVoz = true; } else { entradaPorVoz = false; } if (dificultad == "Facil") { juego = new Juego(listadeMapasFacil, dificultad, nuevoJugador, entradaPorVoz, (int)nudVidasPacman.Value, (int)nudHPPacman.Value); } else if (dificultad == "Medio") { juego = new Juego(listadeMapasMedio, dificultad, nuevoJugador, entradaPorVoz, (int)nudVidasPacman.Value, (int)nudHPPacman.Value); } else if (dificultad == "Dificil") { juego = new Juego(listadeMapasDificil, dificultad, nuevoJugador, entradaPorVoz, (int)nudVidasPacman.Value, (int)nudHPPacman.Value); } VistaJuego vj = new VistaJuego(); vj.definirEntrada(entradaPorVoz); if (entradaPorVoz) { vj.iniciarReconocedor(); } vj.crearJuego(this.juego); DialogResult res = vj.ShowDialog(); if (res == DialogResult.OK) { carYReproducir(); DatosJugador jugadorEntrante = vj.Juego.DatosJugador; jugadorEntrante.Fecha = DateTime.Now.ToString(); this.datosJugadores.Add(jugadorEntrante); this.ordenarDescendente(); this.panelConfigInicio.Visible = false; this.panelPuntajes.Visible = true; this.listarDatosJugadores(); this.cargarMapas(); } } else { MessageBox.Show("No hay nombre o nivel de dificultad seleccionado"); } }
public void crearJuego(Juego j) { Juego = j; new Thread(this.cicloJuego).Start(); new Thread(this.Juego.aumentarSegundos).Start(); }