示例#1
0
        private void btnValider_Click(object sender, EventArgs e)
        {
            Mot mot = new Mot();

            if (Mot.IsMotValideFacile(tbMot.Text))
            {
                mot.MotInitial = tbMot.Text;
                motsFacile.Add(mot);
                tbMot.Clear();
            }

            else if (Mot.IsMotValideDifficile(tbMot.Text))
            {
                mot.MotInitial = tbMot.Text;
                motsDifficile.Add(mot);
                tbMot.Clear();
            }


            else if (Mot.IsMotValideExpert(tbMot.Text))
            {
                mot.MotInitial = tbMot.Text;
                motsExpert.Add(mot);
                tbMot.Clear();
            }
        }
示例#2
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            if (radioButton1.Checked)
            {
                Mots mots = (Mots)Serialisation.LoadJson(@"C:\Windows\Temp\MotsFacileJson.json", typeof(Mots));

                mot = Mots.ChargerMot(mots);
            }
            else if (radioButton2.Checked)
            {
                Mots mots = (Mots)Serialisation.LoadJson(@"C:\Windows\Temp\MotsDifficileJson.json", typeof(Mots));

                mot = Mots.ChargerMot(mots);
            }
            else if (radioButton3.Checked)
            {
                Mots mots = (Mots)Serialisation.LoadJson(@"C:\Windows\Temp\MotsExpertJson.json", typeof(Mots));


                mot = Mots.ChargerMot(mots);
            }

            if (joueur.NbManchesRemportees == 0)
            {
                CreationTimer();
            }

            timer.Start();
            textBox2.Text = joueur.NbManchesRemportees.ToString();
            GestionnaireContextes(Contextes.GameStarted);
            //DateTime TpsDebut = TempsDebut();
            btnStart.Enabled = false;

            joueur.NbEssaiRestant = 7;
            tbNbrEssais.Text      = joueur.NbEssaiRestant.ToString();


            //essai pour charger mot aleatoire à partir du hashset d'essai
            // Random aleatoire = new Random();
            // int index=aleatoire.Next(0, 5);
            // string LeMot = HashSetEssai.ElementAt(index);
            // mot.MotInitial = LeMot.ToUpper();
            tbMotADeviner.Text = mot.MettreTirets(mot.MotInitial);

            //FinEssai
        }