private void PlayBtn_Click(object sender, EventArgs e) { MainMenuPanel.Visible = false; resetGame(); PrimaryTimer.Start(); FiredPnl.Visible = false; }
private void resetGame() { totalScore = 0; totalDispatches = 0; averageDispatches = 0; gameLost = false; PrimaryTimer.Stop(); for (int x = 0; x < gameBoardHeight; x++) { for (int y = 0; y < gameBoardWidth; y++) { btn[x, y].BackgroundImage = BoxGame.Properties.Resources.emptyslot; btn[x, y].Tag = "empty"; } } // When the form has loaded we mark out the parts of the grid for the belt for (int x = 0; x < gameBoardWidth; x++) { for (int y = 0; y < 2; y++) { btn[x, y].BackgroundImage = BoxGame.Properties.Resources.beltarea; } } tickCounter = 0; PrimaryTimer.Start(); }
/// <summary> /// Starts the timer /// </summary> /// <param name="target">Target time</param> /// <param name="closingForm">Form that will be closed, this should be the settings form</param> public static void StartTimer(DateTime target, ColorScheme colorScheme, bool stopAtZero, Form closingForm = null) { //Set target and color scheme PrimaryTimer.Target = target; PrimaryTimer.StartTime = DateTime.Now; PrimaryTimer.ColorScheme = colorScheme; PrimaryTimer.StopAtZero = stopAtZero; PrimaryTimer.InFreeMode = false; SecondaryTimer.Target = target; SecondaryTimer.StartTime = DateTime.Now; SecondaryTimer.ColorScheme = ColorSchemes[0]; SecondaryTimer.StopAtZero = false; SecondaryTimer.InFreeMode = true; //Close the closing form with a result of OK so that the application doesn't exit if (closingForm != null) { closingForm.DialogResult = DialogResult.OK; closingForm.Close(); } //Colorize the bar PrimaryTimer.ColorizeTimerBar(); SecondaryTimer.ColorizeTimerBar(); //Show main form new TimerFormBase().Show(); }
// Cant rename this private void button1_Click_1(object sender, EventArgs e) { Console.WriteLine("The game is " + gameLost); if (paused && gameLost == false) { paused = false; pauseButton.BackgroundImage = BoxGame.Properties.Resources.pausebutton; PrimaryTimer.Start(); } else if (!paused && gameLost == false) { paused = true; pauseButton.BackgroundImage = BoxGame.Properties.Resources.unpausebutton; PrimaryTimer.Stop(); } }
private void SpawnBox() { string spawnBoxType = (string)btn[userX, 2].Tag; Console.WriteLine("The Current Box Type Below Is - " + spawnBoxType); if (spawnBoxType == "prime" || spawnBoxType == "ups" || spawnBoxType == "fedex") { PrimaryTimer.Stop(); gameLost = true; FiredPnl.Visible = true; } // Box Type 1 - Spawn Prime Box if (nextBoxType == 1) { // Spawn a new box (Change the image of an existing button) btn[userX, 2].BackgroundImage = BoxGame.Properties.Resources.primebox; btn[userX, 2].Tag = "prime"; currentBoxType = 1; } // Box Type 2 - Spawn UPS Box if (nextBoxType == 2) { // Spawn a new box (Change the image of an existing button) btn[userX, 2].BackgroundImage = BoxGame.Properties.Resources.upsbox; btn[userX, 2].Tag = "ups"; currentBoxType = 2; } // Box Type 3 - Spawn fedEx Box if (nextBoxType == 3) { // Spawn a new box (Change the image of an existing button) btn[userX, 2].BackgroundImage = BoxGame.Properties.Resources.fedexbox; btn[userX, 2].Tag = "fedex"; currentBoxType = 3; } // Set the last xPos to be the new spawn value currentXPos = (userX); currentYPos = 2; }
private void BackBtn2_Click(object sender, EventArgs e) { MainMenuPanel.Visible = true; PrimaryTimer.Stop(); FiredPnl.Visible = false; }
private void QuitJobBtn_Click(object sender, EventArgs e) { MainMenuPanel.Visible = true; PrimaryTimer.Stop(); }