From f1e6527fd1a9281e254c000e21afb96c2da92e1c Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期三, 29 十月 2025 16:26:48 +0800
Subject: [PATCH] 125 战斗 追击反击连击效果 飘字效果更新
---
Main/System/Battle/UIComp/BattleTips.cs | 63 ++++++++++++++++++++++++++++---
1 files changed, 56 insertions(+), 7 deletions(-)
diff --git a/Main/System/Battle/UIComp/BattleTips.cs b/Main/System/Battle/UIComp/BattleTips.cs
index 1243441..dfaff7c 100644
--- a/Main/System/Battle/UIComp/BattleTips.cs
+++ b/Main/System/Battle/UIComp/BattleTips.cs
@@ -1,4 +1,3 @@
-
using UnityEngine;
using System;
using UnityEngine.UI;
@@ -6,9 +5,16 @@
public class BattleTips : MonoBehaviour
{
public Vector2 beginPos = Vector2.zero;
- public Vector2 endPos = new Vector2(0, 100);
- public float showTime = 0.4f;
+ public Vector2 endPos = new Vector2(0, 150);
+
+ public float scaleChangeTime = 0.2667f; // 7~8甯� (8/30=0.2667绉�)
+ public float totalShowTime = 0.8f; // 鎬绘椂闂寸害24甯� (8+16=24甯�)
public float timer = 0f;
+
+ public Vector3 beginScale = new Vector3(4f, 4f, 4f);
+ public Vector3 endScale = new Vector3(2f, 2f, 2f);
+ public Color beginColor = new Color(1f, 1f, 1f, 0.5f);
+ public Color endColor = new Color(1f, 1f, 1f, 1f);
public RectTransform rectTransform;
@@ -18,21 +24,37 @@
public Action OnFinish;
+ private float speedRatio = 1f;
+
+ public void SetSpeedRatio(float ratio)
+ {
+ speedRatio = ratio;
+ }
+
public void SetText(string text, bool useArtText = false)
{
- rectTransform.anchoredPosition = Vector2.zero;
+ // 鍒濆鏀惧ぇ200% 閫忔槑搴�50% 7~8甯у唴缂╁洖100% 閫忔槑搴﹀埌100% 鍐嶅線涓婇14~16甯� 鐒跺悗娑堝け 锛�30甯�/绉�)
+
+ // 8+16/30=0.8绉�
+
+
+ rectTransform.anchoredPosition = beginPos;
+ rectTransform.localScale = beginScale;
+
timer = 0f;
gameObject.SetActive(true);
if (useArtText)
{
artText.text = text;
+ artText.color = beginColor;
tipText.gameObject.SetActive(false);
artText.gameObject.SetActive(true);
}
else
{
tipText.text = text;
+ tipText.color = beginColor;
artText.gameObject.SetActive(false);
tipText.gameObject.SetActive(true);
}
@@ -45,14 +67,41 @@
if (!gameObject.activeSelf)
return;
- if (timer >= showTime)
+ if (timer >= totalShowTime)
{
+ gameObject.SetActive(false);
OnFinish?.Invoke();
OnFinish = null;
return;
}
- rectTransform.anchoredPosition = Vector2.Lerp(beginPos, endPos, timer / showTime);
- timer += Time.deltaTime;
+ // 鏁翠釜杩囩▼閮藉線涓婇
+ float moveProgress = timer / totalShowTime;
+ rectTransform.anchoredPosition = Vector2.Lerp(beginPos, endPos, moveProgress);
+
+ // 闃舵1: 7~8甯у唴缂╂斁浠巄eginScale鍒癳ndScale锛岄�忔槑搴︿粠50%鍒�100%
+ if (timer < scaleChangeTime)
+ {
+ float scaleProgress = timer / scaleChangeTime;
+ rectTransform.localScale = Vector3.Lerp(beginScale, endScale, scaleProgress);
+
+ Color currentColor = Color.Lerp(beginColor, endColor, scaleProgress);
+ if (tipText.gameObject.activeSelf)
+ tipText.color = currentColor;
+ if (artText.gameObject.activeSelf)
+ artText.color = currentColor;
+ }
+ // 闃舵2: 缂╂斁瀹屾垚鍚庯紝淇濇寔endScale鍜�100%閫忔槑搴︼紝缁х画寰�涓婇
+ else
+ {
+ rectTransform.localScale = endScale;
+
+ if (tipText.gameObject.activeSelf)
+ tipText.color = endColor;
+ if (artText.gameObject.activeSelf)
+ artText.color = endColor;
+ }
+
+ timer += 1f / (float)BattleConst.skillMotionFps * speedRatio;
}
}
\ No newline at end of file
--
Gitblit v1.8.0