Esempio n. 1
0
        private void Ajout_Clk(object sender, EventArgs e)
        {
            //if(txtAjout.Text == "")
            //{
            //    string s = (string)lbPoubelle.SelectedItem;
            //    lbPioche.Items.Add(s);
            //    lbPoubelle.Items.Remove(s);
            //}
            if (txtAjout.Text != "")
            {
                if (PiocheClass.IsMotValid(txtAjout.Text))
                {
                    string motConverti = PiocheClass.Normaliser(txtAjout.Text).ToUpper();
                    if (!estPresent(motConverti))
                    {
                        lbPioche.Items.Add(motConverti);
                    }

                    txtAjout.Clear();
                    txtAjout.Focus();
                }

                else
                {
                    error.SetError(txtAjout, "Le mot que vous avez entré n'est pas valide.");
                    // txtAjout.Clear();
                    txtAjout.Focus();
                }
            }

            //Méthode save dans dico à appeler
            //Fichiertxt.Add
        }
Esempio n. 2
0
 private void btnAlimenterPioche_Click(object sender, EventArgs e)
 {
     foreach (var item in lbPioche.Items)
     {
         PiocheClass.AjouterMot(item.ToString());
     }
     PiocheClass.SavePioche(QuintoWindows.Properties.Settings.Default.pathPioche);
 }
Esempio n. 3
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            PiocheClass.LoadPioche(Properties.Settings.Default.pathPioche);


            Application.Run(new FrmQuinto());
        }
Esempio n. 4
0
        void GestionnaireMarche(EtatManche etatManche)
        {
            switch (etatManche)
            {
            case EtatManche.Debut:
                foreach (Control button in panel1.Controls)
                {
                    button.Enabled = true;
                }
                manche = partie.Manches[partie.NumeroMancheEnCours];
                manche.MotADecouvrir = PiocheClass.ExtraireMot();
                panel1.Enabled       = true;
                partie.NumeroMancheEnCours++;
                manche.NbrErreur = 0;
                manche.InitialiseMotEnCours();
                txtAfficheMot.Text  = manche.ChartoString(manche.MotEncours);
                lblNbrEssai.Text    = "Nombre d'essais restant : " + (9 - manche.NbrErreur);
                txtNbrManches.Text  = "Manche :" + (partie.NumeroMancheEnCours + "/" + partie.NombreManches);
                manche.PartieLancer = true;
                manche.AfficheChrono();
                //manche.Chrono();
                break;

            case EtatManche.Gagne:
                panel1.Enabled = false;
                if (manche.MancheGagne())
                {
                    if (partie.NumeroMancheEnCours < partie.NombreManches)
                    {
                        MessageBox.Show("Félicitation vous avez trouvé le mot ! \r\n Votre score est " + manche.CalculScoreManche() + "! \r\n Passez à la manche suivante.", "Manche gagné", MessageBoxButtons.OK);
                        txtAfficheMot.Text = string.Empty;
                        GestionnaireMarche(EtatManche.Debut);
                        manche.PartieLancer = false;
                    }
                }
                break;

            case EtatManche.Perdu:
                panel1.Enabled = false;
                if (manche.ManchePerdue())
                {
                    MessageBox.Show("Vous avez perdu :( !", "Partie perdue", MessageBoxButtons.OK);
                }
                break;

            default:
                break;
            }
        }
Esempio n. 5
0
        private void AjoutPhrase(string ligne)
        {
            string tampon = string.Empty;

            for (int i = 0; i < ligne.Length; i++)
            {
                if (!char.IsLetter(ligne[i]))
                {
                    if (tampon != "")
                    {
                        if (PiocheClass.IsMotValid(tampon))
                        {
                            string motConverti = PiocheClass.Normaliser(tampon).ToUpper();
                            if (!estPresent(motConverti))
                            {
                                lbPioche.Items.Add(motConverti);
                            }
                        }

                        tampon = string.Empty;
                    }
                }
                else
                {
                    tampon += (ligne[i]);
                }
            }

            if (tampon != "")
            {
                if (PiocheClass.IsMotValid(tampon))
                {
                    string motConverti = PiocheClass.Normaliser(tampon).ToUpper();
                    if (!estPresent(motConverti))
                    {
                        lbPioche.Items.Add(motConverti);
                    }
                }

                tampon = string.Empty;
            }
        }