Пример #1
0
        private void buttonPlay_Click(object sender, EventArgs e)
        {
            //run the improbability drive
            imProbabilityDrive drive = new imProbabilityDrive();
            Random             rand  = new Random();
            TimeSpan           span;

            if (gameRunning == null)
            {
                span = DateTime.Now - settings.lastTry;
                if (settings.waitToPlay <= span)
                {
                    if (drive.ShowDialog() == DialogResult.OK)
                    {
                        if (drive.numericUpDownPicker.Value == rand.Next(settings.probability + 1))
                        {
                            settings.lastTry = DateTime.Now;
                            settings         = SettingsSystem.GetSettings();
                            Game game = (Game)listBoxGames.SelectedItem;
                            if (game == null)
                            {
                                return;
                            }
                            listBoxGames.Enabled  = false;
                            gameRunning           = game.CheckOut();
                            timerCheckOut.Enabled = true;
                        }
                        else
                        {
                            span = settings.incorrectWait;
                            MessageBox.Show("You have guessed incorrectly, you must wait " + span.Hours + ":" + span.Minutes + ":" + span.Seconds + " before trying again", "oops");
                        }
                    }
                }
                else
                {
                    span = settings.waitToPlay - (DateTime.Now - settings.lastTry);
                    MessageBox.Show("Sorry, but you must wait at least " + span.Hours + ":" + span.Minutes + ":" + span.Seconds + " to try playing again", "Oops");
                }
            }
        }
Пример #2
0
        private void buttonOptions_Click(object sender, EventArgs e)
        {
            OptionsForm        options = new OptionsForm();
            imProbabilityDrive drive   = new imProbabilityDrive();
            Random             rand    = new Random();
            TimeSpan           span    = DateTime.Now - settings.lastTry;

            if (drive.ShowDialog() == DialogResult.OK)
            {
                if (drive.numericUpDownPicker.Value == rand.Next(settings.probability + 1))
                {
                    options.ShowDialog();
                    settings = SettingsSystem.GetSettings(true);
                }
                else
                {
                    span = settings.incorrectWait;
                    MessageBox.Show("You have guessed incorrectly, you must wait " + span.Hours + ":" + span.Minutes + ":" + span.Seconds + " before trying again", "oops");
                }
            }
        }
Пример #3
0
 private void buttonOptions_Click(object sender, EventArgs e)
 {
     OptionsForm options = new OptionsForm();
     imProbabilityDrive drive = new imProbabilityDrive();
     Random rand = new Random();
     TimeSpan span = DateTime.Now - settings.lastTry;
     if (drive.ShowDialog() == DialogResult.OK)
     {
         if (drive.numericUpDownPicker.Value == rand.Next(settings.probability + 1))
         {
             options.ShowDialog();
             settings = SettingsSystem.GetSettings(true);
         }
         else
         {
             span = settings.incorrectWait;
             MessageBox.Show("You have guessed incorrectly, you must wait " + span.Hours + ":" + span.Minutes + ":" + span.Seconds + " before trying again", "oops");
         }
     }
 }
Пример #4
0
 private void buttonPlay_Click(object sender, EventArgs e)
 {
     //run the improbability drive
     imProbabilityDrive drive = new imProbabilityDrive();
     Random rand = new Random();
     TimeSpan span;
     if (gameRunning == null)
     {
         span = DateTime.Now - settings.lastTry;
         if (settings.waitToPlay <= span)
         {
             if (drive.ShowDialog() == DialogResult.OK)
             {
                 if (drive.numericUpDownPicker.Value == rand.Next(settings.probability + 1))
                 {
                     settings.lastTry = DateTime.Now;
                     settings = SettingsSystem.GetSettings();
                     Game game = (Game)listBoxGames.SelectedItem;
                     if (game == null)
                     {
                         return;
                     }
                     listBoxGames.Enabled = false;
                     gameRunning = game.CheckOut();
                     timerCheckOut.Enabled = true;
                 }
                 else
                 {
                     span = settings.incorrectWait;
                     MessageBox.Show("You have guessed incorrectly, you must wait " + span.Hours + ":" + span.Minutes + ":" + span.Seconds + " before trying again", "oops");
                 }
             }
         }
         else
         {
             span = settings.waitToPlay - (DateTime.Now - settings.lastTry);
             MessageBox.Show("Sorry, but you must wait at least " + span.Hours + ":" + span.Minutes + ":" + span.Seconds + " to try playing again", "Oops");
         }
     }
 }