Ejemplo n.º 1
0
        public QuestionBoxScreen(DataTable dt, int rowIndex)
            : base("")
        {
            Table = dt;
            RowIndex = rowIndex;

            List<int> answerNumbers = new List<int>(){2, 3, 4};
            List<int> cellIndices = new List<int>();
            Random rand = new Random(325456431);

            while(answerNumbers.Count > 0)
            {
                int index = rand.Next(0, answerNumbers.Count);
                cellIndices.Add(answerNumbers[index]);
                answerNumbers.RemoveAt(index);
            }
            cellIndices.Shuffle();

            MenuEntry answer1MenuEntry = new MenuEntry(dt.Rows[rowIndex].ItemArray[cellIndices[0]].ToString());
            MenuEntry answer2MenuEntry = new MenuEntry(dt.Rows[rowIndex].ItemArray[cellIndices[1]].ToString());
            MenuEntry answer3MenuEntry = new MenuEntry(dt.Rows[rowIndex].ItemArray[cellIndices[2]].ToString());

            answer1MenuEntry.Selected += AnswerSelected;
            answer2MenuEntry.Selected += AnswerSelected;
            answer3MenuEntry.Selected += AnswerSelected;

            MenuEntries.Add(answer1MenuEntry);
            MenuEntries.Add(answer2MenuEntry);
            MenuEntries.Add(answer3MenuEntry);

            Question = dt.Rows[rowIndex].ItemArray[1].ToString();

            IsPopUp = true;
            TransitionOnTime = TimeSpan.FromSeconds(0.2);
            TransitionOffTime = TimeSpan.FromSeconds(0.2);

            NrLinesInQuestion = 1;
        }
Ejemplo n.º 2
0
        public MainMenuScreen()
            : base("Platformer")
        {
            MenuEntry topic0MenuEntry = new MenuEntry("Level1");
            MenuEntry topic1MenuEntry = new MenuEntry("Level2");
            MenuEntry topic2MenuEntry = new MenuEntry("Level3");
            MenuEntry topic3MenuEntry = new MenuEntry("Level4");
            MenuEntry topic4MenuEntry = new MenuEntry("Level5");
            MenuEntry exitMenuEntry = new MenuEntry("Exit");

            topic0MenuEntry.Selected += TopicMenuEntrySelected;
            topic1MenuEntry.Selected += TopicMenuEntrySelected;
            topic2MenuEntry.Selected += TopicMenuEntrySelected;
            topic3MenuEntry.Selected += TopicMenuEntrySelected;
            topic4MenuEntry.Selected += TopicMenuEntrySelected;
            exitMenuEntry.Selected += ExitMenuEntrySelected;

            MenuEntries.Add(topic0MenuEntry);
            MenuEntries.Add(topic1MenuEntry);
            MenuEntries.Add(topic2MenuEntry);
            MenuEntries.Add(topic3MenuEntry);
            MenuEntries.Add(topic4MenuEntry);
            MenuEntries.Add(exitMenuEntry);
        }