Files
unity-application/Assets/SpellingBee/Scripts/ThemeItem.cs
Dries Van Schuylenbergh 2fa54620ef Wes xx build fix
2023-03-09 12:44:11 +00:00

41 lines
1019 B
C#

using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
public class ThemeItem : MonoBehaviour
{
// TODO: change to ScriptableObject Theme;
[Header("ScriptableObject Theme")]
public string themeTitle;
public string themeDescription;
public UnityAction startGameCallback;
[Header("UI references")]
// Reference to thumbnail object
public TMP_Text title;
// Reference to description object
public TMP_Text description;
// Refetence to object so correct callback can be trigger on click
public Button button;
void Start()
{
// Use public function so that this component can get Instantiated
GenerateContent();
}
public void GenerateContent()
{
// Set appearance
title.text = themeTitle;
// TODO: make description only visible when hovering
description.text = themeDescription;
// Add click functionality
button.onClick.AddListener(startGameCallback);
}
}