using System; using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.UI; public class PackPanel : MonoBehaviour { [SerializeField] private TextMeshProUGUI _textMeshPro; [SerializeField] private Button packButton; // Start is called before the first frame update void Start() { } private void OnEnable() { packButton.onClick.AddListener(ResetPanelData); } // Update is called once per frame void Update() { } private void OnDisable() { packButton.onClick.RemoveListener(ResetPanelData); } public void ResetPanelData() { GameManager.ins.PackEvent(); _textMeshPro.text = "剩余箱子数" + (GameManager.ins.index - 1); } }