Пример #1
0
 private bool checkForWin(Phrases word)
 {
     for (int i = 0; i < word.phrase.Length; i++)
     {
         if (!indexesfound[i])
         {
             return(false);
         }
     }
     return(true);
 }
Пример #2
0
 private bool lblCheck(List <Label> lblList, char ch, Phrases word)
 {
     if (word.phrase.Contains(ch))
     {
         for (int i = 0; i < word.phrase.Length; i++)
         {
             if (ch == word.phrase[i] && !indexesfound[i])
             {
                 lblList[i].Text = ch.ToString();
                 indexesfound[i] = true;
                 frm_StartGame.PlayerList[frm_StartGame.PlayerIndex].currentScore += 10;
             }
             else if (ch == word.phrase[i] && indexesfound[i])
             {
                 return(false);
             }
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }
Пример #3
0
        private void lblCreate(Phrases word)
        {
            for (int i = 0; i < 50; i++)
            {
                indexesfound[i] = false;
            }
            Label lblCategory = new Label();

            lblCategory.AutoSize = true;
            //lblCategory.Size = new System.Drawing.Size(20, 20);
            lblCategory.Location  = new Point(20, 10);
            lblCategory.TabIndex  = 0;
            lblCategory.Name      = "lblCategory";
            lblCategory.TextAlign = ContentAlignment.MiddleCenter;
            lblCategory.Font      = new Font("Arial", 12, FontStyle.Bold);
            lblCategory.Text      = "Category: " + word.category;
            pnlWord.Controls.Add(lblCategory);
            Label lblHint = new Label();

            lblHint.AutoSize  = false;
            lblHint.Size      = new System.Drawing.Size(500, 20);
            lblHint.TextAlign = ContentAlignment.MiddleRight;
            lblHint.TabIndex  = 0;
            lblHint.Name      = "lblHint";
            lblHint.TextAlign = ContentAlignment.MiddleCenter;
            lblHint.Font      = new Font("Arial", 12, FontStyle.Bold);
            lblHint.Text      = "Hint: " + word.hint;
            lblHint.Location  = new Point(pnlWord.ClientRectangle.Width - lblHint.Width, 10);
            lblHint.Visible   = false;
            pnlWord.Controls.Add(lblHint);

            int lblLocationX = 20;
            int lblLocationY = 55;

            for (int i = 0; i < word.phrase.Length; i++)
            {
                Label lbl = new Label();
                lbl.AutoSize  = true;
                lbl.Size      = new System.Drawing.Size(13, 13);
                lbl.Location  = new Point(lblLocationX, lblLocationY);
                lbl.TabIndex  = 0;
                lbl.Name      = i.ToString();
                lbl.TextAlign = ContentAlignment.MiddleCenter;
                lbl.Font      = new Font("Arial", 20, FontStyle.Bold);
                if (word.phrase[i] == ' ')
                {
                    lbl.Text        = " ";
                    indexesfound[i] = true;
                }
                else if (word.phrase[i] == '-')
                {
                    lbl.Text        = "-";
                    indexesfound[i] = true;
                }
                else if (Char.IsUpper(word.phrase[i]))
                {
                    lbl.Text        = word.phrase[i].ToString();
                    indexesfound[i] = true;
                }
                else if (Char.IsLower(word.phrase[i]))
                {
                    lbl.Text = "_";
                }
                lblLocationX += 30;
                pnlWord.Controls.Add(lbl);
                labelList.Add(lbl);
            }
        }