private void button3_Click(object sender, EventArgs e)
        {
            this.Hide();
            ActOne a1 = new ActOne(MyVal);

            a1.ShowDialog();
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            MySqlConnection sqlcon = new MySqlConnection(@"server=localhost;user id=root;database=seproject;password=rootpassword");
            MySqlCommand    cmd    = null;
            MySqlDataReader reader = null;

            try
            {
                string sql = "SELECT inGameCurrency FROM seproject.user WHERE username = '******';";

                //sqlcon = new MySqlConnection(Properties.Settings.Default.ConnectionString);
                cmd = new MySqlCommand(sql, sqlcon);

                sqlcon.Open();

                reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    val = reader.GetInt32("inGameCurrency");
                    //lblContinent.Text = reader.GetInt32("continent");
                    //lblRegion.Text = reader.GetString("region");
                    //lblSurfaceArea.Text = string.Format("{0:0.00}", reader.GetFloat("surfacearea"));
                }
                Console.WriteLine(val);
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("An error occurred {0}", ex.Message), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                if (sqlcon != null)
                {
                    sqlcon.Close();
                }
            }
            if (x <= 10)
            {
                button1.Enabled = false;
                button1.Text    = "Next song";
                x++;
                unlockButtons();
                startRoundTimer();
                displayTimer();
                soundPlayer(x);
                scoreLabel.Text = score.ToString();
            }
            switch (x)
            {
            case 1:
                button2.Text = "Queen - Don't Stop Me Now";
                button3.Text = "The Rolling Stones - Gimme Shelter";
                button4.Text = "The Beatles - Strawberry Fields";
                button5.Text = "Guns 'n Roses - Civil War";
                break;

            case 2:
                button2.Text = "Subcarpati - Folclor Nemuritor";
                button3.Text = "Holograf - Primara Incepe Cu Tine";
                button4.Text = "Tudor Gheorghe - Au Innebunit Salcamii";
                button5.Text = "Spike - Salcamii";
                break;

            case 3:
                button2.Text = "Led Zeppelin - Whole Lotta Love";
                button3.Text = "Jimi Hendrix - Hey Joe";
                button4.Text = "Eric Clapton - Cocaine";
                button5.Text = "Carlos Santana - Black Magic Woman";
                break;

            case 4:
                button2.Text = "Arctic Monkeys - Flourescent Adolescent";
                button3.Text = "Nothing But Thieves - Amsterdam";
                button4.Text = "Cage The Elephant - Ain't No Rest For The Wicked";
                button5.Text = "Red Hot Chili Peppers - Dani California";
                break;

            case 5:
                button2.Text = "Sia - Unstoppable";
                button3.Text = "Billie Eilish ft. Khalid - Lovely";
                button4.Text = "Nelly Furtado - Say It Right";
                button5.Text = "Rihanna - Love On The Brain";
                break;

            case 6:
                button2.Text = "Lana Del Rey - Young And Beautiful";
                button3.Text = "Miley Cyrus - We Can't Stop";
                button4.Text = "Katy Perry - Firework";
                button5.Text = "Taylor Swift - Blank Space";
                break;

            case 7:
                button2.Text = "Panic! At The Disco - Emperor's New Clothes";
                button3.Text = "The Black Eyed Peas - Boom Boom Pow";
                button4.Text = "Bring Me The Horizon - Teardrops";
                button5.Text = "Mark Ranson ft. Bruno Mars - Uptown Funk";
                break;

            case 8:
                button2.Text = "The Prodigy - Omen";
                button3.Text = "Noisia - Alpha Centauri";
                button4.Text = "Modestep - Another Day ft. Popeska";
                button5.Text = "Sub Focus - Rock It";
                break;

            case 9:
                button2.Text = "Alice In Chains - Rooster";
                button3.Text = "Nirvana - In Bloom";
                button4.Text = "Soundgarden - Black Hole Sun";
                button5.Text = "Pearl Jam - Garden";
                break;

            case 10:
                button2.Text = "Suie Paparude - A Fost Odata";
                button3.Text = "Dragonu' x Kaxi Ploae x Bean - Miles";
                button4.Text = "Subcarpati cu Motanu' si Calin Han - Da-i Foale";
                button5.Text = "Faust cu Motanu' - Acelasi Feeling";
                break;

            default:
                MessageBox.Show("All done! Your score is " + score.ToString());
                sum = val + score;
                try
                {
                    sqlcon.Open();

                    string          Query     = "update seproject.user set inGameCurrency = " + "'" + sum + "' where (username = '******');";
                    MySqlCommand    cmdInsert = new MySqlCommand(Query, sqlcon);
                    MySqlDataReader reader1   = cmdInsert.ExecuteReader();
                    MessageBox.Show("Saved");
                    while (reader1.Read())
                    {
                    }
                    sqlcon.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Insertion failed");
                }
                this.Hide();
                ActOne a1 = new ActOne(MyVal);
                a1.ShowDialog();
                break;
            }
        }
Пример #3
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            MySqlConnection sqlcon = new MySqlConnection(@"server=localhost;user id=root;database=seproject;password=rootpassword");
            MySqlCommand    cmd    = null;
            MySqlDataReader reader = null;

            try
            {
                string sql = "SELECT inGameCurrency FROM seproject.user WHERE username = '******';";

                //sqlcon = new MySqlConnection(Properties.Settings.Default.ConnectionString);
                cmd = new MySqlCommand(sql, sqlcon);

                sqlcon.Open();

                reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    val = reader.GetInt32("inGameCurrency");
                    //lblContinent.Text = reader.GetInt32("continent");
                    //lblRegion.Text = reader.GetString("region");
                    //lblSurfaceArea.Text = string.Format("{0:0.00}", reader.GetFloat("surfacearea"));
                }
                Console.WriteLine(val);
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("An error occurred {0}", ex.Message), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                if (sqlcon != null)
                {
                    sqlcon.Close();
                }
            }
            if (x <= 10)
            {
                button1.Enabled = false;
                button1.Text    = "Next question";
                x++;
                unlockButtons();
                startRoundTimer();
                displayTimer();
                scoreLabel.Text = score.ToString();
            }
            switch (x)
            {
            case 1:
                label2.Text  = "In 'The Matrix', what's the color of the pull that Neo takes?";
                button2.Text = "Red";
                button3.Text = "Greeb";
                button4.Text = "Blue";
                button5.Text = "Cyan";
                break;

            case 2:
                label2.Text  = "The head of what kind of animal is front-and-center in an infamous scene from The Godfather?";
                button2.Text = "A buck";
                button3.Text = "An ostrich";
                button4.Text = "A horse";
                button5.Text = "A wolf";
                break;

            case 3:
                label2.Text  = "Who is the only actor to receive an Oscar nomination for acting in a Lord of the Rings movie?";
                button2.Text = "Orlando Bloom";
                button3.Text = "Ian McKellen";
                button4.Text = "Vigo Mortensen";
                button5.Text = "Elijah Wood";
                break;

            case 4:
                label2.Text  = "Which Alfred Hitchcock movie is notorious for its shocking “shower scene”?";
                button2.Text = "Strangers on a train";
                button3.Text = "The Birds";
                button4.Text = "Vertigo";
                button5.Text = "Psycho";
                break;

            case 5:
                label2.Text  = "What was Quentin Tarantino‘s first feature as writer/director?";
                button2.Text = "Reservoir Dogs";
                button3.Text = "Pulp Fiction";
                button4.Text = "Planet Terror";
                button5.Text = "Jackie Brown";
                break;

            case 6:
                label2.Text  = "Which Friends star appeared in the movie Scream?";
                button2.Text = "Phobe";
                button3.Text = "Chandler";
                button4.Text = "Monica";
                button5.Text = "Joey";
                break;

            case 7:
                label2.Text  = "Who is Harry Potter’s godfather?";
                button2.Text = "Remus Lupin";
                button3.Text = "Sirius Black";
                button4.Text = "Severus Snape";
                button5.Text = "Alastor Moody";
                break;

            case 8:
                label2.Text  = "What is the name of Andy’s neighbor in Toy Story?";
                button2.Text = "Sid";
                button3.Text = "Diego";
                button4.Text = "Zeke";
                button5.Text = "Manfred";
                break;

            case 9:
                label2.Text  = "Approximately how many languages can C-3PO speak in Star Wars?";
                button2.Text = "600 thousand";
                button3.Text = "100";
                button4.Text = "3 thousand";
                button5.Text = "6 million";
                break;

            case 10:
                label2.Text  = "What is the symbolism of the crow crowing three times in the Godfather movies?";
                button2.Text = "Famine";
                button3.Text = "Pestilence";
                button4.Text = "Death";
                button5.Text = "War";
                break;

            default:
                MessageBox.Show("All done! Your score is " + score.ToString());
                sum = val + score;
                try
                {
                    sqlcon.Open();

                    string          Query     = "update seproject.user set inGameCurrency = " + "'" + sum + "' where (username = '******');";
                    MySqlCommand    cmdInsert = new MySqlCommand(Query, sqlcon);
                    MySqlDataReader reader1   = cmdInsert.ExecuteReader();
                    MessageBox.Show("Saved");
                    while (reader1.Read())
                    {
                    }
                    sqlcon.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Insertion failed");
                }
                this.Hide();
                ActOne a1 = new ActOne(MyVal);
                a1.ShowDialog();
                break;
            }
        }