Пример #1
0
 private void verify_Click(object sender, EventArgs e)
 {
     string[] currentAnswers;
     if (currentCategory == 1)
     {
         currentAnswers = odgovori1[c1Index++].Split(' ');
     }
     else if (currentCategory == 2)
     {
         currentAnswers = odgovori2[c2Index++].Split(' ');
     }
     else if (currentCategory == 3)
     {
         currentAnswers = odgovori3[c3Index++].Split(' ');;
     }
     else
     {
         currentAnswers = odgovori4[c4Index++].Split(' ');;
     }
     for (int i = 0; i < currentAnswers.Length; i++)
     {
         currentAnswers[i] = WhiteSpace.FIX(currentAnswers[i]);
     }
     if (currentAnswers.Contains(answer.Text.ToLower()))
     {
         igrachiVoIgra[turn].poeniVkupno += pointsRisked;
     }
     else
     {
         igrachiVoIgra[turn].poeniVkupno -= pointsRisked;
         if (igrachiVoIgra[turn].poeniVkupno <= 0)
         {
             activePlayers--;
         }
         if (activePlayers == 1)
         {
             endGame();
         }
     }
     answer.Text        = currentAnswers[0];
     verify.Enabled     = false;
     nextPlayer.Enabled = true;
     answer.ReadOnly    = true;
     label1.Text        = "" + igrachiVoIgra[0].poeniVkupno;
     label2.Text        = "" + igrachiVoIgra[1].poeniVkupno;
     if (igrachiVoIgra.Count > 2)
     {
         label3.Text = "" + igrachiVoIgra[2].poeniVkupno;
         if (igrachiVoIgra.Count > 3)
         {
             label4.Text = "" + igrachiVoIgra[3].poeniVkupno;
         }
     }
 }
Пример #2
0
        private void verify_Click(object sender, EventArgs e)
        {
            String[] answersOfQuestion = answers[counter].Split(' ');
            for (int i = 0; i < answersOfQuestion.Length; i++)
                answersOfQuestion[i] = WhiteSpace.FIX(answersOfQuestion[i]);
            if (answersOfQuestion.Contains(answer.Text.ToLower()))
            {
                answer.ReadOnly = true;
                igrachi[playerToAnswer].poeniVkupno += 3;
                queue = new Queue<int>();
                verify.Enabled = false;
                nextQuestion.Enabled = true;
                isCorrect.Text = "Точен Одговор";
            }

            else {
                igrachi[playerToAnswer].poeniVkupno -= 3;
                isCorrect.Text = "Погрешен Одговор";
                answer.Text = "";
                if (queue.Count != 0)
                {
                    if(playerToAnswer == 0)
                        player1.BackColor = Color.Red;
                    if (playerToAnswer == 1)
                        player2.BackColor = Color.Red;
                    if (playerToAnswer == 2)
                        player3.BackColor = Color.Red;
                    if (playerToAnswer == 3)
                        player4.BackColor = Color.Red;
                    playerToAnswer = queue.Dequeue();

                    colorField();

                }
                else
                {
                    isCorrect.Text = "Точниот одговор е:";
                    answer.Text = answersOfQuestion[0];
                    verify.Enabled = false;
                    nextQuestion.Enabled = true;
                    player1.BackColor = Color.Red;
                    player2.BackColor = Color.Red;
                    player3.BackColor = Color.Red;
                    player4.BackColor = Color.Red;
                }

            }
        }
Пример #3
0
        private void TimerOnTick(object sender, EventArgs e)
        {
            if (secondsToAnswer > 0)
            {
                bool flag = true;
                foreach (Igrach i in igrachi)
                    if (!i.locked)
                    {
                        flag = false;
                        break;
                    }
                if (flag)
                    secondsToAnswer = 0;
                else
                    secondsToAnswer--;

                secondsLeft.Text = secondsToAnswer.ToString();
                progressBar1.Value = secondsToAnswer;
            }
            else
            {
                timer.Stop();
                this.KeyPreview = false;
                answer.ReadOnly = false;
                verify.Enabled = true;
                if (queue.Count != 0) {
                    playerToAnswer = queue.Dequeue();
                    colorField();
                }
                else
                {
                    verify.Enabled = false;
                    answer.ReadOnly = true;
                    isCorrect.Text = "Точниот одговор е:";
                    string[] answersOfAnswer = answers[counter].Split(' ');
                    answer.Text = WhiteSpace.FIX(answersOfAnswer[0]);
                    nextQuestion.Enabled = true;
                }
            }
        }
Пример #4
0
        private void verify_Click(object sender, EventArgs e)
        {
            string[] answers = odgovori[Qindex].Split(' ');
            for (int i = 0; i < answers.Length; i++)
            {
                answers[i] = WhiteSpace.FIX(answers[i]);
            }
            if (answers.Contains(Odgovor.Text.ToLower()))
            {
                igrachi[turn].poeniVkupno            -= 3;
                igrachi[playerAnswering].poeniVkupno += 3;
                textBox1.BackColor = Color.LightGreen;
                answerLabel.Text   = answers[0];
            }
            else
            {
                igrachi[turn].poeniVkupno            += 3;
                igrachi[playerAnswering].poeniVkupno -= 3;
                textBox2.BackColor = Color.Red;
                answerLabel.Text   = answers[0];
            }
            verify.Enabled     = false;
            NextPlayer.Enabled = true;
            bool flag = false;

            foreach (bool b in openedQuestions)
            {
                if (!b)
                {
                    flag = true;
                    break;
                }
            }
            if (!flag)
            {
                NextPlayer.Text = "Наредна Игра";
                finished        = true;
            }
        }
Пример #5
0
        public Igra2(List <Igrach> igrachi, int mainIndex, int prevFile)
        {
            InitializeComponent();
            stuck_counter  = 0;
            this.mainIndex = mainIndex;
            solved         = false;
            buttons        = new List <Button>();
            buttons.Add(A1);
            buttons.Add(A2);
            buttons.Add(A3);
            buttons.Add(A4);
            buttons.Add(B1);
            buttons.Add(B2);
            buttons.Add(B3);
            buttons.Add(B4);
            buttons.Add(C1);
            buttons.Add(C2);
            buttons.Add(C3);
            buttons.Add(C4);
            buttons.Add(D1);
            buttons.Add(D2);
            buttons.Add(D3);
            buttons.Add(D4);
            Answer1.ReadOnly    = true;
            Answer2.ReadOnly    = true;
            Answer3.ReadOnly    = true;
            Answer4.ReadOnly    = true;
            lockedbuttons       = new bool[16];
            columns             = new bool[4];
            enabledForAnswering = new HashSet <int>();
            filenames           = System.IO.Directory.GetFiles(@"Asocijacii");
            Random rand = new Random();

            if (mainIndex == 1)
            {
                file_index = rand.Next(0, filenames.Length);
            }
            else
            {
                if (prevFile == 0)
                {
                    file_index = prevFile + 1;
                }
                else
                {
                    file_index = prevFile - 1;
                }
            }
            lines          = System.IO.File.ReadAllLines(filenames[file_index]);
            A_words        = lines[0].Split(' ');
            A_solutions    = lines[1].Split(' ');
            B_words        = lines[2].Split(' ');
            B_solutions    = lines[3].Split(' ');
            C_words        = lines[4].Split(' ');
            C_solutions    = lines[5].Split(' ');
            D_words        = lines[6].Split(' ');
            D_solutions    = lines[7].Split(' ');
            full_solutions = lines[8].Split(' ');


            A_words.ListShuffle();
            B_words.ListShuffle();
            C_words.ListShuffle();
            D_words.ListShuffle();
            for (int i = 0; i < 4; i++)
            {
                A_words[i] = WhiteSpace.FIX(A_words[i]);
                B_words[i] = WhiteSpace.FIX(B_words[i]);
                C_words[i] = WhiteSpace.FIX(C_words[i]);
                D_words[i] = WhiteSpace.FIX(D_words[i]);
            }

            for (int i = 0; i < A_solutions.Length; i++)
            {
                A_solutions[i] = WhiteSpace.FIX(A_solutions[i]);
            }
            for (int i = 0; i < B_solutions.Length; i++)
            {
                B_solutions[i] = WhiteSpace.FIX(B_solutions[i]);
            }
            for (int i = 0; i < C_solutions.Length; i++)
            {
                C_solutions[i] = WhiteSpace.FIX(C_solutions[i]);
            }
            for (int i = 0; i < D_solutions.Length; i++)
            {
                D_solutions[i] = WhiteSpace.FIX(D_solutions[i]);
            }

            this.igrachi  = igrachi;
            Player_1.Text = igrachi[0].ime + " " + igrachi[0].prezime;
            Player_2.Text = igrachi[1].ime + " " + igrachi[1].prezime;
            if (igrachi.Count >= 3)
            {
                Player_3.Text = igrachi[2].ime + " " + igrachi[2].prezime;
                if (igrachi.Count == 4)
                {
                    Player_4.Text = igrachi[3].ime + " " + igrachi[3].prezime;
                }
                else
                {
                    Player_4.Hide();
                }
            }
            else
            {
                Player_3.Hide();
                Player_4.Hide();
            }

            int min   = 100;
            int index = 0;

            for (int i = 0; i < igrachi.Count; i++)
            {
                if (igrachi[i].poeniVkupno < min)
                {
                    min   = igrachi[i].poeniVkupno;
                    index = i;
                }
            }
            maxturn = igrachi.Count - 1;
            turn    = index;
            if (turn == 0)
            {
                turn = maxturn;
            }
            else
            {
                turn--;
            }
            NextPlayer_Click(null, null);
        }