结算贡献面板小重做

This commit is contained in:
FloatGaming
2026-01-25 13:48:02 +08:00
parent aee8ae634e
commit abeca51be5
3 changed files with 514 additions and 55 deletions
@@ -16,4 +16,49 @@ public class settleTeamPrefab : MonoBehaviour
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}");
}
}
}