Пример #1
0
        private void NewEx()
        {
            nextBtn.Hide();
            choice1.Enabled = choice2.Enabled = true;

            choice1.Text = choix[0].ToLower();
            if (choix[1].ToLower() == "gg")
            {
                choice2.Text = "g";
            }
            else
            {
                choice2.Text = choix[1].ToLower();
            }
            Random r = new Random();

            lettre = choix[r.Next(2)];

            mot = SearchFrs.ConfusionDeSonMot(lettre);

            try
            {
                motPicBox.ImageLocation = @"../../../media/" + mot + ".png";
            }
            catch (Exception) { motPicBox.Image = null; };
            if (lettre.ToLower() == "gg")
            {
                lettre = "g";
            }
            //mot=char.ToUpperInvariant(mot[0]) + mot.Substring(1);// make first letter upper case
            //Char.ToLowerInvariant(name[0]) + name.Substring(1)
            string s = mot.Replace(lettre.ToLower(), "__");

            motLabel.Text = char.ToUpperInvariant(s[0]) + s.Substring(1);
        }
Пример #2
0
        private void newEx()
        {
            s = SearchFrs.Dictee();

            mots.AddRange(s.Split(' '));
            //try { if (motsLabels.Length != 0) try { for (int xx = 0; xx < motsLabels.Length; i++) { motsLabels[xx] = motsLabels[xx]; this.Controls.Remove(motsLabels[xx]); } } catch (Exception) { } } catch (Exception) { }

            try { foreach (Label l in motsLabels)
                  {
                      this.Controls.Remove(l);
                  }
            } catch (Exception) { }
            motsLabels = new Label[mots.Count];

            Random r = new Random();

            for (int i = 0; i < mots.Count; i++)
            {
                Label l = new Label(); l.BackColor = Color.AliceBlue; l.TextAlign = ContentAlignment.MiddleCenter; l.Font = new Font("Comic SAns MS", 10f);
                this.Controls.Add(l);
                motsLabels[i] = l;
            }
            int k = 0, x = 26;/*int j;*/

            while (k < motsLabels.Length)
            {
                motsLabels[k].Text = mots[k].TrimEnd();

                k++;
            }

            motsLabels = motsLabels.OrderBy(Y => r.Next()).ToArray();
            k          = 0;
            while (k < motsLabels.Length)
            {
                motsLabels[k].Location = new Point(x, 100); motsLabels[k].Size = new Size(100, 25);
                motsLabels[k].Tag      = motsLabels[k].Left + "," + motsLabels[k].Top;
                x += 100;
                motsLabels[k].Click += label1_Click;
                k++;
            }



            //while (k < motsLabels.Length)
            //{
            //    j = r.Next(0, mots.Count);
            //    motsLabels[k].Text = mots[j];
            //    motsLabels[k].Location = new Point(x, 100);motsLabels[k].Tag = j.ToString() + ";" + motsLabels[k].Left + "," + motsLabels[k].Top; x = x + 100; motsLabels[k].Click += label1_Click;
            //    mots.RemoveAt(j);
            //    k++;
            //}
        }
Пример #3
0
        public void newEx()
        {
            try { sSynth.Pause(); } catch (Exception) { }
            trueCount = 0;
            Label[]      lab          = { phrase1Label, phrase2Label, phrase3Label, phrase3Label };
            PictureBox[] phrasesSound = { soundPhrase1, soundPhrase2, soundPhrase3, soundPhrase4 };
            foreach (PictureBox p in phrasesSound)
            {
                p.Click -= sound_click;
                p.Hide();
            }
            PictureBox[] PauseSound = { soundPhrase1Pause, soundPhrase2Pause, soundPhrase3Pause, soundPhrase4Pause };
            foreach (PictureBox box in PauseSound)
            {
                box.Visible = false;
            }
            foreach (Label l in lab)
            {
                l.Text = "";
            }
            Panel[] panels = { choicesPanel, salle, salon, chambre, cuisine };
            foreach (Panel p in panels)
            {
                p.Tag = "";
            }
            string[] cases = SearchFrs.Lecture(userLevel);
            Random   r     = new Random();
            string   s     = cases[r.Next(cases.Length)];

            //s = "Le miroir est dans la salle de bain./miroir;salle_La table et la chaise sont dans le salon./table:chaise;salon";
            string[] phrases = s.Split('_');
            for (int j = 0; j < phrases.Length; j++)
            {
                phrasesSound[j].Show();
                phrasesSound[j].Click += sound_click;

                if (phrases[j].IndexOf('/') == -1)
                {
                    lab[j].Text = phrases[j];
                }
                else
                {
                    string[] ss = phrases[j].Split('/');

                    lab[j].Text = ss[0];
                    //MessageBox.Show(ss[1]);


                    string objets = ss[1].Split(';')[0];
                    string place  = ss[1].Split(';')[1];
                    int    i      = 0;
                    while (panels[i].Name != place)
                    {
                        i++;
                    }
                    panels[i].Tag = objets;
                }
                phrasesSound[j].Tag = lab[j].Text;
            } //return items to initial place
            PictureBox[] items = { banana, biberon, chaise, miroir, livre, ourson, parapluie, pomme, reveil, table, carotte, chat };
            foreach (PictureBox pBox in items)
            {
                pBox.Parent = choicesPanel; pBox.Location = new Point(int.Parse(pBox.Tag.ToString().Split(',')[0]), int.Parse(pBox.Tag.ToString().Split(',')[1]));
            }
        }
        private void NewEx()
        {
            nextBtn.Hide();
            btnClicked = false;
            int a = tmpsCheckedListBox1.CheckedItems.Count;

            int[] tmps = new int[a]; int j = 0;
            foreach (int indexChecked in tmpsCheckedListBox1.CheckedIndices)
            {
                tmps[j] = indexChecked;
                j++;
            }
            Random r = new Random();
            int    i = r.Next(tmps.Length);

            string[] sujet   = { "Je", "Tu", "Il/Elle/On", "Nous", "Vous", "Ils/Elles,On" };
            string[] tmpsArr = { "Present", "Passé composé", "Futur", "Imparfait" };
            int      suj     = r.Next(sujet.Length);

            try
            { comp = false;
              string trueAns = SearchFrs.Conjugaison(nextBtn.Tag.ToString(), tmps[i], suj);
              string choices = SearchFrs.VerbsChoix(nextBtn.Tag.ToString());
              choices = choices.Remove(choices.IndexOf(trueAns) - 1, trueAns.Length + 1).Trim();
              //MessageBox.Show(choices);
              string[] choiceArr = choices.Split(',');
              Button[] btn       = { choice1Btn, choice2Btn, choice3Btn, choice4Btn };
              foreach (Button b in btn)
              {
                  b.Enabled   = true;
                  b.BackColor = Color.LightGray;
                  b.Click    -= b_click;
                  b.Click    -= wrong_click;
              }
              int x = r.Next(4);

              btn[x].Text = verbLabel.Text = trueAns.ToLower();
              if ((suj == 0) && ((trueAns[0] == 'é') || (trueAns[0] == 'a') || (trueAns[0] == 'i')))
              {
                  sujet[suj] = "J'";
              }
              else if (suj == 0)
              {
                  sujet[suj] = "Je";
              }
              sujLabel.Text = sujet[suj];
              tmpLabel.Text = tmpsArr[tmps[i]];
              btn[x].Click += b_click;
              trueBtn       = btn[x];

              int      k;
              string[] randChoix = new string[3];
              do
              {
                  for (j = 0; j < 3; j++)
                  {
                      k            = r.Next(choiceArr.Length);
                      randChoix[j] = choiceArr[k];
                  }
              } while (randChoix[0] == randChoix[1] || randChoix[1] == randChoix[2] || randChoix[0] == randChoix[2]);
              j = 0; k = 0;
              while (j < 4)
              {
                  if (j == x)
                  {
                      j++;
                  }
                  else
                  {
                      btn[j].Text   = randChoix[k].ToLower();
                      btn[j].Click += wrong_click;
                      j++; k++;
                  }
              }
            }
            catch (Exception EX) { MessageBox.Show(EX.ToString()); };
        }
        public void NewCompEx()
        {
            comp            = true;
            nextBtn.Visible = false;
            timer1.Start();
            btnClicked = false;
            Random r = new Random();
            int    tmps = r.Next(4), v = r.Next(5);

            string[] sujet    = { "Je", "Tu", "Il/Elle/On", "Nous", "Vous", "Ils/Elles,On" };
            string[] tmpsArr  = { "Present", "Passé composé", "Futur", "Imparfait" };
            string[] VerbsArr = { "avoir", "etre", "faire", "venir", "aller" };
            int      suj      = r.Next(sujet.Length);

            try
            {
                string trueAns = SearchFrs.Conjugaison(VerbsArr[v], tmps, suj);
                string choices = SearchFrs.VerbsChoix(VerbsArr[v]);
                choices = choices.Remove(choices.IndexOf(trueAns), trueAns.Length + 1).Trim();
                //MessageBox.Show(choices);
                string[] choiceArr = choices.Split(',');
                Button[] btn       = { choice1Btn, choice2Btn, choice3Btn, choice4Btn };
                foreach (Button b in btn)
                {
                    b.Enabled   = true;
                    b.BackColor = Color.LightGray;
                    b.Click    -= b_click;
                    b.Click    -= wrong_click;
                }
                int x = r.Next(4);

                btn[x].Text = verbLabel.Text = trueAns.ToLower();
                if ((suj == 0) && ((trueAns[0] == 'é') || (trueAns[0] == 'a') || (trueAns[0] == 'i')))
                {
                    sujet[suj] = "J'";
                }
                else if (suj == 0)
                {
                    sujet[suj] = "Je";
                }
                sujLabel.Text = sujet[suj];
                tmpLabel.Text = tmpsArr[tmps];
                btn[x].Click += b_click;
                trueBtn       = btn[x];

                int      k, j;
                string[] randChoix = new string[3];
                do
                {
                    for (j = 0; j < 3; j++)
                    {
                        k            = r.Next(choiceArr.Length);
                        randChoix[j] = choiceArr[k];
                    }
                } while (randChoix[0] == randChoix[1] || randChoix[1] == randChoix[2] || randChoix[0] == randChoix[2]);
                j = 0; k = 0;
                while (j < 4)
                {
                    if (j == x)
                    {
                        j++;
                    }
                    else
                    {
                        btn[j].Text   = randChoix[k].ToLower();
                        btn[j].Click += wrong_click;
                        j++; k++;
                    }
                }
            }
            catch (Exception) { };
        }
Пример #6
0
        private void newEx()

        {
            trueShoot         = wrongShoot = 0;
            timer1.Enabled    = true;
            gameTimer.Enabled = true;
            timer1.Start();
            lettre      = lettres[r.Next(0, 7)].ToLower();
            childThread = new Thread(new ThreadStart(() =>
            {
                sSynth = new SpeechSynthesizer();
                PromptBuilder pBuilder             = new PromptBuilder();
                SpeechRecognitionEngine sRecognize = new SpeechRecognitionEngine(new CultureInfo("fr-FR"));
                //int i = 0;
                //  PictureBox[] soundPhrases = { soundPhrase1, soundPhrase2, soundPhrase3, soundPhrase4 };
                //  while (soundPhrases[i].Name != pBoxName) { i++; }
                //pbox = soundPhrases[i];
                pBuilder.ClearContent();
                string s = "tirer tous les mots contenants la lettre" + lettre;
                pBuilder.AppendText(s);
                sSynth.Speak(pBuilder);
                sSynth.Dispose();
            }));

            childThread.Start();



            //try { sSynth.Pause(); }catch (Exception) { };


            lettreLabel.Text = "tirer tous les mots contenants la lettre " + lettre;
            string allWords = SearchFrs.allWords();

            string[] t = allWords.Split(',');

            Label[] labels = { label1, label2, label3, label4, label5, label6 };

            int i = 0; j = r.Next(1, 5);

            List <string> mots = new List <string>();
            int           lettreMotCount = 0, nonLettreCount = 0, k = 0;


            while ((i < allWords.Length) && (k < 6))
            {
                if ((t[i].IndexOf(lettre) == -1) && (nonLettreCount < 6 - j))
                {
                    mots.Add(t[i]); k++; nonLettreCount++;
                }
                else
                {
                    if ((t[i].IndexOf(lettre) != -1) && (lettreMotCount < j))
                    {
                        mots.Add(t[i]); k++; lettreMotCount++;
                    }
                }
                i++;
            }


            k = 0; int x = 26;
            while (k < 6)
            {
                i = r.Next(0, mots.Count); labels[k].Show();
                labels[k].Text     = mots[i]; labels[k].Tag = "invaders";
                labels[k].Location = new Point(x, 55); x = x + 120;
                mots.RemoveAt(i);
                k++;
            }
        }