yyl
2025-09-04 cdf7098c937c5f4a70383ef70897bf9fedbb3d99
Main/System/Battle/UIComp/DamageContent.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
using System;
using Cysharp.Threading.Tasks;
public class DamageContent : MonoBehaviour
{
@@ -13,14 +14,33 @@
   public PositionTween posTween;
   public ScaleTween scaleTween;
   private BattleDmgInfo battleDmgInfo;
   void Awake()
   {
      line.SetActive(false);
   }
   public void SetDamage(BattleDmgInfo damageInfo, Action _onComplete)
   public async void SetDamage(BattleDmgInfo _damageInfo, Action _onComplete)
   {
      var damages = damageInfo.damageList;
      battleDmgInfo = _damageInfo;
      var damages = battleDmgInfo.battleDamageList;
      for (int i = damages.Count; i < damageLineList.Count; i++)
      {
         damageLineList[i].SetActive(false);
      }
      posTween.Play(_onComplete);
      if (battleDmgInfo.IsCrit())
      {
         scaleTween.Play();
      }
      for (int i = 0; i < damages.Count; i++)
      {
         if (i >= damageLineList.Count)
@@ -29,24 +49,26 @@
            damageLineList.Add(newLine.GetComponent<DamageLine>());
         }
         damageLineList[i].SetActive(true);
         damageLineList[i].SetDamage(damageInfo.attackType, damages[i]);
         damageLineList[i].SetDamage(damages[i]);
         await UniTask.Delay(100);
      }
      for (int i = damages.Count; i < damageLineList.Count; i++)
      {
         damageLineList[i].SetActive(false);
      }
      posTween.Play(_onComplete);
   }
   public void Stop()
   {
      posTween.Stop();
      if (battleDmgInfo.IsCrit())
      {
         scaleTween.Stop();
      }
   }
   public void Resume()
   {
      posTween.Resume();
      if (battleDmgInfo.IsCrit())
      {
         scaleTween.Resume();
      }
   }
}