using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; using TMPro; public class TalentTabController : MonoBehaviour, IPointerDownHandler { [SerializeField] TalentPanelController panel; [SerializeField] int tabIndex = -1; [SerializeField] TextMeshProUGUI textName; [SerializeField] TextMeshProUGUI textEnergy; [SerializeField] TextMeshProUGUI textStatus; [SerializeField] TextMeshProUGUI textTips; [HideInInspector] GameStateController gameStateController; public void OnPointerDown(PointerEventData eventData) { gameStateController.HandleSelect(tabIndex); } public void setPanelActive(bool active) { panel.gameObject.SetActive(active); } private void Awake() { // All pop-up panels start inactive. if (panel) { panel.gameObject.SetActive(false); } } // Start is called before the first frame update void Start() { gameStateController = GameObject.FindGameObjectWithTag("GameStateController").GetComponent(); // Load name and level from GameData. textName.SetText(((Employee)tabIndex).ToString() + " LV" + GameData.GLOBAL.employeeStats[tabIndex].level); Debug.Log("TODO: Load talent image and whatnot into tab from GameData"); } private string GetTalentStatus() { // TODO: Implement from talentState and Talent controller (maybe) return "Somewhere"; } private void LateUpdate() { // Load current stats from TalentState. textEnergy.SetText(gameStateController.talentState[tabIndex].energy.ToString()); textStatus.SetText(GetTalentStatus()); textTips.SetText("$" + gameStateController.talentState[tabIndex].tips.ToString()); } }