yyl
2025-10-22 73230b277cda84d306030d1f8db2ad37e9016c5f
Main/System/Battle/UIComp/TotalDamageDisplayer.cs
@@ -1,8 +1,8 @@
using System.Collections;
using Cysharp.Threading.Tasks;
using DG.Tweening;
using UnityEngine;
using UnityEngine.UI;
using System.Threading;
public class TotalDamageDisplayer : MonoBehaviour
{
@@ -14,6 +14,10 @@
    private Coroutine hideCoroutine;
    private int hideVersion = 0;
    private long damage = 0;
    private long heal = 0;
    public void SetDamage(BattleDmgInfo dmgInfo)
    {
@@ -29,11 +33,28 @@
        if (dmgInfo.IsType(DamageType.Recovery))
        {
            // 保持原有处理逻辑位置
            foreach (var h in dmgInfo.damageList)
            {
                heal += h;
            }
            textDamage.text = BattleUtility.DisplayDamageNum(heal, BattleConst.BattleTotalRecoverType);
            textTotalDesc.text = "总治疗";
        }
        else if (dmgInfo.IsType(DamageType.Damage) || dmgInfo.IsType(DamageType.Realdamage))
        {
            // 保持原有处理逻辑位置
            foreach (var d in dmgInfo.damageList)
            {
                damage += d;
            }
            textDamage.text = BattleUtility.DisplayDamageNum(damage, BattleConst.BattleTotalDamageType);
            textTotalDesc.text = "总伤害";
        }
        textDamage.transform.DOPunchScale(Vector3.one * 0.2f, 0.2f, 1).OnComplete(() =>
        {
            textDamage.transform.localScale = Vector3.one;
        });
        if (dmgInfo.isLastHit)
        {
@@ -41,10 +62,12 @@
            hideVersion++;
            int myVersion = hideVersion;
            damage = 0;
            heal = 0;
            var battleField = BattleManager.Instance.GetBattleField(dmgInfo.battleFieldGuid);
            float ms = 1000f / battleField.speedRatio;
            float ms = 500f / battleField.speedRatio;
            hideCoroutine = StartCoroutine(HideAfterDelayCoroutine(ms, myVersion));