| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- 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;
- public void SetQuestionSafe() {
- this.GetComponent<Image>().color = safeColor;
- }
- internal void SetQuestionUnSafe() {
- this.GetComponent<Image>().color = unsafeColor;
- }
- public bool IsQuestionSafe() {
- if (this.GetComponent<Image>().color == safeColor) {
- return true;
- }
- return false;
- }
- public void SetQuestionCategoryColor(Color32 questionCategoryColor) {
- if (backCategoryText != null) {
- backCategoryText.transform.parent.GetComponent<Image>().color = questionCategoryColor;
- }
- }
- public void SetQuestionText(string text) {
- if (questionText == null) {
- GameObject test = new GameObject("Text");
- questionText = test.AddComponent<Text>();
- }
- this.questionText.text = text;
- }
- public void SetAnswerText(string text) {
- if (answerText == null) {
- GameObject test = new GameObject("Text");
- answerText = test.AddComponent<Text>();
- }
- 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<Text>();
- }
- backCategoryText.text = value;
- }
- public string GetBackCategoryText() {
- if (backCategoryText == null) {
- return "Category";
- }
- return backCategoryText.text;
- }
- }
|