Universally challenged added
This commit is contained in:
46
Assets/Quiz/Scripts/UC/UCQuestionListItem.cs
Normal file
46
Assets/Quiz/Scripts/UC/UCQuestionListItem.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
|
||||
using UdonSharp;
|
||||
using UnityEngine;
|
||||
using VRC.SDKBase;
|
||||
using VRC.Udon;
|
||||
|
||||
public class UCQuestionListItem : UdonSharpBehaviour
|
||||
{
|
||||
public UCController controller;
|
||||
public UCQuestion questionData;
|
||||
public UnityEngine.UI.Image backgroundImage;
|
||||
|
||||
public TMPro.TextMeshProUGUI textComponent;
|
||||
|
||||
public void Initialize(UCQuestion question)
|
||||
{
|
||||
questionData = question;
|
||||
|
||||
if (backgroundImage == null)
|
||||
{
|
||||
backgroundImage = GetComponent<UnityEngine.UI.Image>();
|
||||
}
|
||||
|
||||
if (textComponent == null)
|
||||
{
|
||||
textComponent = GetComponentInChildren<TMPro.TextMeshProUGUI>();
|
||||
}
|
||||
|
||||
if (textComponent != null && questionData != null)
|
||||
{
|
||||
textComponent.text = questionData.mainQuestion;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnItemClicked()
|
||||
{
|
||||
if (controller != null && questionData != null)
|
||||
{
|
||||
controller.ChangeQuestionPanel(questionData);
|
||||
if (backgroundImage != null)
|
||||
{
|
||||
backgroundImage.color = Color.gray; // Example of changing background color on click
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user