From 440e8a4e3febfc1d98f11da2fbd7eaf75c12e877 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期三, 22 十月 2025 15:04:17 +0800
Subject: [PATCH] 125 战斗 细节调整
---
Main/System/Battle/UIComp/TotalDamageDisplayer.cs | 83 +++++++----------------------------------
1 files changed, 14 insertions(+), 69 deletions(-)
diff --git a/Main/System/Battle/UIComp/TotalDamageDisplayer.cs b/Main/System/Battle/UIComp/TotalDamageDisplayer.cs
index 6ddafbc..3dc89fe 100644
--- a/Main/System/Battle/UIComp/TotalDamageDisplayer.cs
+++ b/Main/System/Battle/UIComp/TotalDamageDisplayer.cs
@@ -8,12 +8,7 @@
{
public Image damageBackground;
public Text textDamage;
- public Text textTotalDesc; //鎬讳激瀹虫垨鑰呮�绘不鐤�
-
- public UniTask task = default;
-
- private Coroutine hideCoroutine;
- private int hideVersion = 0;
+ public Image imgTotalDesc; //鎬讳激瀹虫垨鑰呮�绘不鐤�
private long damage = 0;
@@ -21,8 +16,7 @@
public void SetDamage(BattleDmgInfo dmgInfo)
{
- // 鍏堢粺涓�鍋滄骞舵竻鐞嗘鍓嶇殑闅愯棌鍗忕▼锛堝鏋滄湁锛�
- ClearHideCoroutine();
+ var battleField = BattleManager.Instance.GetBattleField(dmgInfo.battleFieldGuid);
if (!gameObject.activeInHierarchy)
gameObject.SetActive(true);
@@ -38,7 +32,8 @@
heal += h;
}
textDamage.text = BattleUtility.DisplayDamageNum(heal, BattleConst.BattleTotalRecoverType);
- textTotalDesc.text = "鎬绘不鐤�";
+ damageBackground.sprite = UILoader.LoadSprite("Fight", "Fight1_img_83");
+ imgTotalDesc.sprite = UILoader.LoadSprite("Fight", "Fight1_img_80");
}
else if (dmgInfo.IsType(DamageType.Damage) || dmgInfo.IsType(DamageType.Realdamage))
{
@@ -48,72 +43,22 @@
damage += d;
}
textDamage.text = BattleUtility.DisplayDamageNum(damage, BattleConst.BattleTotalDamageType);
- textTotalDesc.text = "鎬讳激瀹�";
+ imgTotalDesc.sprite = UILoader.LoadSprite("Fight", "Fight1_img_85");
+ damageBackground.sprite = UILoader.LoadSprite("Fight", "Fight1_img_88");
}
- textDamage.transform.DOPunchScale(Vector3.one * 0.2f, 0.2f, 1).OnComplete(() =>
+ var tween = textDamage.transform.DOPunchScale(Vector3.one * 0.2f, 0.8f / battleField.speedRatio, 1).OnComplete(() =>
{
textDamage.transform.localScale = Vector3.one;
+ if (dmgInfo.isLastHit)
+ {
+ gameObject.SetActive(false);
+ damage = 0;
+ heal = 0;
+ }
});
- if (dmgInfo.isLastHit)
- {
- // 鍚姩鏂扮殑闅愯棌鍗忕▼锛屽厛鐢熸垚鏂扮殑鐗堟湰鍙蜂互鐢ㄤ簬鍗忕▼鏈夋晥鎬ф牎楠�
- hideVersion++;
- int myVersion = hideVersion;
+ battleField.battleTweenMgr.OnPlayTween(tween);
- damage = 0;
- heal = 0;
-
- var battleField = BattleManager.Instance.GetBattleField(dmgInfo.battleFieldGuid);
-
- float ms = 500f / battleField.speedRatio;
-
- hideCoroutine = StartCoroutine(HideAfterDelayCoroutine(ms, myVersion));
-
- task = default;
- }
- }
-
- protected void OnDisable()
- {
- ClearHideCoroutine();
- hideVersion++;
- }
-
- protected void OnDestroy()
- {
- ClearHideCoroutine();
- hideVersion++;
- }
-
- public void CancelHide()
- {
- ClearHideCoroutine();
- hideVersion++;
- }
-
- private void ClearHideCoroutine()
- {
- if (hideCoroutine != null)
- {
- try { StopCoroutine(hideCoroutine); } catch { }
- hideCoroutine = null;
- }
- }
-
- private IEnumerator HideAfterDelayCoroutine(float secondsDelay, int version = 0)
- {
- yield return new WaitForSeconds(secondsDelay);
-
- if (version != 0 && version != hideVersion)
- yield break;
-
- if (this == null) yield break;
- if (gameObject != null)
- gameObject.SetActive(false);
-
- if (hideCoroutine != null)
- hideCoroutine = null;
}
}
--
Gitblit v1.8.0