Universally challenged added
This commit is contained in:
58
Assets/Quiz/Scripts/UC/UCController.cs
Normal file
58
Assets/Quiz/Scripts/UC/UCController.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
|
||||
using UdonSharp;
|
||||
using UnityEngine;
|
||||
using VRC.SDKBase;
|
||||
using VRC.Udon;
|
||||
|
||||
public class UCController : UdonSharpBehaviour
|
||||
{
|
||||
public UCQuestion[] questions;
|
||||
public GameObject questionList;
|
||||
public GameObject questionListItemPrefab;
|
||||
|
||||
public TMPro.TextMeshProUGUI mainQuestionText;
|
||||
public TMPro.TextMeshProUGUI bonusQuestionInfoText;
|
||||
public TMPro.TextMeshProUGUI bonusQuestion1Text;
|
||||
public TMPro.TextMeshProUGUI bonusQuestion2Text;
|
||||
public TMPro.TextMeshProUGUI bonusQuestion3Text;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
for (int i = 0; i < questions.Length; i++)
|
||||
{
|
||||
UCQuestion question = questions[i];
|
||||
GameObject listItemObj = Instantiate(questionListItemPrefab, questionList.transform);
|
||||
UCQuestionListItem listItem = listItemObj.GetComponent<UCQuestionListItem>();
|
||||
if (listItem != null)
|
||||
{
|
||||
listItem.Initialize(question);
|
||||
listItem.controller = this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void ChangeQuestionPanel(UCQuestion question)
|
||||
{
|
||||
if (mainQuestionText != null)
|
||||
{
|
||||
mainQuestionText.text = question.mainQuestion;
|
||||
}
|
||||
if (bonusQuestionInfoText != null)
|
||||
{
|
||||
bonusQuestionInfoText.text = question.bonusQuestionInfo;
|
||||
}
|
||||
if (bonusQuestion1Text != null)
|
||||
{
|
||||
bonusQuestion1Text.text = question.bonusQuestion1;
|
||||
}
|
||||
if (bonusQuestion2Text != null)
|
||||
{
|
||||
bonusQuestion2Text.text = question.bonusQuestion2;
|
||||
}
|
||||
if (bonusQuestion3Text != null)
|
||||
{
|
||||
bonusQuestion3Text.text = question.bonusQuestion3;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user