Beispiel #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            string t;
            int    cpt = 0;

            this.labEncouragement.Text  = string.Empty;
            this.labEncouragement2.Text = string.Empty;

            for (int j = 0; j < 4; j++)
            {
                // Création des LABEL  de la grille
                for (int i = 0; i < 4; i++)
                {
                    cpt++;
                    int     pas = 60;
                    LAbelXY l   = new LAbelXY();
                    {
                        l.Font   = new System.Drawing.Font("Microsoft Sans Serif", 14F, FontStyle.Bold, GraphicsUnit.Point, (byte)0);
                        l.Parent = this;
                    }

                    l.Click    += new EventHandler(this.LetterIsChoosen);
                    t           = cpt.ToString();
                    l.Text      = t;
                    l.Name      = t;
                    l.Width     = pas - 20;
                    l.Height    = pas - 20;
                    l.Top       = 20 + (j * pas);
                    l.Left      = 20 + (i * pas);
                    l.ForeColor = this.defaultColor;
                    l.X         = i;
                    l.Y         = j;
                    l.Show();
                }
            }

            DataGame.ResetWordScore();
            DataGame.RazScoreTotal();

            // Pour la contruction d'un arbre des lettres à partir de la liste des mots français
            LoadWordsDictionnary.InitialiseEnvironnement();
            if (LoadWordsDictionnary.GetAuthorizationStatus())
            {
                DonneesLettres.MatrixIniialization();
                this.NewGame();
            }
            else
            {
                _ = MessageBox.Show(
                    "Erreur à l'ouverture du dictionnaire des mots Français\r\n" +
                    " Verifiez si le fichier MOTS TRADUITS.txt est présent sous le même répertoire que celui\r\n" +
                    " de l'application.", "Erreur fatale.", buttons: MessageBoxButtons.OK, MessageBoxIcon.Stop);
                Application.Exit();
            }

            this.PossibleWordsInTextbox2();
        }
Beispiel #2
0
 private void Button1_Click(object sender, EventArgs e)
 {
     // Réalise un nouveau tirage de lettres et configure l'IHM
     this.textBox2.Clear();
     this.textBox1.Clear();
     DataGame.ResetWordScore();
     DataGame.ResetNumberOfGoodWord();
     this.NewGame();
     this.DrawMatrix();
 }
Beispiel #3
0
 private void BoutonVerifMot(object sender, EventArgs e)
 {
     this.VerifMot();
     this.labNmotsTrouves.Text = "Nombre de mots trouvés = " + DataGame.GetNumberOfGoodWord().ToString()
                                 + " sur " + this.possibleWords.Count;
     this.textBox1.Clear();
     DataGame.ResetWordScore();
     this.labScoreMotJoueur.Text = string.Empty;
     this.DrawMatrix();
 }
Beispiel #4
0
        /// <summary>
        /// Réalise un nouveau tirage de lettres.
        /// </summary>
        private void NewGame()
        {
            this.findedWordList.Clear();
            this.textBox2.Clear();
            DataGame.ResetWordScore();
            DataGame.RazScoreTotal();
            this.labScoreMotJoueur.Text = "Score du mot";
            this.labScoreTotal.Text     = "Score de la partie.";
            this.CreateMatrix();
            this.DrawMatrix();
            WordsInGrid solver = new WordsInGrid();

            this.possibleWords      = solver.ExploreCellWay();
            this.lab_scoreMaxi.Text = "SCORE MAXIMAL : " + this.ScoreMaxi();
            this.possibleWords.Sort();
            this.PossibleWordsInTextbox2();
        }