internal void FillContents(Question question)
 {
     Question = question;
     QuestionContents = question.QuestionContents;
     QuestionData = question.QuestionData;
     Index = 1;
 }
Exemplo n.º 2
0
        internal void FillContents(Question question, QuestionContents contents, QuestionData data, int idx)
        {
            Question         = question;
            QuestionContents = contents;
            QuestionData     = data;
            Index            = idx;
            CorrectAnswer    = QuestionContents.CorrectAnswer;

            Image1.ImageUrl = QuestionContents.Keys.Contains("image") ? QuestionContents.Get <Parse.ParseFile>("image").Url.ToString() : "";
            lbQuestion.Text = QuestionContents.Get <string>("questionText");

            item1.Text = item1.Value = QuestionContents.Answers[0];
            item2.Text = item2.Value = QuestionContents.Answers[1];
            item3.Text = item3.Value = QuestionContents.Answers[2];
            item4.Text = item4.Value = QuestionContents.Answers[3];
            if (QuestionContents.Answers.Count == 5)
            {
                item5.Text = item5.Value = QuestionContents.Answers[4];
                item5.Attributes.Remove("class");
            }
            else
            {
                item5.Attributes.Add("class", "hidden");
            }
        }
 internal void FillContents(Question question, QuestionContents contents, QuestionData data, int idx)
 {
     Question = question;
     QuestionContents = contents;
     QuestionData = data;
     Index = idx;
 }
        internal void FillContents(Question question, QuestionContents contents, QuestionData data, int idx)
        {
            Question = question;
            QuestionContents = contents;
            QuestionData = data;
            Index = idx;
            CorrectAnswer = QuestionContents.CorrectAnswer;

            Image1.ImageUrl = QuestionContents.Keys.Contains("image") ? QuestionContents.Get<Parse.ParseFile>("image").Url.ToString() : "";
            lbQuestion.Text = QuestionContents.Get<string>("questionText");

            item1.Text = item1.Value = QuestionContents.Answers[0];
            item2.Text = item2.Value = QuestionContents.Answers[1];
            item3.Text = item3.Value = QuestionContents.Answers[2];
            item4.Text = item4.Value = QuestionContents.Answers[3];
            if (QuestionContents.Answers.Count == 5)
            {
                item5.Text = item5.Value = QuestionContents.Answers[4];
                item5.Attributes.Remove("class");
            }
            else
            {
                item5.Attributes.Add("class", "hidden");
            }
        }
Exemplo n.º 5
0
    // Yes/No/Cancel: A string, a Yes event, a No event and Cancel event
    public void Choice(string question, UnityAction yesEvent, UnityAction noEvent, UnityAction cancelEvent, string yesText = "Yes", string noText = "No", string cancelText = "Cancel")
    {
        var contents = new QuestionContents();

        contents.question    = question;
        contents.yesEvent    = yesEvent;
        contents.noEvent     = noEvent;
        contents.cancelEvent = cancelEvent;
        contents.yesText     = yesText;
        contents.noText      = noText;
        contents.cancelText  = cancelText;
        contents.sprite      = null;
        pendingQuestions.Enqueue(contents);
        if (!modalPanelObject.activeSelf)
        {
            DequeueQuestion();
        }
    }