Beispiel #1
0
    public void ProcessEvent(MultipleChoiceEvent e, MultipleChoiceEventProcessor eventManager)
    {
        var choices = e.GetClosestOptions(Constants.DefaultChoicesCount);

        for (int i = 0; i < choices.Count; ++i)
        {
            GameObject choiceGameObject = Instantiate(MultipleChoiceButtonPrefab);
            choiceGameObject.SetActive(true);
            choiceGameObject.transform.SetParent(transform, true);

            MultipleChoiceData multipleChoiceData = choiceGameObject.GetComponent <MultipleChoiceData>();
            multipleChoiceData.SetEvent(choices[i], eventManager);

            if (choiceGameObject.GetComponentsInChildren <Text>().Length > 0)
            {
                choiceGameObject.GetComponentsInChildren <Text>()[0].text = e.Choices[i].ChoiceText;
            }

            _choiceGameObjects.Add(choiceGameObject);
        }
    }
 public void SetEvent(TextChoice choice, MultipleChoiceEventProcessor viewProcessor)
 {
     _choice = choice;
     _owner  = viewProcessor;
 }