From 52d7643d8a5f133232a9d25c09399f283321f6aa Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期三, 31 十二月 2025 12:17:49 +0800
Subject: [PATCH] 125 战斗 战斗表现层级调整
---
Main/System/Battle/BattleConst.cs | 130 +++++++++++++-------------------
Main/System/Battle/BattleField/BattleRootNode.cs | 4
Main/System/Battle/Skill/SkillBase.cs | 2
Main/System/Battle/Buff/BattleObjectBuffMgr.cs | 2
Main/Component/UI/Effect/BattleEffectPlayer.cs | 20 ++++
Main/System/Battle/BattleObject/BattleObjectLayerMgr.cs | 26 +++++-
6 files changed, 94 insertions(+), 90 deletions(-)
diff --git a/Main/Component/UI/Effect/BattleEffectPlayer.cs b/Main/Component/UI/Effect/BattleEffectPlayer.cs
index 5c89ea8..4313a8f 100644
--- a/Main/Component/UI/Effect/BattleEffectPlayer.cs
+++ b/Main/Component/UI/Effect/BattleEffectPlayer.cs
@@ -228,9 +228,14 @@
bool isHeroFront = funcIsHeroFront();
- int finalSortingOrder = isHeroFront ?
- (isEffectFront ? BattleConst.ActiveHeroActionSortingOrder + 1 : BattleConst.ActiveHeroBackSortingOrder) : (isEffectFront ? BattleConst.UnactiveHeroFrontSortingOrder : BattleConst.UnactiveHeroBackSortingOrder);
+ int baseSortingOrder = isHeroFront ? BattleConst.SkillMaskOrder : BattleConst.BattleBackgroundOrder - BattleConst.BattleFrontHeroEffect - 1;
+ // 鍖哄垎鏄惁鍦ㄧ壒鏁堝墠闈� 杩樿鍐嶅尯鍒嗘槸鍚﹀湪UI鍓嶉潰 isBindBone
+ int dynamicOffset = isBindBone
+ ? BattleConst.BattleFrontHeroBehindUIEffect : (isEffectFront ? BattleConst.BattleFrontHeroEffect : BattleConst.BattleBehindHeroEffect);
+
+ int finalSortingOrder = baseSortingOrder + dynamicOffset;
+
blocker.SetSortingOrder(finalSortingOrder);
}
@@ -677,8 +682,15 @@
}
}
- public void BindBone(SkeletonAnimation skeletonAnim, string v)
+ public void BindBone(BattleObject battleObject, string v)
{
+ if (battleObject == null || battleObject.motionBase == null || battleObject.motionBase.skeletonAnim == null)
+ {
+ return;
+ }
+
+ var skeletonAnim = battleObject.motionBase.skeletonAnim;
+
Bone bone = skeletonAnim.skeleton.FindBone(v);
isBindBone = false;
followedBone = null;
@@ -692,6 +704,8 @@
isBindBone = true;
followedBone = bone;
+ ApplySortingOrder();
+
BoneFollower boneFollower = gameObject.AddMissingComponent<BoneFollower>();
boneFollower.boneName = v;
boneFollower.skeletonRenderer = skeletonAnim;
diff --git a/Main/System/Battle/BattleConst.cs b/Main/System/Battle/BattleConst.cs
index e09e362..2bedae9 100644
--- a/Main/System/Battle/BattleConst.cs
+++ b/Main/System/Battle/BattleConst.cs
@@ -101,6 +101,33 @@
// 閲婃斁鎶�鑳借嫳闆�>鍙楀奖鍝嶈嫳闆�>姝e父UI>榛戣壊钂欑増>鏈彈褰卞搷鑻遍泟>搴曞浘
+ // ----------------------2025 12/30鏇存柊 start
+ // BattleBackground = -10
+ // BattleWinLayer 0
+
+ // {
+ // BehindHeroUI = 1 Offset -2
+ // BehindHeroEffect = 2 -1
+ // UnactiveHero = BattleBackground + BattleHero = 3 0
+ // FrontUIEffect = 4 1
+ // BattleHeroUI = 5 2
+ // FrontHeroEffect = 6 3
+ // }
+
+ // SkillMask = 10
+
+ // {
+ // BehindHeroUI = 1 Offset -2
+ // BehindHeroEffect = 2 -1
+ // ActiveHero = SkillMask + BattleHero = 3 0
+ // FrontUIEffect = 4 1
+ // BattleHeroUI = 5 2
+ // FrontHeroEffect = 6 3
+ // }
+
+ // BattleStartEffect = 30
+ // ----------------------2025 12/30鏇存柊 end
+
//閲婃斁鎶�鑳借嫳闆�>鍙楀奖鍝嶈嫳闆�>[姝e父UI]>榛戣壊钂欑増>鏈彈褰卞搷鑻遍泟>搴曞浘
public static int BattleWinSortingOrder
@@ -136,89 +163,38 @@
}
}
+
+ public static int BattleBehindCharUIOffset = 1; //瑙掕壊鍚庨潰鐨刄I 涓昏鏄槾褰�(澶勭悊)
+
+ public static int BattleBehindHeroEffect = 2; //瑙掕壊韬悗鐨勭壒鏁�(澶勭悊)
+
+ public static int BattleHeroOffset = 3; //瑙掕壊鏈韩鐨勫眰绾�(涓嶉渶澶勭悊)
+
+
+ public static int BattleActiveHeroOffset = 4;
+
+ public static int BattleFrontHeroBehindUIEffect = 5; //瑙掕壊韬墠鐨� 浣嗘槸UI鍚庨潰鐗规晥
+
+ public static int BattleFrontCharUIOffset = 6; //瑙掕壊韬墠鐨刄I
+
+ public static int BattleFrontHeroEffect = 7; //瑙掕壊韬墠鐨勭壒鏁�
+
+
+ public static int SkillMaskOrder
+ {
+ get
+ {
+ return BattleWinSortingOrder + 10;
+ }
+ }
+
+
// 閲婃斁鎶�鑳借嫳闆�>鍙楀奖鍝嶈嫳闆�>姝e父UI>榛戣壊钂欑増>鏈彈褰卞搷鑻遍泟>[搴曞浘]
public static int BattleBackgroundOrder
{
get
{
return BattleWinSortingOrder - 10;
- }
- }
-
- // 闈炴縺娲昏嫳闆勭殑鍚庣壒鏁�
- public static int UnactiveHeroBackSortingOrder
- {
- get
- {
- return BattleBackgroundOrder + 1;
- }
- }
-
-
- //閲婃斁鎶�鑳借嫳闆�>鍙楀奖鍝嶈嫳闆�>姝e父UI>榛戣壊钂欑増>[鏈彈褰卞搷鑻遍泟]>搴曞浘
- // 闈炴縺娲昏嫳闆勭殑灞傜骇
- public static int UnactiveHeroSortingOrder
- {
- get
- {
- return UnactiveHeroBackSortingOrder + 1;
- }
- }
-
- // 闈炴縺娲昏嫳闆勭殑鍓嶇壒鏁�
- public static int UnactiveHeroFrontSortingOrder
- {
- get
- {
- return UnactiveHeroSortingOrder + 1;
- }
- }
-
- //閲婃斁鎶�鑳借嫳闆�>鍙楀奖鍝嶈嫳闆�>姝e父UI>[榛戣壊钂欑増]>鏈彈褰卞搷鑻遍泟>搴曞浘
- // 榛戣壊钂欑増鐨勫眰绾�
- public static int BlockerSortingOrder
- {
- get
- {
- return UnactiveHeroFrontSortingOrder + 1;
- }
- }
-
- // 婵�娲昏嫳闆勭殑鍚庣壒鏁�
- public static int ActiveHeroBackSortingOrder
- {
- get
- {
- return BlockerSortingOrder + 1;
- }
- }
-
- //閲婃斁鎶�鑳借嫳闆�>[鍙楀奖鍝嶈嫳闆刔>姝e父UI>榛戣壊钂欑増>鏈彈褰卞搷鑻遍泟>搴曞浘
- // 婵�娲昏嫳闆勭殑灞傜骇
- public static int ActiveHeroSortingOrder
- {
- get
- {
- return ActiveHeroBackSortingOrder + 1;
- }
- }
-
- //[閲婃斁鎶�鑳借嫳闆刔>鍙楀奖鍝嶈嫳闆�>姝e父UI>榛戣壊钂欑増>鏈彈褰卞搷鑻遍泟>搴曞浘
- // 閲婃斁鎶�鑳介挓鐨勮嫳闆勫眰绾�
- public static int ActiveHeroActionSortingOrder
- {
- get
- {
- return ActiveHeroSortingOrder + 1;
- }
- }
-
- // 婵�娲昏嫳闆勭殑鍓嶇壒鏁�
- public static int ActiveHeroFrontSortingOrder
- {
- get
- {
- return ActiveHeroActionSortingOrder + 1;
}
}
diff --git a/Main/System/Battle/BattleField/BattleRootNode.cs b/Main/System/Battle/BattleField/BattleRootNode.cs
index 96c2ec1..2afded0 100644
--- a/Main/System/Battle/BattleField/BattleRootNode.cs
+++ b/Main/System/Battle/BattleField/BattleRootNode.cs
@@ -68,8 +68,8 @@
public void SetSortingOrder()
{
- skillMaskAdjuster.SetSortingOrder(BattleConst.BlockerSortingOrder);
- battleStartAdjuster.SetSortingOrder(BattleConst.BattleWinSortingOrder + 1);//鏈�楂樺眰
+ skillMaskAdjuster.SetSortingOrder(BattleConst.SkillMaskOrder);
+ battleStartAdjuster.SetSortingOrder(BattleConst.SkillMaskOrder + BattleConst.BattleFrontHeroEffect + 1);//鏈�楂樺眰
backgroundAdjuster.SetSortingOrder(BattleConst.BattleBackgroundOrder);//鏈�浣庡眰
}
diff --git a/Main/System/Battle/BattleObject/BattleObjectLayerMgr.cs b/Main/System/Battle/BattleObject/BattleObjectLayerMgr.cs
index 3a7d57f..8922617 100644
--- a/Main/System/Battle/BattleObject/BattleObjectLayerMgr.cs
+++ b/Main/System/Battle/BattleObject/BattleObjectLayerMgr.cs
@@ -5,7 +5,10 @@
{
public BattleObject battleObj;
- public RendererAdjuster rendererAdjuster;
+ // 瑙掕壊闃村奖 澶撮《鐨勮鏉″浗绫嶇瓑
+ public RendererAdjuster frontCharRendererAdjuster;
+
+ public RendererAdjuster behindCharRendererAdjuster;
private List<BattleEffectPlayer> effectPlayers = new List<BattleEffectPlayer>();
@@ -19,14 +22,24 @@
public void Init(BattleObject battleObj)
{
this.battleObj = battleObj;
- rendererAdjuster = battleObj.heroGo.AddMissingComponent<RendererAdjuster>();
+ frontCharRendererAdjuster = battleObj.heroGo.AddMissingComponent<RendererAdjuster>();
+ behindCharRendererAdjuster = battleObj.heroRectTrans.Find("Hero/Follower/BattleHeroInfoBar/BehindHero").gameObject.AddMissingComponent<RendererAdjuster>();
+
+
+ frontCharRendererAdjuster.canvasOffset = BattleConst.BattleFrontCharUIOffset;
+ behindCharRendererAdjuster.canvasOffset = BattleConst.BattleBehindCharUIOffset;
}
public void SetSortingOrder(int sortingOrder)
{
- if (rendererAdjuster != null)
+ if (frontCharRendererAdjuster != null)
{
- rendererAdjuster.SetSortingOrder(sortingOrder);
+ frontCharRendererAdjuster.SetSortingOrder(sortingOrder);
+ }
+
+ if (behindCharRendererAdjuster != null)
+ {
+ behindCharRendererAdjuster.SetSortingOrder(sortingOrder);
}
for (int i = 0; i < effectPlayers.Count; i++)
@@ -71,8 +84,9 @@
effectPlayers[i].SetActive(isFront);
}
// 绛栧垝瑕佸湪閲婃斁鎶�鑳界殑鏃跺�� 鍏朵粬瑙掕壊闅愯棌 杩欓噷鍦╞ack鐨勬椂鍊欏氨鐩存帴璁剧疆鎴�0 鍦ㄦ渶搴曚笅 鐪嬩笉鍒扮殑鍦版柟
- int order = isFront ? BattleConst.ActiveHeroSortingOrder : 0; //BattleConst.UnactiveHeroSortingOrder;
- SetSortingOrder(order);
+ int baseOrder = isFront ? BattleConst.SkillMaskOrder : BattleConst.BattleBackgroundOrder;
+
+ SetSortingOrder(baseOrder);
}
public bool IsFront()
diff --git a/Main/System/Battle/Buff/BattleObjectBuffMgr.cs b/Main/System/Battle/Buff/BattleObjectBuffMgr.cs
index 4fb482a..e2a771b 100644
--- a/Main/System/Battle/Buff/BattleObjectBuffMgr.cs
+++ b/Main/System/Battle/Buff/BattleObjectBuffMgr.cs
@@ -284,7 +284,7 @@
BattleEffectPlayer effect = battleObject.battleField.battleEffectMgr
.PlayEffect(battleObject, skillConfig.BuffEffect, battleObject.heroRectTrans, battleObject.Camp, battleObject.teamHero.modelScale);
- effect.BindBone(battleObject.motionBase.skeletonAnim, effect.effectConfig.nodeName);
+ effect.BindBone(battleObject, effect.effectConfig.nodeName);
var buffIdSet = new HashSet<uint> { buffRefresh.BuffID };
buffEffectDict.Add(
diff --git a/Main/System/Battle/Skill/SkillBase.cs b/Main/System/Battle/Skill/SkillBase.cs
index e0d8e94..056b849 100644
--- a/Main/System/Battle/Skill/SkillBase.cs
+++ b/Main/System/Battle/Skill/SkillBase.cs
@@ -536,7 +536,7 @@
// 楂樹寒鎵�鏈夌浉鍏崇洰鏍囷細璁剧疆鏂芥硶鑰呭拰鐩爣鐨勬樉绀哄眰绾�
protected void HighLightAllTargets()
{
- caster.layerMgr.SetSortingOrder(BattleConst.ActiveHeroActionSortingOrder);
+ caster.layerMgr.SetSortingOrder(BattleConst.SkillMaskOrder + BattleConst.BattleActiveHeroOffset);
if (skillConfig.FuncType != 2)
return;
--
Gitblit v1.8.0