Files
ihob/Assets/Scripts/MainGame/TalentTabController.cs
2026-02-21 17:04:05 -08:00

55 lines
1.8 KiB
C#

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<GameStateController>();
// 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());
}
}