private void P_focusedBibles_Load(object sender, EventArgs e) { // this.AddOwnedForm(Gamesettings); //indica que este va a ser el papa del form settings lab_Wins_P1.Text = Convert.ToString(wins_01); lab_Wins_P2.Text = Convert.ToString(wins_02); tlyo_Wins_P1.Visible = true; tlyo_Wins_P2.Visible = false; lab_Rounds_Left.Text = round + "/" + numRounds; lab_Rounds_Right.Text = round + "/" + numRounds; lab_Difficulty.Text = difficulty; lab_LifesNum.Text = Convert.ToString(lifes_1); lab_LifesNum2.Text = Convert.ToString(lifes_2); lab_Player1.Text = player1; lab_Player2.Text = player2; countDownTimer2 = time2Answer; Timer_2Answer.Start(); banner = "Round" + round; reproducirSonido("levelclearer.wav", true); objEntidad.dificultad = difficulty; noRepetir = new int?[objNego.N_NumFilas()]; // el tamaño es el tamaño del numero de filas noRepetir_PorDificultad = new int?[objNego.N_NumFilas_PorDificultad(objEntidad)]; // el tamaño es el tamaño del numero de filas lista_porDificultad = new E_focusedBible[objNego.N_NumFilas_PorDificultad(objEntidad)]; Llenar_listaPorDificultad(objEntidad); listarFocusedBible(objEntidad); focoRbtn(); bloquear_Btn_Submit(); }
private void Timer_2Answer_Tick(object sender, EventArgs e) { if (countDownTimer2 != 0) { lab_Anuncios.Text = Convert.ToString(countDownTimer2); countDownTimer2--; } else { countDownTimer2 = time2Answer; Timer_2Answer.Stop(); lab_correctWrong(0); // Cambio de Jugador if (turno == 1) { countDown.Start(); turno = 2; //Player 2 } else { countDown.Start(); turno = 1; //Player 1 } } }
private void btn_goToMain_Click(object sender, EventArgs e) { // para saber si el formulario existe, o sea, si está abierto o cerrado Form existe = Application.OpenForms.OfType <Form>().Where(pre => pre.Name == "P_Main").SingleOrDefault <Form>(); existe.Show(); Timer_2Answer.Stop(); sonido.Stop(); this.Close(); //Esto cierra la ventana del juego y va a Main }
void perder_Ganar() { //condicion para perder if (lifes_1 == 0 || lifes_2 == 0 || ((countUp == noRepetir_PorDificultad.Length) && (difficulty != "All"))) { Timer_2Answer.Stop(); //detener conteo reproducirSonido("game-over.wav", false); if (round == numRounds) // si es el ultimo round { Thread.Sleep(1500); //condicion para saber quien perdió if (turno == 1) { //MessageBox.Show(lab_Player1.Text + " Lose!\n\n" + lab_Player2.Text + " Wins\nLifes: " + lifes_2 + "\nScore: " + score_2); BannerStart(lab_Player2.Text + " Wins"); } else { //MessageBox.Show(lab_Player1.Text + " Lose!\n\n" + lab_Player2.Text + " Wins\nLifes: " + lifes_2 + "\nScore: " + score_2); BannerStart(lab_Player1.Text + " Wins"); } } else if (((countUp == noRepetir_PorDificultad.Length) && (difficulty != "All"))) // si se acaban las preguntas, se acaba el juego { Thread.Sleep(1500); //condicion para saber quien perdió if (score_1 == score_2) { BannerStart("It's a Draw!"); } else if (score_2 > score_1) { //MessageBox.Show(lab_Player1.Text + " Lose!\n\n" + lab_Player2.Text + " Wins\nLifes: " + lifes_2 + "\nScore: " + score_2); BannerStart(lab_Player2.Text + " Wins"); } else { //MessageBox.Show(lab_Player1.Text + " Lose!\n\n" + lab_Player2.Text + " Wins\nLifes: " + lifes_2 + "\nScore: " + score_2); BannerStart(lab_Player1.Text + " Wins"); } } else { ChangeRound(); } } }
void BannerStart(string banner) { Thread.Sleep(2000); Timer_2Answer.Stop(); sonido.Stop(); this.banner = banner; Banner = new Banners(banner); Banner.Show(); Timer_Banner.Start(); if (banner == "Round " + round) // solo se reproduce el sonido si es un cambio de round { reproducirSonido("start-ready-go.wav", false); } }
private void P_focusedBibles_Activated(object sender, EventArgs e) { if (E_focusedBible.deSettings == true) // para saber si se acaba de salir de settings a pantalla de juego { Timer_2Answer.Start(); if (sonido != null) { sonido.PlayLooping(); } E_focusedBible.deSettings = false; // desactivando ya que desde este momento no se acaba de entrar } }
void PlayerFocus(int turno) { if (turno == 1) { // si hay cambio de turno y pasage no es igual a N/A o "", Ni se ha acabado el comodin passage if (passage != "N/A" && passage != "" && lab_Passage_1.Text != "0") { lab_Passage_1.Enabled = true; } //para poder cambiar el tamaño de la fuente hay que instanciarla y pasarle los parametros siguientes. lab_Player1.Font = new Font(lab_Player1.Font.Name, 20, lab_Player1.Font.Style, lab_Player1.Font.Unit); //para cambiar el color a gris lab_Player1.ForeColor = Color.FromArgb(228, 161, 24); lab_Player2.Font = new Font(lab_Player2.Font.Name, 10, lab_Player2.Font.Style, lab_Player2.Font.Unit); //para cambiar el color a orange lab_Player2.ForeColor = Color.FromArgb(237, 237, 237); cambiarColoryJugador(turno); Timer_2Answer.Start(); } else // si el turno es 2 { // si hay cambio de turno y pasage no es igual a N/A o "", Ni se ha acabado el comodin passage if (passage != "N/A" && passage != "" && lab_Passage_2.Text != "0") { lab_Passage_2.Enabled = true; } lab_Player2.Font = new Font(lab_Player2.Font.Name, 20, lab_Player2.Font.Style, lab_Player2.Font.Unit); lab_Player2.ForeColor = Color.FromArgb(228, 161, 24); lab_Player1.Font = new Font(lab_Player1.Font.Name, 10, lab_Player1.Font.Style, lab_Player1.Font.Unit); lab_Player1.ForeColor = Color.FromArgb(237, 237, 237); cambiarColoryJugador(turno); Timer_2Answer.Start(); } }
void StartAgan() { if ((round == numRounds && banner != "Round " + round) || ((countUp == noRepetir_PorDificultad.Length) && (difficulty != "All"))) // significa que el juego ha terminado { Timer_2Answer.Stop(); sonido.Stop(); DialogResult respuesta = MessageBox.Show("The Game has Finished!\nDo you want to Play Again?", "Game Over", MessageBoxButtons.YesNo); if (respuesta == DialogResult.Yes) { reproducirSonido("start-ready-go.wav", false); Thread.Sleep(700); restart = true; reset_PlayAgain(); Banner.Hide(); } else { Application.Exit(); } } }
void reset_PlayAgain() { Timer_2Answer.Stop(); //detener conteo countDownTimer = 3; countDownTimer2 = time2Answer; countDownTimer3 = 2; if (restart == true) { restart = false; i = 0; countUp = 0; enumerate = 1; // para ponerle número a las preguntas round = 1; turno = 1; wins_01 = 0; wins_02 = 0; score_1 = 0; score_2 = 0; passage = ""; lab_Rounds_Left.Text = round + "/" + numRounds; lab_Rounds_Right.Text = round + "/" + numRounds; lab_Wins_P1.Text = Convert.ToString(wins_01); lab_Wins_P2.Text = Convert.ToString(wins_02); Array.Clear(noRepetir, 0, noRepetir.Length); // vaciar arreglo Array.Clear(noRepetir_PorDificultad, 0, noRepetir_PorDificultad.Length); // vaciar arreglo } lifes_1 = 3; lifes_2 = 3; countDownComodin_1 = 3; countDownComodin_2 = 3; countDownPassage_1 = 3; countDownPassage_2 = 3; Lab_Passage_Shown_1.Text = ""; Timer_2Answer.Start(); if (banner == lab_Player1.Text + " Wins" || banner == lab_Player2.Text + " Wins" || banner == "It's a Draw!") { AfterCountDown(true); banner = "Round" + round; // resetear banner } lab_LifesNum.Text = Convert.ToString(lifes_1); lab_LifesNum2.Text = Convert.ToString(lifes_2); lab_ScoreNum.Text = Convert.ToString(score_1); lab_ScoreNum2.Text = Convert.ToString(score_2); lab_50_1.Text = "+3"; lab_50_2.Text = "+3"; pbx_50_1.Enabled = true; pbx_50_2.Enabled = true; lab_50_1.Enabled = true; lab_50_2.Enabled = true; lab_Passage_1.Text = "+3"; lab_Passage_2.Text = "+3"; pbx_Passage_1.Enabled = true; pbx_Passage_2.Enabled = true; lab_Passage_1.Enabled = true; lab_Passage_2.Enabled = true; pbx_Passage_1.Image = Properties.Resources.Passage_Mouse_Leave; pbx_Passage_2.Image = Properties.Resources.Passage_Mouse_Leave; }
private void RestartTimer_2Answer() { Timer_2Answer.Stop(); countDownTimer2 = time2Answer; }