/// <summary> /// Play button press which hides the button and shows labels and keyboard buttons. Initializes the first word. Sets the game started flag to true. /// </summary> private void PlayButton_Click(object sender, EventArgs e) { Sonido.Click(); // Hide Play button PlayButton.Visible = false; PlayButton.Enabled = false; // Show keyboard foreach (Button b in GameButtons) { b.Visible = true; b.Enabled = true; } // Show Game labels foreach (Label l in GameLabels) { l.Visible = true; l.Enabled = true; } InitializeWord(); Data.GameStarted = true; }
private void InitLoadCheck() { CheckLoadedFinished.Interval = 2000; CheckLoadedFinished.Enabled = true; CheckLoadedFinished.Tick += new EventHandler(LoadCheckTick); CheckLoadedFinished.Start(); Sonido.Init(); Data.Init(); Data.InitializationFinished = true; }
static void Main() { // App code Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new SplashScreen()); // Initialization Application.Run(new GameForm()); // Main Game // Dispose unusued resources Sonido.Dispose(); Data.Dispose(); }
private void checkBox_antialiasing_CheckedChanged(object sender, EventArgs e) { Sonido.Click(); if (checkBox_antialiasing.Checked == true) { Data.AntialiasEnabled = true; } else if (checkBox_antialiasing.Checked == false) { Data.AntialiasEnabled = false; } }
private void checkBox_darkmode_CheckedChanged(object sender, EventArgs e) { Sonido.Click(); if (checkBox_darkmode.Checked is true) { Data.DarkMode = true; } else if (checkBox_darkmode.Checked is false) { Data.DarkMode = false; } Data.RecentlyChangedTheme = true; Data.UpdateDarkMode(); }
private void button_ResetScore_Click(object sender, EventArgs e) { Sonido.Click(); DialogResult dialogResult = MessageBox.Show ("Esta accion reiniciara tu puntaje permanente a 0. ¿Estas seguro que quieres continuar?", "Confirmar reinicio de puntaje", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); Sonido.Click(); if (dialogResult == DialogResult.Yes) { Data.Puntaje = 0; MessageBox.Show ("El puntaje ha sido reiniciado a 0", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); Sonido.Click(); } }
/// <summary> /// Updates the global variables that keep track of the letters guessed and the scoring. /// </summary> /// <param name="c">Input to process</param> private void UpdateWord(char c) { Data.UpdateWord(c); UpdateControlColors(); int blacks = 0; int whites = 0; foreach (Button b in GameButtons) { if (b.BackColor == Color.Black) { blacks++; } else if (b.BackColor == Color.White) { whites++; } } if (this.BackColor == Color.Black && whites > blacks) { // force update UpdateScreen(Data.GlobalPenColor); Data.RecentlyChangedTheme = true; foreach (Button b in GameButtons) { b.BackColor = Data.GlobalBackColor; b.ForeColor = Data.GlobalForeColor; } } else if (this.BackColor == Color.White && blacks > whites) { // force update UpdateScreen(Data.GlobalPenColor); Data.RecentlyChangedTheme = true; foreach (Button b in GameButtons) { b.BackColor = Data.GlobalBackColor; b.ForeColor = Data.GlobalForeColor; } } label_puntaje.Text = "Puntaje: " + Data.Puntaje; // Change the word and reset attempt tracking if (Data.WordGuess == Data.GameWord) { // Win condition. Sonido.Win(); Data.attempts = 7; InitializeWord(); foreach (Button b in GameButtons) { b.BackColor = Data.GlobalBackColor; } } else if (Data.attempts == 0) { // Lose condition. Sonido.Lose(); Data.attempts = 7; InitializeWord(false); foreach (Button b in GameButtons) { b.BackColor = Data.GlobalBackColor; } } else { if (Data.AnyMatchFound == false & Data.isReapeatedInWrongGuess == false) { Sonido.Wrong(); this.Controls.Find("button_" + c, false)[0].BackColor = Color.Red; } else if (Data.AnyMatchFound == true & Data.RepeatedMatch == false) { Sonido.Correct(); this.Controls.Find("button_" + c, false)[0].BackColor = Color.Green; } if (Data.PenColorValue is true) { UpdateScreen(GreenPen); } else { UpdateScreen(RedPen); } } }
private void button_Notas_Click(object sender, EventArgs e) { Sonido.Click(); System.Diagnostics.Process.Start("https://github.com/ezrillex/Ahorcado/blob/master/CHANGELOG.md"); }
private void button1_Click(object sender, EventArgs e) { Sonido.Click(); this.Close(); }