public QuizResultPropertyJSON(QuizResultProperty property) { this.correctAnswer = property.correctAnswer; this.incorrectAnswer = property.incorrectAnswer; this.correctAudioURL = property.correctAudioURL; this.incorrectAudioURL = property.incorrectAudioURL; }
public void Init(QuizPopUpDataModel popupDataModel) { size = popupDataModel.popUpSetting.size; this.resultProperty = popupDataModel.popUpSetting.result; correctAnswer = popupDataModel.popUpSetting.options.correctAnswer; //Set text property for question SetTextProperty(questionText, popupDataModel.popUpSetting.question); foreach (var obj in optionsRect.GetComponentsInChildren <TextMeshProUGUI>()) { DestroyImmediate(obj.gameObject); } for (int i = 0; i < popupDataModel.popUpSetting.options.options.Count; i++) { GameObject obj = Instantiate(answerPrefab, optionsRect, false); obj.SetActive(true); obj.GetComponent <TextMeshProUGUI>().font = popupDataModel.popUpSetting.options.font; obj.GetComponent <TextMeshProUGUI>().color = popupDataModel.popUpSetting.options.color; obj.GetComponent <TextMeshProUGUI>().text = popupDataModel.popUpSetting.options.options[i]; string option = popupDataModel.popUpSetting.options.options[i]; obj.GetComponent <Button>().onClick.AddListener(delegate { OnResult(option); }); } SetCloseButtonImage(imageCloseButton, popupDataModel.popUpSetting); //Set Close Button SetImageProperty(imageBackground, popupDataModel.popUpSetting.background, ImageEnum.None); //Set image property for Background SetImageProperty(resultPanel.GetComponent <Image>(), popupDataModel.popUpSetting.background, ImageEnum.None); //Set image property for Image sequance //Set size StartCoroutine(SetSize(popupDataModel, popupDataModel.popUpSetting.sizeOption)); }