using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Networking; using UnityEngine.UI; public class QuestionCard : MonoBehaviour { public Text questionText; public Text answerText; public Text backCategoryText; public GameObject questionTextPanel; public string questionString = ""; public string answerString = ""; public string idString = ""; public string categoryString = ""; public Color32 unsafeColor; public Color32 safeColor; [SerializeField] CanvasGroup frosting; public void SetQuestionSafe() { this.GetComponent().color = safeColor; } internal void SetQuestionUnSafe() { this.GetComponent().color = unsafeColor; } public bool IsQuestionSafe() { if (this.GetComponent().color == safeColor) { return true; } return false; } public void SetQuestionCategoryColor(Color32 questionCategoryColor) { if (backCategoryText != null) { backCategoryText.transform.parent.GetComponent().color = questionCategoryColor; } } public void SetQuestionText(string text) { if (questionText == null) { GameObject test = new GameObject("Text"); questionText = test.AddComponent(); } this.questionText.text = text; } public void SetAnswerText(string text) { if (answerText == null) { GameObject test = new GameObject("Text"); answerText = test.AddComponent(); } this.answerText.text = text; } public Text GetQuestionText() { return this.questionText; } public Text GetAnswerText() { return this.answerText; } public int GetCategoryId() { Int32.TryParse(categoryString, out int result); return result; } internal int GetId() { Int32.TryParse(idString, out int result); return result; } public void SetId(int value) { idString = value.ToString(); } public void SetBackCategoryText(string value) { if (backCategoryText == null) { GameObject test = new GameObject("Text"); backCategoryText = test.AddComponent(); } backCategoryText.text = value; } public string GetBackCategoryText() { if (backCategoryText == null) { return "Category"; } return backCategoryText.text; } public void SetFrostingActive(Boolean value) { if (value) { frosting.alpha = 1f; } else { frosting.alpha = 0f; } } }