示例#1
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
        }
示例#2
0
        //public static void ChargerMots()
        //{
        //    Random rand = new Random();
        //    if (joueur.Niveaudifficulte == "Facile")
        //    {

        //        int index = rand.Next(motsFacile.Count);
        //        Mot mot = motsFacile.ElementAt(index);
        //       // tbEssai.Text = mot.MotInitial;
        //    }
        //    else if (joueur.Niveaudifficulte == "Difficile")
        //    {

        //        int index = rand.Next(motsDifficile.Count);
        //        Mot mot = motsDifficile.ElementAt(index);
        //      //  tbEssai.Text = mot.MotInitial;
        //    }
        //    else if (joueur.Niveaudifficulte == "Expert")
        //    {
        //        int index = rand.Next(motsExpert.Count);
        //        Mot mot = motsExpert.ElementAt(index);
        //      //  tbEssai.Text = mot.MotInitial;
        //    }


        //}
        public void DeserializeAll()
        {
            motsFacile    = (Mots)Serialisation.LoadJson(@"C:\Windows\Temp\MotsFacileJson.json", typeof(Mots));
            motsDifficile = (Mots)Serialisation.LoadJson(@"C:\Windows\Temp\MotsDifficileJson.json", typeof(Mots));
            motsExpert    = (Mots)Serialisation.LoadJson(@"C:\Windows\Temp\MotsExpertJson.json", typeof(Mots));
        }