public SingleChoicePage(SingleChoice task, int chosenButtonIndex, int rightAnswerIndex) { InitializeComponent(); optionButtons = new List <Button>(); isResultPage = true; QuestionBlock.Text = task.Question; for (var optionNum = 0; optionNum < task.Options.Count; optionNum++) { AddOption(optionNum, task.Options[optionNum]); } if (chosenButtonIndex >= 0) { if (chosenButtonIndex == rightAnswerIndex) { optionButtons[chosenButtonIndex].Background = new SolidColorBrush(chosenRightOptionColor); } else { optionButtons[chosenButtonIndex].Background = new SolidColorBrush(chosenWrongOptionColor); optionButtons[rightAnswerIndex].Background = new SolidColorBrush(notChosenRightOptionColor); } } else { optionButtons[rightAnswerIndex].Background = new SolidColorBrush(notChosenRightOptionColor); } }
public SingleChoicePage(SingleChoice task) { InitializeComponent(); optionButtons = new List <Button>(); isResultPage = false; QuestionBlock.Text = task.Question; for (var optionNum = 0; optionNum < task.Options.Count; optionNum++) { AddOption(optionNum, task.Options[optionNum]); } }
// Start is called before the first frame update void Start() { if (gameObject.activeInHierarchy) { gameObject.SetActive(false); } // button listeners resume.onClick.AddListener(delegate { Resume(); }); restart.onClick.AddListener(delegate { Restart(); }); help.onClick.AddListener(delegate { Help(); }); exit.onClick.AddListener(delegate { Exit(); }); // find the level's main script levelScript = GameObject.Find("Quiz UI").GetComponent <SingleChoice>(); }
public RedactSingleChoicePage(ref SingleChoice task) { InitializeComponent(); this.task = task; MarkTextBox.Text = task.Mark.ToString(CultureInfo.InvariantCulture); QuestionTextBox.Text = task.Question; foreach (var option in task.Options) { OptionsList.Items.Add(new ComboBoxItem() { Content = option }); RightOptionSelector.Items.Add(new ComboBoxItem { Content = option }); } SetAddNewOption(); RightOptionSelector.SelectedIndex = task.RightAnswerIndex; SetQuestionButton.Click += SetQuestionButtonClick; SetOptionButton.Click += SetOptionButtonClick; DeleteOptionButton.Click += DeleteOptionButtonClick; SetMarkButton.Click += SetMarkButtonClick; OptionTextBox.TextChanged += OptionTextBoxTextChanged; QuestionTextBox.TextChanged += QuestionTextBoxTextChanged; MarkTextBox.TextChanged += MarkTextBoxTextChanged; OptionsList.SelectionChanged += OptionsListSelectionChanged; RightOptionSelector.SelectionChanged += RightOptionSelectorSelectionChanged; SetQuestionButton.IsEnabled = false; SetOptionButton.IsEnabled = false; SetMarkButton.IsEnabled = false; OptionsList.SelectedIndex = 0; }
public void Visit(SingleChoice singleChoice) => Quest.Selectable(singleChoice);
public SingleChoicePage(SingleChoice task, int chosenButtonIndex) : this(task) { optionButtons[chosenButtonIndex].Background = new SolidColorBrush(chosenOptionColor); }