public void Handler(object sender, WheelStopSpinEventArgs e)
        {
            e.CocurrentRoutine.AddOnFinishCallback(OnEnter);

            ResetButtons();
            List <int> indexes = new List <int>();

            for (int i = 0; i < Settings.ANSWERS_COUNT; i++)
            {
                indexes.Add(i);
            }

            var QnA = Services.Instance.QuestionsProvider.GetNextQuestion(e.QuestionCategory);

            questionText.text = QnA.Question;
            foreach (var ans in QnA.WrongAnswers)
            {
                var r     = Random.Range(0, indexes.Count);
                var index = indexes[r];
                indexes.RemoveAt(r);

                answersButtons[index].GetComponentInChildren <Text>().text = ans;
                var tempIndexA = index;
                answersButtons[index].onClick.AddListener(() => OnAnswerPicked(false, tempIndexA));
            }

            answersButtons[indexes[0]].GetComponentInChildren <Text>().text = QnA.RightAnswer;
            var tempIndexB = indexes[0];

            answersButtons[indexes[0]].onClick.AddListener(() => OnAnswerPicked(true, tempIndexB));
        }
예제 #2
0
 public void Handler(object sender, WheelStopSpinEventArgs e)
 {
     categoryImg.sprite = Services.Instance.QuestionsProvider.GetCategoryDefinition(e.QuestionCategory).Sprite;
     e.CocurrentRoutine.AddRoutine(new System.Func <IEnumerator>(() => CategoryImageFadeIn()));
     e.CocurrentRoutine.AddOnFinishCallback(OnExit);
 }