Exemplo n.º 1
0
    /// <summary>
    /// Initializes a figures and then its questions and answers
    /// </summary>
    /// <param name="figure">Figure to instantiate</param>
    /// <param name="QuestionsAndAnswers">Dictionary of questions and answers to instantiate</param>
    private void InitializeScenarioFigure(ScenarioFigure figure, Dictionary <ScenarioQuestion, List <ScenarioAnswer> > QuestionsAndAnswers)
    {
        GameObject  newPanel = AddFigure(figure.Figure_Id.ToString(), figure);
        FigurePanel fp       = newPanel.GetComponent <FigurePanel>();

        foreach (var QnA in QuestionsAndAnswers)
        {
            GameObject questionTemp = fp.InstantiateQuestion(QnA.Key.Question_Text, QnA.Key.Scenario_Figure_Id, QnA.Key.Id);
            Dictionary <GameObject, ScenarioAnswer> answers = new Dictionary <GameObject, ScenarioAnswer>();
            foreach (var answer in QnA.Value)
            {
                answers.Add(fp.InstantiateAnswer(questionTemp.transform, answer.Answer_Text, answer.Scenario_Question_Id, answer.Id), answer);
            }
            foreach (var answerGOPair in answers)
            {
                if (answerGOPair.Value.Correct_Answer == 1)
                {
                    answerGOPair.Key.GetComponentInChildren <Toggle>().isOn = true;
                }
            }
        }
        figurePanelRef.resetPanelsFunc();
    }
Exemplo n.º 2
0
 public void AddQuestion()
 {
     figurePanelRef.InstantiateQuestion();
 }