Files
bansonic_beta_main/Assets/scripts/Team/settileTeam/settleTeamPrefab.cs
T

65 lines
1.9 KiB
C#

using UnityEngine;
using UnityEngine.UI;
public class settleTeamPrefab : MonoBehaviour
{
[Header("Ally Basic Information")]
public Image ally_profile;
public Text ally_name;
public Image ally_healthBar;
public Material grayM;
[Header("this_Ally_settlement")]
public Text thisAlly_earnExp;
public Text this_allyIdolScore;
[Header("本场贡献")]
public Text this_allyDamageDealt;
public Text this_allyDamageTook;
public Text this_allyHealthRestored;
public Text this_allyManaRestored;
[Header("展示详细贡献按钮")]
public Button displayDetailContributionButton;
public GameObject detailContributionGO;
private void Start()
{
// 初始化:详细贡献面板默认不激活
if (detailContributionGO != null)
{
detailContributionGO.SetActive(false);
}
// 为按钮添加点击监听
if (displayDetailContributionButton != null)
{
displayDetailContributionButton.onClick.AddListener(OnDisplayDetailContributionButtonClicked);
}
}
private void OnDestroy()
{
// 移除监听以避免内存泄漏
if (displayDetailContributionButton != null)
{
displayDetailContributionButton.onClick.RemoveListener(OnDisplayDetailContributionButtonClicked);
}
}
private void OnDisplayDetailContributionButtonClicked()
{
if (detailContributionGO == null)
{
Debug.LogWarning("[settleTeamPrefab] detailContributionGO is not assigned");
return;
}
// 切换详细贡献面板的激活状态
bool isCurrentlyActive = detailContributionGO.activeSelf;
detailContributionGO.SetActive(!isCurrentlyActive);
if (GameConfig.verboseLogs)
{
Debug.Log($"[settleTeamPrefab] Detail contribution panel toggled: {!isCurrentlyActive}");
}
}
}