private void onQuestionClick(QuestionButtonTemplate pButton) { if (buttonClickEvent != null) { buttonClickEvent(pButton); } }
public void InitList(ChapterItem pChapter) { currentChapter = pChapter; questionsList = new List <QuestionButtonTemplate> (); //int i = 1; foreach (var c in Utility.getQuestionsFromRes(pChapter.questions, currentChapter.StoreItemID)) { GameObject newButtonItem = null; newButtonItem = Instantiate(questionButton) as GameObject; QuestionButtonTemplate button1 = newButtonItem.GetComponent <QuestionButtonTemplate>(); button1.questionItem = c; button1.InitQuestion(); button1.button.onClick.RemoveAllListeners(); button1.button.onClick.AddListener(() => onQuestionClick(button1)); newButtonItem.transform.SetParent(QuestionsListPanel); newButtonItem.transform.localScale = new Vector3(1, 1, 1); RectTransform rctr = newButtonItem.GetComponent <RectTransform>(); rctr.offsetMax = new Vector2(0, 0); rctr.offsetMin = new Vector2(0, 0); rctr.anchoredPosition3D = new Vector3(0, 0, 0); questionsList.Add(button1); //i++; Debug.Log("ADD QUESTION"); } Canvas.ForceUpdateCanvases(); scroll.verticalNormalizedPosition = 1f; }
private void onQuestionClick(QuestionButtonTemplate pButton) { gamePanel.currentQuestion = pButton.questionItem; gamePanel.StartGame(); }