예제 #1
0
파일: Client.cs 프로젝트: Hindi/C3P0GitHub
    public void loadStats(int currentCourseId)
    {
        if (currentCourseId != 0)
        {
            currentCourseStatsId = currentCourseId;
            try
            {
                List <Answer> stats = XmlHelpers.loadFromXML <List <Answer> >(Application.dataPath + "/Resources/xml/answers/" + currentCourseId + "/" + login + ".xml", "ArrayOfAnswer");
                QuestionManager.AnswerKeeper answerKeeper;
                foreach (Answer a in stats)
                {
                    answerKeeper             = new QuestionManager.AnswerKeeper();
                    answerKeeper.question    = new QuestionManager.QuestionKeeper();
                    answerKeeper.answerTime  = a.answerTime;
                    answerKeeper.rep         = a.response;
                    answerKeeper.result      = a.result;
                    answerKeeper.question.id = a.questionId;

                    answers.Add(answerKeeper);
                }
                calcScore();
                C3PONetworkManager.Instance.setScore(networkPlayer, score);
            }
            catch
            {
            }
        }
    }
예제 #2
0
파일: Client.cs 프로젝트: Hindi/C3P0GitHub
    public QuestionManager.AnswerKeeper lastAnswer()
    {
        if (answers.Count == 0)
        {
            QuestionManager.AnswerKeeper answerKeeper = new QuestionManager.AnswerKeeper();
            answerKeeper.question    = new QuestionManager.QuestionKeeper();
            answerKeeper.answerTime  = 40;
            answerKeeper.rep         = 0;
            answerKeeper.result      = false;
            answerKeeper.question.id = 0;

            answers.Add(answerKeeper);
        }
        return(answers[answers.Count - 1]);
    }
예제 #3
0
파일: Client.cs 프로젝트: Hindi/C3P0GitHub
 public void addAnswer(QuestionManager.AnswerKeeper a, int courseId)
 {
     if (currentCourseStatsId != courseId)
     {
         loadStats(courseId);
     }
     if (answers.Exists(x => x.question.id == a.question.id))
     {
         answers.Remove(answers.Find(x => x.question.id == a.question.id));
         answers.Add(a);
         calcScore();
     }
     else if (a.result)
     {
         score++;
         answers.Add(a);
     }
 }