public void ShuffleQuestions()
 {
     for (int i = 0; i < this.questions.Length; i++)
     {
         int rand = Random.Range(0, this.questions.Length);
         InteractiveQuestion a = this.questions[i];
         InteractiveQuestion b = this.questions[rand];
         this.questions[i]    = b;
         this.questions[rand] = a;
     }
 }
Beispiel #2
0
        public static void UpdateQuestion(InteractiveQuestion question, Action <InteractiveQuestion> onComplete)
        {
            //PUT /api/interactive/questions/:questionId
            //Body =  { "text": "", "answers": { "correct": [], "wrong": []} }
            Dictionary <string, object> body = new Dictionary <string, object>();

            body.Add("text", question.text);
            body.Add("answers", new Dictionary <string, string[]>()
            {
                { "correct", question.answers.correct }, { "wrong", question.answers.wrong }
            });

            ServerRequest.CallAPI("/interactive/questions/" + question._id, HTTPMethod.PUT, body, (response) => { ServerRequest.ResponseHandler(response, null, onComplete); }, true);
        }
Beispiel #3
0
 public static void CreateQuestion(InteractiveQuestion question, Action <InteractiveQuestion> onComplete)
 {
     CreateQuestion(question.text, question.answers.correct, question.answers.wrong, onComplete);
 }