using System; using TMPro; using UnityEngine; [CreateAssetMenu(menuName = "UIinfo", fileName = "UiUpgradeInfo")] public class UpgradeUIinfo: UIinfo { //Reference to the prefab [SerializeField] private GameObject upgradeInfoPanelPrefab; [SerializeField] private UpgradeManager manager; //Display the Data public override void OnDisplay<T>(T t) { if (t is int index) { //UpgradeData data = manager.GetUpgrade(index); //Transform canvas = GameObject.Find("Canvas").transform; //// Instantiate the panel //GameObject panelInstance = Instantiate(upgradeInfoPanelPrefab, canvas); //// Get references to the text components //TextMeshProUGUI descriptionText = panelInstance.transform.Find("DescriptionText").GetComponent<TextMeshProUGUI>(); //TextMeshProUGUI statusText = panelInstance.transform.Find("StatusText").GetComponent<TextMeshProUGUI>(); //// Set the text values based on the UpgradeData //descriptionText.text = data.upgradeDescription; //statusText.text = data.isUnlocked ? "Unlocked" : "Locked"; //Instantiate(panelInstance.transform, canvas); } } }