This commit is contained in:
2026-10-08 07:57:37 +08:00
parent 3940299dbd
commit 95dbc287db
3 changed files with 121 additions and 46 deletions
@@ -32,9 +32,9 @@ RectTransform:
m_Children: [] m_Children: []
m_Father: {fileID: 224064349272752296} m_Father: {fileID: 224064349272752296}
m_LocalEulerAnglesHint: {x: 0, y: -0, z: -0} m_LocalEulerAnglesHint: {x: 0, y: -0, z: -0}
m_AnchorMin: {x: 0.5, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0.5, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 80, y: 66.5} m_AnchoredPosition: {x: 314, y: 66.5}
m_SizeDelta: {x: 230, y: 133} m_SizeDelta: {x: 230, y: 133}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &222953972021046440 --- !u!222 &222953972021046440
@@ -107,9 +107,9 @@ RectTransform:
m_Children: [] m_Children: []
m_Father: {fileID: 224064349272752296} m_Father: {fileID: 224064349272752296}
m_LocalEulerAnglesHint: {x: 0, y: -0, z: -0} m_LocalEulerAnglesHint: {x: 0, y: -0, z: -0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 234, y: 166}
m_SizeDelta: {x: 468, y: 332} m_SizeDelta: {x: 468, y: 332}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &222774089246940628 --- !u!222 &222774089246940628
@@ -198,7 +198,7 @@ Canvas:
m_GameObject: {fileID: 1507404544299976} m_GameObject: {fileID: 1507404544299976}
m_Enabled: 1 m_Enabled: 1
serializedVersion: 3 serializedVersion: 3
m_RenderMode: 2 m_RenderMode: 0
m_Camera: {fileID: 0} m_Camera: {fileID: 0}
m_PlaneDistance: 100 m_PlaneDistance: 100
m_PixelPerfect: 0 m_PixelPerfect: 0
@@ -244,9 +244,9 @@ RectTransform:
m_Children: [] m_Children: []
m_Father: {fileID: 224064349272752296} m_Father: {fileID: 224064349272752296}
m_LocalEulerAnglesHint: {x: 0, y: -0, z: -0} m_LocalEulerAnglesHint: {x: 0, y: -0, z: -0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: -75, y: -21.5} m_AnchoredPosition: {x: 159, y: 144.5}
m_SizeDelta: {x: 313, y: 289} m_SizeDelta: {x: 313, y: 289}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &222588606521285762 --- !u!222 &222588606521285762
@@ -1,4 +1,5 @@
using Assets.MyGame.Scripts.Net.APIResponses.Enum; using Assets.MyGame.Scripts.Net.APIResponses.Enum;
using DG.Tweening;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System; using System;
using System.Collections; using System.Collections;
@@ -108,6 +109,12 @@ public class XingJiXunHangEvent : BJRedPacketEvent
public GameObject textCritSelf; public GameObject textCritSelf;
[Tooltip("满屏暴击-他人(PW_Effect_TextCrit_Other_XingJiXunHang)")] [Tooltip("满屏暴击-他人(PW_Effect_TextCrit_Other_XingJiXunHang)")]
public GameObject textCritOther; public GameObject textCritOther;
[Tooltip("暴击分数 TMP 所在子物体名(预制体里数字节点,默认 Text)")]
public string critTextNodeName = "Text";
[Tooltip("暴击图子物体名(预制体里\"暴击\"图,从 0 延时弹出,默认 Crit)")]
public string critNodeName = "Crit";
[Tooltip("暴击文字弹出后停留时长(秒),之后整体缩小消失(默认0.8)")]
public float critHoldDuration = 0.8f;
// ==================== 道具出场特效 ==================== // ==================== 道具出场特效 ====================
@@ -400,6 +407,7 @@ public class XingJiXunHangEvent : BJRedPacketEvent
/// <summary>根据武器 ID 选择对应的预制体和标签</summary> /// <summary>根据武器 ID 选择对应的预制体和标签</summary>
private void SelectWeaponPrefabs() private void SelectWeaponPrefabs()
{ {
_weaponId = 6;
switch (_weaponId) switch (_weaponId)
{ {
case 0: case 0:
@@ -1397,9 +1405,15 @@ public class XingJiXunHangEvent : BJRedPacketEvent
/// 自己看 TextCrit_Self,他人看 TextCrit_Other。 /// 自己看 TextCrit_Self,他人看 TextCrit_Other。
/// ///
/// ⭐ 文字内容:预制体里写死的是占位 '123',必须由代码写入「爆奖小鱼死亡累加的面板分」 /// ⭐ 文字内容:预制体里写死的是占位 '123',必须由代码写入「爆奖小鱼死亡累加的面板分」
/// (<see cref="_bossPanelScore"/>,与奖励框上滚动的分同一个值,封顶 maxScore)。 /// (<see cref="_bossPanelScore"/>,与奖励框上滚动的分同一个值,封顶 maxScore),前缀 "+"。
/// ⭐ 层级:克隆体根上挂着嵌套 Canvas,美术里是无效层ID + order 5, /// ⭐ 两个预制体都自带 Canvas(RenderMode=WorldSpace,美术里是无效层ID + order 5),
/// 会被 FullScreen 框(Default, order 12)压在下面 → 这里显式改成 Default + 更高 order。 /// 必须统一挂到游戏 UI 层、用 anchoredPosition 定位:
/// 自己 → 屏幕中心;他人 → 击杀者座位(座位世界坐标 → 画布坐标)。
/// (之前"他人"走 SpawnWorldEffect 挂到 bjEffectRoot(场景根、不在 Canvas 下),
/// 它的 WorldSpace 画布会按世界单位渲染 100×100 → 尺寸/位置全错。)
/// ⭐ 层级:预制体自带的是无效层ID + order 5,会被 FullScreen 框(Default, order 12)
/// 压在下面 → 这里显式改成 Default + 更高 order。
/// ⭐ 动画:对齐 lua CritTextEffect —— Text/Crit 从 0 弹出、停留后整体缩小消失并销毁。
/// </summary> /// </summary>
private void PlayTextCrit() private void PlayTextCrit()
{ {
@@ -1410,35 +1424,49 @@ public class XingJiXunHangEvent : BJRedPacketEvent
return; return;
} }
GameObject critObj; // ⭐ 自己/他人统一挂 UI 层(同一个渲染空间),位置:自己=屏幕中心,他人=击杀者座位
if (isSelf) GameObject critObj = SpawnUiEffect(critPrefab);
{
// ⭐ 满屏暴击文字是 UI → 放 UI 中心,加入统一销毁列表
critObj = SpawnUiEffect(critPrefab);
Debug.Log("[XingJiXunHang] 播放满屏暴击(自己,UI中心)");
}
else
{
Vector3 critPos = GetSeatPosition() + Vector3.up * 2f;
critObj = SpawnWorldEffect(critPrefab, critPos);
if (critObj != null)
critObj.transform.localScale = Vector3.one * 0.6f;
Debug.Log($"[XingJiXunHang] 播放满屏暴击(他人) pos={critPos}");
}
if (critObj == null) if (critObj == null)
{ {
Debug.LogWarning("[XingJiXunHang] 暴击文字生成失败,跳过分数写入"); Debug.LogWarning("[XingJiXunHang] 暴击文字生成失败,跳过分数写入");
return; return;
} }
// ⭐ 写入分数:爆奖过程中小鱼死亡累加的面板分(_bossPanelScore) if (isSelf)
// 该 TMP 的 spriteAsset 已配好「数字→图片」映射,直接赋数字即可 {
var critTmp = critObj.GetComponentInChildren<TMPro.TextMeshProUGUI>(true); Debug.Log("[XingJiXunHang] 播放满屏暴击(自己,UI中心)");
}
else
{
// ⭐ 他人:座位世界坐标 → 画布 anchoredPosition(与其它 UI 飘字同一套换算)
var critRt = critObj.GetComponent<RectTransform>();
EnsureUiLayer();
if (critRt != null && _uiCanvas != null)
{
Vector3 seatPos = GetSeatPosition() + Vector3.up * 2f;
critRt.anchoredPosition =
CoordinateTransformation.WorldPos_ToCanvas(seatPos, _uiCanvas);
Debug.Log($"[XingJiXunHang] 播放满屏暴击(他人,UI层) seat={seatPos} anchored={critRt.anchoredPosition}");
}
else
{
Debug.LogWarning("[XingJiXunHang] 播放满屏暴击(他人):Canvas 缺失,退回 UI 中心");
}
}
// ⭐ 取分数 TMP:优先按名字找数字节点(lua 也是按名字取 Text),回退第一个 TMP
Transform textNode = string.IsNullOrEmpty(critTextNodeName)
? null
: FindChildRecursive(critObj.transform, critTextNodeName);
var critTmp = textNode != null
? textNode.GetComponent<TMPro.TextMeshProUGUI>()
: critObj.GetComponentInChildren<TMPro.TextMeshProUGUI>(true);
if (critTmp != null) if (critTmp != null)
{ {
critTmp.text = _bossPanelScore.ToString(); // lua: "+" .. num(该 TMP 的 spriteAsset 已配好「数字→图片」映射)
Debug.Log($"[XingJiXunHang] 暴击文字分数 = {_bossPanelScore}(上限{maxScore})"); critTmp.text = "+" + _bossPanelScore;
Debug.Log($"[XingJiXunHang] 暴击文字分数 = +{_bossPanelScore}(上限{maxScore})");
if (_bossPanelScore <= 0) if (_bossPanelScore <= 0)
Debug.LogWarning("[XingJiXunHang] 暴击文字分数为 0:本次没有小鱼死亡累加(面板分仍为 0)"); Debug.LogWarning("[XingJiXunHang] 暴击文字分数为 0:本次没有小鱼死亡累加(面板分仍为 0)");
} }
@@ -1447,7 +1475,7 @@ public class XingJiXunHangEvent : BJRedPacketEvent
Debug.LogWarning($"[XingJiXunHang] 暴击文字 {critObj.name} 上没找到 TMP,分数未写入"); Debug.LogWarning($"[XingJiXunHang] 暴击文字 {critObj.name} 上没找到 TMP,分数未写入");
} }
// ⭐ 修层级:嵌套 Canvas → Default(0) + 高于 FullScreen(order 12), // ⭐ 修层级:预制体自带 Canvas → Default(0) + 高于 FullScreen(order 12),
// 否则暴击文字会被全屏特效框挡住(美术里的 -559336389 在本项目 TagManager 里不存在) // 否则暴击文字会被全屏特效框挡住(美术里的 -559336389 在本项目 TagManager 里不存在)
var critCanvas = critObj.GetComponent<Canvas>(); var critCanvas = critObj.GetComponent<Canvas>();
if (critCanvas == null) if (critCanvas == null)
@@ -1463,6 +1491,50 @@ public class XingJiXunHangEvent : BJRedPacketEvent
{ {
Debug.LogWarning($"[XingJiXunHang] 暴击文字 {critObj.name} 上没找到 Canvas,层级未修正"); Debug.LogWarning($"[XingJiXunHang] 暴击文字 {critObj.name} 上没找到 Canvas,层级未修正");
} }
// ⭐ 弹出动画 + 定时消失(原版有,之前完全没做 → 静止挂在屏幕中央直到爆奖结束)
PlayCritAnim(critObj, textNode);
}
/// <summary>
/// 暴击文字弹出动画(对齐 lua CritTextEffect):
/// Text / Crit 从 scale 0 弹回原始 scale(OutElastic,Crit 延时 0.15s)
/// → 停留 critHoldDuration 秒 → 整体缩小到 0 并销毁。
/// ⭐ 弹回目标用"原始 scale":预制体里 Text 带美术缩放(如 1.727),直接弹到 1 会变小。
/// </summary>
private void PlayCritAnim(GameObject critObj, Transform textNode)
{
if (critObj == null) return;
if (textNode != null)
{
Vector3 target = textNode.localScale;
textNode.localScale = Vector3.zero;
textNode.DOScale(target, 0.3f).SetEase(Ease.OutElastic);
}
Transform critNode = string.IsNullOrEmpty(critNodeName)
? null
: FindChildRecursive(critObj.transform, critNodeName);
if (critNode != null)
{
Vector3 target = critNode.localScale;
critNode.localScale = Vector3.zero;
critNode.DOScale(target, 0.2f).SetEase(Ease.OutElastic).SetDelay(0.15f);
}
critObj.transform.DOScale(Vector3.zero, 0.2f)
.SetEase(Ease.InBack)
.SetDelay(Mathf.Max(0f, critHoldDuration))
.OnComplete(() =>
{
if (critObj != null)
{
// 已自行销毁 → 从统一销毁列表移除,避免 die() 时重复 Destroy
_spawnedEffects.Remove(critObj);
Destroy(critObj);
}
});
} }
// ==================== 伽马风暴暴击框 ==================== // ==================== 伽马风暴暴击框 ====================
@@ -45,31 +45,31 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
bjEndUI: {fileID: -382508373279050920, guid: 75a52b8c1537cad49b3d521483fe134e, type: 3} bjEndUI: {fileID: -382508373279050920, guid: 75a52b8c1537cad49b3d521483fe134e, type: 3}
useScorePanel: 0 bjEndUIOffsetY: 150
tMP_Score: {fileID: 0}
scorePanelPrefab: {fileID: 0}
currScore: 0
maxScore: 0
scoreCount: 0
posID: 0 posID: 0
paoBei: 0 paoBei: 0
fishScore: 0 fishScore: 0
bJbeishu: 0 bJbeishu: 0
maxScore: 0
isSelf: 0
isScoreEnd: 0
useScorePanel: 0
tMP_Score: {fileID: 0}
scorePanelPrefab: {fileID: 0}
currScore: 0
scoreCount: 0
bigPrizeFishMode: 0
showDelay: 3 showDelay: 3
moveDuration: 0.5 moveDuration: 0.5
moveEase: 6 moveEase: 6
startOffset: {x: 0, y: 0, z: -100}
bjEndUIOffsetY: 150
coinFlyDuration: 0.5 coinFlyDuration: 0.5
coinArrivalInterval: 0.1 coinArrivalInterval: 0.1
showAddScoreFX: 1 showAddScoreFX: 1
isSelf: 0
autoFinishOnScoreFull: 1 autoFinishOnScoreFull: 1
totalBJCount: 0 totalBJCount: 0
currBJCount: 0 currBJCount: 0
isEffEnd: 0 isEffEnd: 0
isScoreStart: 0 isScoreStart: 0
isScoreEnd: 0
isGoldEffectStart: 0 isGoldEffectStart: 0
settleFuJiaTianXia: {fileID: 4220318943093749188, guid: 75a52b8c1537cad49b3d521483fe134e, settleFuJiaTianXia: {fileID: 4220318943093749188, guid: 75a52b8c1537cad49b3d521483fe134e,
type: 3} type: 3}
@@ -112,6 +112,9 @@ MonoBehaviour:
type: 3} type: 3}
textCritOther: {fileID: 5649031448262014505, guid: cf3fd14139494c118ebe448adaa39fe7, textCritOther: {fileID: 5649031448262014505, guid: cf3fd14139494c118ebe448adaa39fe7,
type: 3} type: 3}
critTextNodeName: Text
critNodeName: Crit
critHoldDuration: 0.8
appearPropEffect: {fileID: 1507404544299976, guid: aa6d30193550ca949a8a9098575de5e0, appearPropEffect: {fileID: 1507404544299976, guid: aa6d30193550ca949a8a9098575de5e0,
type: 3} type: 3}
tapTipName: tap_tip tapTipName: tap_tip
@@ -120,7 +123,7 @@ MonoBehaviour:
ironFistHoleName: Hole ironFistHoleName: Hole
ironFistHandName: Hand ironFistHandName: Hand
ironFistCornerOffset: {x: 15, y: 10, z: 0} ironFistCornerOffset: {x: 15, y: 10, z: 0}
ironFistHoldDelay: 0.5 ironFistHoldDelay: 1
ironFistKillRadius: 100 ironFistKillRadius: 100
ironFistKillLayer: ironFistKillLayer:
serializedVersion: 2 serializedVersion: 2