From fd28aac1d869fee3f5f3ad8b7bbdec579fdf91c0 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期四, 09 十月 2025 17:05:54 +0800
Subject: [PATCH] 257 子 【配套功能】新手引导 / 【常规】引导 - 修复和推送功能同时打开问题
---
Main/System/Battle/Skill/SkillBase.cs | 131 ++++++++++++++++++++++++++++++++++++-------
1 files changed, 108 insertions(+), 23 deletions(-)
diff --git a/Main/System/Battle/Skill/SkillBase.cs b/Main/System/Battle/Skill/SkillBase.cs
index d73efa0..a10eec9 100644
--- a/Main/System/Battle/Skill/SkillBase.cs
+++ b/Main/System/Battle/Skill/SkillBase.cs
@@ -1,9 +1,9 @@
using System.Collections.Generic;
using UnityEngine;
-using System;
using DG.Tweening;
using Spine;
using System.Linq;
+using System;
public class SkillBase
@@ -14,7 +14,7 @@
protected HB427_tagSCUseSkill tagUseSkillAttack;
- protected SkillConfig skillConfig;
+ public SkillConfig skillConfig;
protected bool isFinished = false;
@@ -36,21 +36,26 @@
public int fromSkillId;
+ public bool isPlay = false;
+
public SkillBase(BattleObject _caster, SkillConfig _skillCfg, HB427_tagSCUseSkill vNetData, List<GameNetPackBasic> _packList, BattleField _battleField = null)
{
caster = _caster;
+ if (null == caster)
+ {
+ throw new Exception("SkillBase caster is null ");
+ }
skillConfig = _skillCfg;
tagUseSkillAttack = vNetData;
battleField = _battleField;
packList = _packList;
-
+ // Debug.LogError("start a skill id " + skillConfig.SkillID + " caster " + caster.teamHero.heroId + " pos " + caster.teamHero.positionNum + " camp " + caster.Camp);
}
public virtual void Run()
{
-
if (null != skillEffect)
{
if (skillEffect.IsFinished())
@@ -62,6 +67,7 @@
{
skillEffect.Run();
}
+ return;
}
if (otherSkillAction != null)
@@ -73,8 +79,12 @@
}
else
{
- otherSkillAction.Run();
+ if (moveFinished)
+ {
+ otherSkillAction.Run();
+ }
}
+ return;
}
}
@@ -82,7 +92,10 @@
// 1路绉诲姩鍒拌窛绂婚樀瀹逛綅缃畁鐮佺殑璺濈锛堝2鍙蜂綅锛�5鍙蜂綅锛夐噴鏀撅紙鍗虫垬鍦轰腑澶绫伙級
public virtual void Cast()
{
- EventBroadcast.Instance.Broadcast<string, SkillConfig, TeamHero>(EventName.BATTLE_CAST_SKILL, battleField.guid, skillConfig, caster.teamHero);
+ // Debug.LogError("Cast skill " + skillConfig.SkillID + " cast position " + skillConfig.CastPosition + " cast mode " + skillConfig.castMode);
+ string guid = battleField.guid;
+ TeamHero teamHero = caster.teamHero;
+ EventBroadcast.Instance.Broadcast<string, SkillConfig, TeamHero>(EventName.BATTLE_CAST_SKILL, guid, skillConfig, teamHero);
// 楂樹寒鎵�鏈夋湰娆℃妧鑳界浉鍏崇殑鐩爣
HighLightAllTargets();
@@ -153,6 +166,8 @@
_onComplete?.Invoke();
}, speed);
battleField.battleTweenMgr.OnPlayTween(tweener);
+
+ // Debug.LogError("move to tarrget " + target.name + " offset " + offset + " speed " + speed + " time " + tweener.Duration());
}
protected void TurnBack(Action _onComplete, float forward)
@@ -235,6 +250,16 @@
protected virtual void OnAllAttackMoveFinished()
{
moveFinished = true;
+ List<BattleObject> allList = battleField.battleObjMgr.allBattleObjDict.Values.ToList<BattleObject>();
+ for (int i = 0; i < allList.Count; i++)
+ {
+ BattleObject bo = allList[i];
+ bo.layerMgr.SetFront();
+ // bo.heroRectTrans.SetParent(battleField.GetTeamNode(bo.Camp, bo.teamHero.positionNum), true);
+ bo.heroInfoBar.SetActive(true);
+ }
+ battleField.battleRootNode.skillMaskNode.SetActive(false);
+ // Debug.LogError("OnAllAttackMoveFinished skill " + skillConfig.SkillID + " cast position " + skillConfig.CastPosition + " cast mode " + skillConfig.castMode);
}
protected void CastToAllies()
@@ -283,6 +308,7 @@
// OnMiddleFrameEnd 涓憞缁撴潫
// OnFinalFrameStart 鍚庢憞寮�濮�
// OnFinalFrameEnd 鍚庢憞缁撴潫
+
return caster.motionBase.PlaySkillAnimation(skillConfig, this, onComplete);
}
@@ -296,6 +322,8 @@
);
skillEffect.Play(OnHitTargets);
+ isPlay = true;
+
}
// 鎶�鑳藉墠鎽囧抚缁撴潫
@@ -341,6 +369,8 @@
protected void HighLightAllTargets()
{
+ caster.layerMgr.SetSortingOrder(BattleConst.ActiveHeroActionSortingOrder);
+
if (skillConfig.FuncType != 2)
return;
@@ -353,6 +383,8 @@
caster.heroInfoBar.SetActive(false);
+
+
for (int i = 0; i < allList.Count; i++)
{
BattleObject bo = allList[i];
@@ -360,12 +392,12 @@
{
bo.layerMgr.SetFront();
bo.heroInfoBar.SetActive(true);
- bo.heroRectTrans.SetParent(battleField.battleRootNode.skillFrontNode, true);
+ // bo.heroRectTrans.SetParent(battleField.battleRootNode.skillFrontNode, true);
}
else
{
bo.layerMgr.SetBack();
- bo.heroRectTrans.SetParent(battleField.battleRootNode.skillBackNode, true);
+ // bo.heroRectTrans.SetParent(battleField.battleRootNode.skillBackNode, true);
}
if (targetList.Contains(bo))
@@ -378,10 +410,9 @@
}
}
- caster.layerMgr.SetSortingOrder(BattleConst.ActiveHeroActionSortingOrder);
battleField.battleRootNode.skillMaskNode.SetActive(true);
-
+ battleField.battleRootNode.SetSortingOrder();
// caster.battleField.skillMask
// 鎶婅繖浜汢O鍏ㄩ珮浜� 鎴栬�呰鎶婇櫎浜嗚繖浜涚殑閮芥斁鍦ㄩ伄缃╁悗闈�
// YYL TODO
@@ -411,6 +442,7 @@
{
// 浼ゅ鍒嗗竷 (涓囧垎姣�)
// Debug.LogError("skillConfig.DamageDivide.Count " + skillConfig.DamageDivide.Length + " _hitIndex " + _hitIndex);
+ bool isLastHit = _hitIndex >= skillConfig.DamageDivide.Length - 1;
int[] damageDivide = skillConfig.DamageDivide[_hitIndex];
long totalDamage = GeneralDefine.GetFactValue(hurt.HurtHP, hurt.HurtHPEx);
@@ -428,7 +460,12 @@
// TODO YYL AttackTypes 瑕佽〃鐜版垚浠�涔堟牱鍛紵 鏀寔澶氱绫诲瀷骞跺瓨锛屽鏃犺闃插尽涓旀毚鍑诲悓鏃惰鏍兼尅锛屼簩杩涘埗鎴栬繍绠楁渶缁堝�硷紱0-澶辫触锛�1-鏅�氾紱2-鍥炶锛�5-鏍兼尅锛�6-鏃犺闃插尽锛�7-鏆村嚮锛�9-闂伩
- target.Hurt(damageList, totalDamage, hurt, skillConfig);
+
+ List<HB422_tagMCTurnFightObjDead> deadPacks = BattleUtility.FindDeadPack(packList);
+ bool isTargetDead = deadPacks.Exists(p => p.ObjID == target.ObjID);
+
+ bool playAnimation = !(isLastHit && isTargetDead);
+ target.Hurt(damageList, totalDamage, hurt, skillConfig, playAnimation);
// TODO YYL 杩欓噷鏄鍋氱粺涓�璁$畻鍚庡啀hurt璺焥uckhp杩樻槸鎬庢牱
caster.SuckHp(hurt.SuckHP, skillConfig);// 鍚歌
@@ -598,11 +635,22 @@
}
public virtual bool IsFinished()
{
+ if (!isPlay)
+ {
+ return false;
+ }
+
if (skillEffect != null)
{
if (!skillEffect.IsFinished())
{
return false;
+ }
+ else
+ {
+ skillEffect = null;
+ OnSkillFinished();
+ return false;
}
}
@@ -612,19 +660,22 @@
{
return false;
}
+ else
+ {
+ otherSkillAction = null;
+ OnSkillFinished();
+ return false;
+ }
}
+
if (isFinished && moveFinished)
{
- List<BattleObject> allList = battleField.battleObjMgr.allBattleObjDict.Values.ToList<BattleObject>();
- for (int i = 0; i < allList.Count; i++)
+ if (packList.Count > 0)
{
- BattleObject bo = allList[i];
- bo.layerMgr.SetFront();
- bo.heroRectTrans.SetParent(battleField.GetTeamNode(bo.Camp, bo.teamHero.positionNum), true);
- bo.heroInfoBar.SetActive(true);
+ OnSkillFinished();
+ return false;
}
- battleField.battleRootNode.skillMaskNode.SetActive(false);
return true;
}
@@ -637,26 +688,35 @@
public virtual void ForceFinished()
{
skillEffect?.ForceFinished();
+ if (otherSkillAction != null)
+ {
+ otherSkillAction.ForceFinish();
+ otherSkillAction = null;
+ }
+ HandleDead();
isFinished = true;
moveFinished = true;
+ isPlay = true;
while (packList.Count > 0)
{
var pack = packList[0];
packList.RemoveAt(0);
- if (pack is CustomHB426CombinePack)
+ if (pack is CustomHB426CombinePack combinePack)
{
- var combinePack = pack as CustomHB426CombinePack;
if (combinePack.startTag.Tag.StartsWith("Skill_"))
{
- BattleDebug.LogError("other skill casting " + combinePack.startTag.Tag);
otherSkillAction = combinePack.CreateSkillAction();
-
+ otherSkillAction.fromSkillId = skillConfig.SkillID;
// 寮哄埗缁撴潫鍏朵粬鎶�鑳�
otherSkillAction.ForceFinish();
- return;
+ continue;
}
+ }
+ else if (pack is CustomB421ActionPack actionPack)
+ {
+ actionPack.Distribute();
}
PackageRegedit.Distribute(pack);
}
@@ -669,6 +729,25 @@
if (!skillEffect.IsFinished())
{
return;
+ }
+ else
+ {
+ skillEffect = null;
+ OnSkillFinished();
+ }
+
+ }
+
+ if (otherSkillAction != null)
+ {
+ if (!otherSkillAction.IsFinished())
+ {
+ return;
+ }
+ else
+ {
+ otherSkillAction = null;
+ OnSkillFinished();
}
}
@@ -688,6 +767,12 @@
return;
}
}
+ else if (pack is CustomB421ActionPack actionPack)
+ {
+ actionPack.Distribute();
+ }
+
+ // Debug.LogError("Distribute pack " + pack.GetType().ToString());
PackageRegedit.Distribute(pack);
}
--
Gitblit v1.8.0