예제 #1
0
        private void CheckCurrentAnswer(ClassificationQuestion currentQuestion)
        {
            Debug.Log("Check answer is clicked " + currentQuestionIndex);
            int selectedAnswersCount = selectedSprites.Count();

            CheckSelectedSprites(selectedAnswersCount, currentQuestion);
        }
예제 #2
0
파일: Actor.cs 프로젝트: ulankz/Meezum
 public void UpdateActor(ClassificationQuestion question, List <Sprite> sprites)
 {
     id               = question.ActorIds [index];
     type             = (ActorTypes)(question.ActorIds [index] - 1); // question.Actors [id]-1 because actor ids start from 1..10
     title            = type.ToString();
     sRenderer.sprite = sprites [question.ActorIds [index] - 1] as Sprite;
 }
예제 #3
0
        private void CheckSelectedSprites(int selectedAnswerCount, ClassificationQuestion currentQuestion)
        {
            int correctAnswersCount = currentQuestion.CorrectAnswersDict.Count();
            int selectedSum         = 0;

            foreach (var key in currentQuestion.CorrectAnswersDict.Keys)
            {
                tracker.Add(key, false);
            }
            for (int i = 0; i < selectedAnswerCount; i++)
            {
                if (currentQuestion.CorrectAnswersDict [selectedSprites [i].Id - 1] == 1)
                {
                    Debug.Log("ANSWER IS CORRECT AT INDEX " + selectedSprites [i].Index);
                    classificationUIManager.UpdateActorSprites(1, selectedSprites [i].Index);
                    selectedSum++;
                }
                else
                {
                    if (currentQuestion.CorrectAnswersDict [selectedSprites [i].Id - 1] == 0)
                    {
                        Debug.Log("ANSWER IS WRONG AT INDEX " + selectedSprites [i].Index);
                        classificationUIManager.UpdateActorSprites(2, selectedSprites [i].Index);
                        selectedSum--;
                    }
                }
                tracker [selectedSprites [i].Id - 1] = true;
            }
            if (selectedAnswerCount < tracker.Count)
            {
                for (int i = 0; i < tracker.Count; i++)
                {
                    var element = tracker.ElementAt(i);
                    if (element.Value == false)
                    {
                        if (currentQuestion.CorrectAnswersDict [element.Key] == 1)
                        {
                            classificationUIManager.UpdateActorSprites(1, i);
                            Debug.Log("CHECK ME > ERROR FIRES HERE " + i);
                        }
                        else if (currentQuestion.CorrectAnswersDict [element.Key] == 0)
                        {
                            classificationUIManager.UpdateActorSprites(2, i);
                        }
                        Debug.Log("TRACKER OBJECT IS NOT YET CHECKED");
                    }
                }
            }
            if (selectedSum == currentQuestion.CorrectAnswerSum)
            {
                classificationUIManager.UpdateStarManager(currentQuestionIndex, true);
            }
            tracker.Clear();
            selectedSprites.Clear();
        }
예제 #4
0
 public void PopulateUI(ClassificationQuestion question)
 {
     if (questionLabel != null)
     {
         questionLabel.UpdateQuestionLabel(question.Description);
     }
     if (actorsContainer != null && actorsContainer.Length > 0)
     {
         foreach (Actor actor in actorsContainer)
         {
             Debug.Log("Question " + actorSprites);
             actor.UpdateActor(question, actorSprites);
         }
     }
 }
예제 #5
0
        void GenerateQuestions()
        {
            ClassificationQuestion q1 = new ClassificationQuestion(1, "Нажми на всех взрослых посетителей магазина?", new int[] {
                1, 1, 1, 0, 0, 1, 1, 1, 0, 0
            });
            ClassificationQuestion q2 = new ClassificationQuestion(2, "Нажми на всех мужчин посетителей магазина?", new int[] {
                1, 1, 1, 1, 1, 0, 0, 0, 0, 0
            });
            ClassificationQuestion q3 = new ClassificationQuestion(3, "Нажми на всех худых посетителей магазина?", new int[] {
                1, 0, 1, 0, 1, 1, 1, 0, 1, 1
            });
            ClassificationQuestion q4 = new ClassificationQuestion(4, "Нажми на всех посетителей магазина  в желтой одежде?", new int[] {
                0, 0, 0, 1, 0, 0, 1, 0, 0, 0
            });
            ClassificationQuestion q5 = new ClassificationQuestion(5, "Нажми на всех посетителей магазина в очках?", new int[] {
                0, 1, 1, 1, 0, 1, 1, 0, 0, 0
            });
            ClassificationQuestion q6 = new ClassificationQuestion(6, "Нажми на всех посетителей магазина в униформе?", new int[] {
                1, 0, 0, 0, 0, 0, 0, 0, 0, 0
            });
            ClassificationQuestion q7 = new ClassificationQuestion(7, "Нажми на всех посетителей магазина с сумками?", new int[] {
                0, 0, 1, 1, 0, 1, 1, 0, 1, 0
            });
            ClassificationQuestion q8 = new ClassificationQuestion(8, "Нажми на всех посетителей магазина с коляской?", new int[] {
                0, 0, 0, 0, 0, 1, 0, 0, 0, 0
            });
            ClassificationQuestion q9 = new ClassificationQuestion(9, "Нажми на всех посетителей магазина в головном уборе?", new int[] {
                1, 1, 0, 0, 0, 0, 1, 0, 1, 1
            });
            ClassificationQuestion q10 = new ClassificationQuestion(10, "Нажми на всех высоких посетителей магазина?", new int[] {
                1, 0, 1, 1, 0, 0, 1, 0, 1, 0
            });

            questions [0] = q1;
            questions [1] = q2;
            questions [2] = q3;
            questions [3] = q4;
            questions [4] = q5;
            questions [5] = q6;
            questions [6] = q7;
            questions [7] = q8;
            questions [8] = q9;
            questions [9] = q10;
        }