コード例 #1
0
        public void SetGameBoard()
        {
            for (int i = 0; i < 5; i++)
            {
                if (i == 0)
                {
                    CategoryText1.Text = Categories[i].CategoryName;
                }
                else if (i == 1)
                {
                    CategoryText2.Text = Categories[i].CategoryName;
                }
                else if (i == 2)
                {
                    CategoryText3.Text = Categories[i].CategoryName;
                }
                else if (i == 3)
                {
                    CategoryText4.Text = Categories[i].CategoryName;
                }
                else if (i == 4)
                {
                    CategoryText5.Text = Categories[i].CategoryName;
                }

                for (int j = 0; j < 5; j++)
                {
                    QuestionAndAnswer qa  = Categories[i].questions[j];
                    string            map = "QuestionC" + (i + 1) + "R" + (j + 1);
                    questionMapping[map] = qa;
                }
            }
        }
コード例 #2
0
        public void AddQuestion(string question, string answer, int value)
        {
            QuestionAndAnswer qa = new QuestionAndAnswer();

            qa.Question = question;
            qa.Answer   = answer;
            qa.Value    = value;
            AddQuestion(qa);
        }
コード例 #3
0
        public void ReadGameSheet()
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.DefaultExt = ".xml";
            if (ofd.ShowDialog() == true)
            {
                XDocument doc = XDocument.Load(ofd.FileName);
                foreach (var element in doc.Root.DescendantNodes().OfType <XElement>())
                {
                    if (element.Name == "category")
                    {
                        Category cat = new Category();
                        cat.CategoryName = (string)element.Attribute("desc");
                        foreach (var child in element.DescendantNodes().OfType <XElement>())
                        {
                            if (child.Name == "question")
                            {
                                QuestionAndAnswer qa = new QuestionAndAnswer();
                                qa.Answer      = (string)child.Attribute("answer");
                                qa.Question    = (string)child.Attribute("text");
                                qa.Value       = int.Parse((string)child.Attribute("value"));
                                qa.DailyDouble = (string)child.Attribute("daily_double");
                                cat.AddQuestion(qa);
                            }
                        }
                        Categories.Add(cat);
                    }
                    if (element.Name == "final")
                    {
                        _finalQuestion = (string)element.Attribute("text");
                        _finalAnswer   = (string)element.Attribute("answer");
                        _finalTopic    = (string)element.Attribute("topic");
                    }
                }
            }
        }
コード例 #4
0
 public void AddQuestion(QuestionAndAnswer qa)
 {
     questions.Add(qa);
 }