void generatePanel(MCAnswer answer) { // Main pop-up panel GameObject go = new GameObject(); RectTransform rect = go.AddComponent <RectTransform>(); rect.sizeDelta = new Vector2(GameObject.Find("Canvas").GetComponent <RectTransform>().rect.width *0.8f, GameObject.Find("Canvas").GetComponent <RectTransform>().rect.height * 0.8f); rect.anchorMin = center; rect.anchorMax = center; rect.pivot = center; go.AddComponent <CanvasRenderer>(); Image img = go.AddComponent <Image>(); if (answer.isCorrect) { img.color = correctPanelColor; } else { img.color = incorrectPanelColor; } // "Okay" Button GameObject doneBtn = Resources.Load("orange_btn") as GameObject; doneBtn.GetComponent <TextMeshProUGUI>().text = "Okay"; doneBtn.transform.SetParent(go.transform, false); doneBtn.GetComponent <Button>().onClick.AddListener(() => kill(go)); }
private void CreateAnswerObjects() { MCBank = new MCAnswer[4]; a1 = new MCAnswer(answer1, isCorrect1, reason1); a2 = new MCAnswer(answer2, isCorrect2, reason2); a3 = new MCAnswer(answer3, isCorrect3, reason3); a4 = new MCAnswer(answer4, isCorrect4, reason4); MCBank[0] = a1; MCBank[1] = a2; MCBank[2] = a3; MCBank[3] = a4; }
private void CreateAnswerObjects() { answers = new MCAnswer[4]; a1 = new MCAnswer(answer1, isCorrect1, reason1); a2 = new MCAnswer(answer2, isCorrect2, reason2); a3 = new MCAnswer(answer3, isCorrect3, reason3); a4 = new MCAnswer(answer4, isCorrect4, reason4); answers[0] = a1; answers[1] = a2; answers[2] = a3; answers[3] = a4; }
public PartialViewResult MultipleChoiceResultModal(MCAnswer answer) { return(PartialView("/Views/DatabaseDesign/MultipleChoiceResultModal", answer)); }