| | |
| | | HashSet<Type> configTypes = new HashSet<Type>() {
|
| | | typeof(ADAwardConfig),
|
| | | typeof(BattleMapConfig),
|
| | | typeof(ChestsAwardConfig),
|
| | | typeof(CTGConfig),
|
| | | typeof(DailyTaskConfig),
|
| | | typeof(DamageNumConfig),
|
| | | typeof(DirtyWordConfig),
|
| | | typeof(DungeonConfig),
|
| | | typeof(DungeonOpenTimeConfig),
|
| | | typeof(FaceConfig),
|
| | | typeof(FamilyDonateConfig),
|
| | | typeof(FightPowerRatioConfig),
|
| | | typeof(FirstChargeConfig),
|
| | |
| | | typeof(ItemConfig),
|
| | | typeof(LineupRecommendConfig),
|
| | | typeof(LLMJConfig),
|
| | | typeof(MainChapterConfig),
|
| | | typeof(MainLevelConfig),
|
| | | typeof(ModelConfig),
|
| | | typeof(NPCConfig),
|
| | | typeof(NPCExConfig),
|
| | | typeof(NPCLineupConfig),
|
| | | typeof(OrderInfoConfig),
|
| | | typeof(PlayerAttrConfig),
|
| | | typeof(PlayerFaceConfig),
|
| | | typeof(PriorBundleConfig),
|
| | | typeof(PlayerLVConfig),
|
| | | typeof(RandomNameConfig),
|
| | | typeof(SignInConfig),
|
| | | typeof(StoreConfig),
|
| | | typeof(SuccessConfig),
|
| | | typeof(SysInfoConfig),
|
| | | typeof(TianziConfig),
|
| | | typeof(TitleConfig),
|
| | | typeof(TitleStarUpConfig),
|
| | | typeof(TreasureSetConfig),
|
| | | typeof(TreeLVConfig),
|
| | | typeof(WindowSearchConfig),
|
| | | typeof(XBGetItemConfig),
|
| | | typeof(ZhanlingConfig)
|
| | | };
|
| | |
|
| | |
| | | ClearConfigDictionary<ADAwardConfig>();
|
| | | // 清空 BattleMapConfig 字典
|
| | | ClearConfigDictionary<BattleMapConfig>();
|
| | | // 清空 ChestsAwardConfig 字典
|
| | | ClearConfigDictionary<ChestsAwardConfig>();
|
| | | // 清空 CTGConfig 字典
|
| | | ClearConfigDictionary<CTGConfig>();
|
| | | // 清空 DailyTaskConfig 字典
|
| | | ClearConfigDictionary<DailyTaskConfig>();
|
| | | // 清空 DamageNumConfig 字典
|
| | | ClearConfigDictionary<DamageNumConfig>();
|
| | | // 清空 DirtyWordConfig 字典
|
| | | ClearConfigDictionary<DirtyWordConfig>();
|
| | | // 清空 DungeonConfig 字典
|
| | | ClearConfigDictionary<DungeonConfig>();
|
| | | // 清空 DungeonOpenTimeConfig 字典
|
| | | ClearConfigDictionary<DungeonOpenTimeConfig>();
|
| | | // 清空 FaceConfig 字典
|
| | | ClearConfigDictionary<FaceConfig>();
|
| | | // 清空 FamilyDonateConfig 字典
|
| | | ClearConfigDictionary<FamilyDonateConfig>();
|
| | | // 清空 FightPowerRatioConfig 字典
|
| | |
| | | ClearConfigDictionary<LineupRecommendConfig>();
|
| | | // 清空 LLMJConfig 字典
|
| | | ClearConfigDictionary<LLMJConfig>();
|
| | | // 清空 MainChapterConfig 字典
|
| | | ClearConfigDictionary<MainChapterConfig>();
|
| | | // 清空 MainLevelConfig 字典
|
| | | ClearConfigDictionary<MainLevelConfig>();
|
| | | // 清空 ModelConfig 字典
|
| | | ClearConfigDictionary<ModelConfig>();
|
| | | // 清空 NPCConfig 字典
|
| | | ClearConfigDictionary<NPCConfig>();
|
| | | // 清空 NPCExConfig 字典
|
| | | ClearConfigDictionary<NPCExConfig>();
|
| | | // 清空 NPCLineupConfig 字典
|
| | | ClearConfigDictionary<NPCLineupConfig>();
|
| | | // 清空 OrderInfoConfig 字典
|
| | | ClearConfigDictionary<OrderInfoConfig>();
|
| | | // 清空 PlayerAttrConfig 字典
|
| | | ClearConfigDictionary<PlayerAttrConfig>();
|
| | | // 清空 PlayerFaceConfig 字典
|
| | | ClearConfigDictionary<PlayerFaceConfig>();
|
| | | // 清空 PriorBundleConfig 字典
|
| | | ClearConfigDictionary<PriorBundleConfig>();
|
| | | // 清空 PlayerLVConfig 字典
|
| | | ClearConfigDictionary<PlayerLVConfig>();
|
| | | // 清空 RandomNameConfig 字典
|
| | | ClearConfigDictionary<RandomNameConfig>();
|
| | | // 清空 SignInConfig 字典
|
| | | ClearConfigDictionary<SignInConfig>();
|
| | | // 清空 StoreConfig 字典
|
| | | ClearConfigDictionary<StoreConfig>();
|
| | | // 清空 SuccessConfig 字典
|
| | | ClearConfigDictionary<SuccessConfig>();
|
| | | // 清空 SysInfoConfig 字典
|
| | | ClearConfigDictionary<SysInfoConfig>();
|
| | | // 清空 TianziConfig 字典
|
| | | ClearConfigDictionary<TianziConfig>();
|
| | | // 清空 TitleConfig 字典
|
| | | ClearConfigDictionary<TitleConfig>();
|
| | | // 清空 TitleStarUpConfig 字典
|
| | | ClearConfigDictionary<TitleStarUpConfig>();
|
| | | // 清空 TreasureSetConfig 字典
|
| | | ClearConfigDictionary<TreasureSetConfig>();
|
| | | // 清空 TreeLVConfig 字典
|
| | | ClearConfigDictionary<TreeLVConfig>();
|
| | | // 清空 WindowSearchConfig 字典
|
| | | ClearConfigDictionary<WindowSearchConfig>();
|
| | | // 清空 XBGetItemConfig 字典
|
| | | ClearConfigDictionary<XBGetItemConfig>();
|
| | | // 清空 ZhanlingConfig 字典
|
| | | ClearConfigDictionary<ZhanlingConfig>();
|
| | | }
|
| | |
| | | // 由技能去通知战场死亡 battleField.OnObjsDead(deadList) |
| | | #if UNITY_EDITOR |
| | | BattleDebug.LogError("编辑器下的死亡测试"); |
| | | battleField?.OnObjsDead(new List<HB422_tagMCTurnFightObjDead>(){vNetData}); |
| | | battleField?.OnObjsDead(new List<BattleDeadPack>(){ new BattleDeadPack(){ deadPack = vNetData}}); |
| | | #endif |
| | | if (!vNetPack.commonMark) |
| | | battleField?.DistributeNextPackage(); |
| | |
| | | using LitJson; |
| | | using DG.Tweening; |
| | | using System.IO; |
| | | using System.Linq; |
| | | |
| | | |
| | | public class BattleField |
| | |
| | | } |
| | | } |
| | | |
| | | public virtual void OnObjsDead(List<HB422_tagMCTurnFightObjDead> deadPackList) |
| | | public virtual void OnObjsDead(List<BattleDeadPack> deadPackList) |
| | | { |
| | | if (deadPackList.Count > 0) |
| | | { |
| | | // 过滤掉正在处理死亡的角色,避免重复处理 |
| | | List<HB422_tagMCTurnFightObjDead> validDeadList = new List<HB422_tagMCTurnFightObjDead>(); |
| | | List<BattleDeadPack> validDeadList = new List<BattleDeadPack>(); |
| | | |
| | | foreach (var deadPack in deadPackList) |
| | | { |
| | | var objID = deadPack.deadPack.ObjID; |
| | | // 检查是否已经在处理死亡 |
| | | if (processingDeathObjIds.Contains(deadPack.ObjID)) |
| | | if (processingDeathObjIds.Contains(objID)) |
| | | { |
| | | Debug.LogWarning($"OnObjsDead: 角色正在处理死亡,忽略重复死亡消息 ObjID={deadPack.ObjID}"); |
| | | Debug.LogWarning($"OnObjsDead: 角色正在处理死亡,忽略重复死亡消息 ObjID={objID}"); |
| | | continue; |
| | | } |
| | | |
| | | BattleObject battleObj = battleObjMgr.GetBattleObject((int)deadPack.ObjID); |
| | | BattleObject battleObj = battleObjMgr.GetBattleObject((int)objID); |
| | | if (battleObj == null) |
| | | { |
| | | Debug.LogWarning($"OnObjsDead: 找不到角色 ObjID={deadPack.ObjID}"); |
| | | Debug.LogWarning($"OnObjsDead: 找不到角色 ObjID={objID}"); |
| | | continue; |
| | | } |
| | | |
| | | // 添加到处理中列表 |
| | | processingDeathObjIds.Add(deadPack.ObjID); |
| | | processingDeathObjIds.Add(objID); |
| | | validDeadList.Add(deadPack); |
| | | // Debug.LogError("prepare death : " + deadPack.ObjID); |
| | | |
| | | |
| | | } |
| | | |
| | | // 只处理有效的死亡消息 |
| | |
| | | using UnityEngine; |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | using System; |
| | | |
| | | |
| | | // 如果这个Action卡住了 大概率是因为 动作被其他动作中断了 导致没有回调 |
| | | public class DeathRecordAction : RecordAction |
| | | { |
| | | protected List<HB422_tagMCTurnFightObjDead> deadPackList = new List<HB422_tagMCTurnFightObjDead>(); |
| | | protected List<BattleDeadPack> deadPackList = new List<BattleDeadPack>(); |
| | | |
| | | public DeathRecordAction(BattleField _battleField, List<HB422_tagMCTurnFightObjDead> _deadPackList) |
| | | protected Dictionary<BattleDeadPack, SkillRecordAction> deathActionDict = new Dictionary<BattleDeadPack, SkillRecordAction>(); |
| | | |
| | | protected Dictionary<BattleDeadPack, Func<bool>> deadActionStatesDict = new Dictionary<BattleDeadPack, Func<bool>>(); |
| | | |
| | | protected Dictionary<int, bool> dropStateDict = new Dictionary<int, bool>(); |
| | | |
| | | public DeathRecordAction(BattleField _battleField, List<BattleDeadPack> _deadPackList) |
| | | : base(RecordActionType.Death, _battleField, null) |
| | | { |
| | | deadPackList = _deadPackList; |
| | |
| | | |
| | | public override void Run() |
| | | { |
| | | // 该死的正常死 |
| | | // 有技能的则按照顺序播放死亡技能 后再正常死 |
| | | if (isFinish) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | base.Run(); |
| | | |
| | | if (!isRunOnce) |
| | | { |
| | | isRunOnce = true; |
| | | bool isLastOne = false; |
| | | int index = 0; |
| | | int total = deadPackList.Count; |
| | | |
| | | bool canFind = true; |
| | | |
| | | foreach (var deadPack in deadPackList) |
| | | foreach (var battleDeadPack in deadPackList) |
| | | { |
| | | BattleObject deadObj = battleField.battleObjMgr.GetBattleObject((int)deadPack.ObjID); |
| | | if (null != deadObj) |
| | | if (battleDeadPack.deadTriggerSkill != null) |
| | | { |
| | | if (deadObj.IsDead()) |
| | | var skillAction = battleDeadPack.deadTriggerSkill.CreateSkillAction(); |
| | | if (null != skillAction) |
| | | { |
| | | index++; |
| | | continue; |
| | | deathActionDict.Add(battleDeadPack, skillAction); |
| | | } |
| | | PerformDrop(deadObj); |
| | | // Debug.LogError("start death : " + deadObj.ObjID); |
| | | deadObj.OnDeath(() => |
| | | { |
| | | // Debug.LogError("death callback : " + deadObj.ObjID); |
| | | index++; |
| | | |
| | | isLastOne = index >= total; |
| | | |
| | | if (isLastOne) |
| | | { |
| | | // UniTaskExtension.DelayTime((GameObject)null, 0.3f / battleField.speedRatio, () => |
| | | // { |
| | | isFinish = true; |
| | | // }); |
| | | } |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | canFind = false; |
| | | deadActionStatesDict.Add(battleDeadPack, CreateDeadActionState(battleDeadPack)); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | List<BattleDeadPack> finishedKeys = new List<BattleDeadPack>(); |
| | | foreach (var kv in deathActionDict) |
| | | { |
| | | if (!kv.Key.isPlaySkill) |
| | | { |
| | | // battleField.recordPlayer.ImmediatelyPlay(kv.Value); |
| | | kv.Key.isPlaySkill = true; |
| | | } |
| | | |
| | | if (!kv.Value.IsFinished()) |
| | | { |
| | | kv.Value.Run(); |
| | | } |
| | | else |
| | | { |
| | | deadActionStatesDict.Add(kv.Key, CreateDeadActionState(kv.Key, true)); |
| | | finishedKeys.Add(kv.Key); |
| | | } |
| | | break; |
| | | } |
| | | |
| | | foreach (var key in finishedKeys) |
| | | { |
| | | deathActionDict.Remove(key); |
| | | } |
| | | |
| | | int completeNum = 0; |
| | | |
| | | foreach (var kv in deadActionStatesDict) |
| | | { |
| | | if (kv.Value()) |
| | | { |
| | | completeNum++; |
| | | } |
| | | } |
| | | |
| | | if (!canFind) |
| | | if (completeNum == deadPackList.Count) |
| | | { |
| | | isFinish = true; |
| | | } |
| | | } |
| | | } |
| | | |
| | | private Func<bool> CreateDeadActionState(BattleDeadPack deadPack, bool withoutAnime = false) |
| | | { |
| | | BattleObject deadObj = battleField.battleObjMgr.GetBattleObject((int)deadPack.deadPack.ObjID); |
| | | if (null == deadObj) |
| | | { |
| | | return () => true; |
| | | } |
| | | |
| | | PerformDrop(deadObj); |
| | | |
| | | bool isComplete = false; |
| | | |
| | | deadObj.OnDeath(() => { |
| | | isComplete = true; |
| | | }, withoutAnime); |
| | | |
| | | return () => isComplete; |
| | | } |
| | | |
| | | public override void ForceFinish() |
| | |
| | | // 直接结束 |
| | | foreach (var deadPack in deadPackList) |
| | | { |
| | | BattleObject deadObj = battleField.battleObjMgr.GetBattleObject((int)deadPack.ObjID); |
| | | BattleObject deadObj = battleField.battleObjMgr.GetBattleObject((int)deadPack.deadPack.ObjID); |
| | | if (null != deadObj) |
| | | { |
| | | PerformDrop(deadObj); |
| | |
| | | // 只有主线掉落物品 |
| | | if (battleField.MapID == 1 || battleField.MapID == 2) |
| | | { |
| | | if (dropStateDict.ContainsKey(deadObj.ObjID)) |
| | | { |
| | | return; |
| | | } |
| | | dropStateDict.Add(deadObj.ObjID, true); |
| | | deadObj.PerformDrop(); |
| | | } |
| | | } |
| New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections.Generic; |
| | | using System; |
| | | |
| | | |
| | | // 如果这个Action卡住了 大概率是因为 动作被其他动作中断了 导致没有回调 |
| | | public class RebornRecordAction : RecordAction |
| | | { |
| | | private Action actionCallback; |
| | | |
| | | public RebornRecordAction(BattleField _battleField, BattleObject rebornObj, Action _callback) |
| | | : base(RecordActionType.Reborn, _battleField, null) |
| | | { |
| | | actionCallback = _callback; |
| | | } |
| | | |
| | | |
| | | public override void Run() |
| | | { |
| | | |
| | | if (isFinish) |
| | | return; |
| | | |
| | | |
| | | if (!isRunOnce) |
| | | { |
| | | isRunOnce = true; |
| | | actionCallback?.Invoke(); |
| | | actionCallback = null; |
| | | isFinish = true; |
| | | } |
| | | } |
| | | |
| | | |
| | | public override void ForceFinish() |
| | | { |
| | | isFinish = true; |
| | | |
| | | if (!isRunOnce) |
| | | { |
| | | actionCallback?.Invoke(); |
| | | actionCallback = null; |
| | | } |
| | | |
| | | base.ForceFinish(); |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: f3b108ec07cfc874390fe314c3d33475 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | return skillBase.IsFinished(); |
| | | } |
| | | |
| | | public bool IsFinishedForJudge() |
| | | { |
| | | if (null == skillBase) |
| | | { |
| | | return true; |
| | | } |
| | | return skillBase.IsFinishedForJudge(); |
| | | } |
| | | |
| | | public override void ForceFinish() |
| | | { |
| | | // 设置结束flag 记得清空motionBase里的事件 |
| | |
| | | { |
| | | PushDropItems(battleHurtParam.battleDrops); |
| | | } |
| | | battleField.OnObjsDead(new List<HB422_tagMCTurnFightObjDead>() { battleHurtParam.deadPack }); |
| | | battleField.OnObjsDead(new List<BattleDeadPack>() { battleHurtParam.deadPack }); |
| | | |
| | | } |
| | | else |
| | |
| | | battleField.battleTweenMgr.OnPlayTween(tween); |
| | | } |
| | | |
| | | public virtual void OnDeath(Action _onDeathAnimationComplete) |
| | | public virtual void OnDeath(Action _onDeathAnimationComplete, bool withoutAnime = false) |
| | | { |
| | | buffMgr.RemoveAllBuff(); |
| | | battleField.soundManager.PlayEffectSound(teamHero.heroConfig.DeathSFX, false); |
| | | motionBase.PlayDeadAnimation(() => |
| | | if (withoutAnime) |
| | | { |
| | | SetDeath(); |
| | | _onDeathAnimationComplete?.Invoke(); |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | motionBase.PlayDeadAnimation(() => |
| | | { |
| | | SetDeath(); |
| | | _onDeathAnimationComplete?.Invoke(); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | public void SetDeath() |
| | |
| | | public void OnReborn(HB427_tagSCUseSkill.tagSCUseSkillHurt vNetData) |
| | | { |
| | | // 处理复活逻辑 |
| | | battleField.OnObjReborn((uint)ObjID); |
| | | RebornRecordAction recordAction = new RebornRecordAction(battleField, this, () => |
| | | { |
| | | battleField.OnObjReborn((uint)ObjID); |
| | | |
| | | teamHero.curHp = GeneralDefine.GetFactValue(vNetData.CurHP, vNetData.CurHPEx); |
| | | // Debug.LogError("OnReborn " + teamHero.curHp); |
| | | teamHero.isDead = false; |
| | | heroGo.SetActive(true); |
| | | motionBase.ResetForReborn(); |
| | | teamHero.curHp = GeneralDefine.GetFactValue(vNetData.CurHP, vNetData.CurHPEx); |
| | | heroRectTrans.anchoredPosition = Vector2.zero; |
| | | // Debug.LogError("OnReborn " + teamHero.curHp); |
| | | teamHero.isDead = false; |
| | | heroGo.SetActive(true); |
| | | motionBase.ResetForReborn(); |
| | | }); |
| | | battleField.recordPlayer.InsertRecord(recordAction); |
| | | } |
| | | |
| | | // 伤害还要看 是否闪避 暴击 and so on 需要有一个DamageType 服务器应该会给 |
| | |
| | | } |
| | | |
| | | public static BattleHurtParam CalcBattleHurtParam(SkillBase skillBase, int hitIndex, BattleObject target, |
| | | HB427_tagSCUseSkill.tagSCUseSkillHurt hurt, BattleDrops battleDrops, HB422_tagMCTurnFightObjDead deadPack) |
| | | HB427_tagSCUseSkill.tagSCUseSkillHurt hurt, BattleDrops battleDrops, BattleDeadPack deadPack) |
| | | { |
| | | long suckHp = GetSuckHp(skillBase.tagUseSkillAttack); |
| | | SkillConfig skillConfig = skillBase.skillConfig; |
| | |
| | | return null; |
| | | } |
| | | |
| | | public static List<HB422_tagMCTurnFightObjDead> FindDeadPack(List<GameNetPackBasic> packList) |
| | | public static List<BattleDeadPack> FindDeadPack(List<GameNetPackBasic> packList) |
| | | { |
| | | List<HB422_tagMCTurnFightObjDead> deadPacks = new List<HB422_tagMCTurnFightObjDead>(); |
| | | List<BattleDeadPack> deadPacks = new List<BattleDeadPack>(); |
| | | for (int i = 0; i < packList.Count; i++) |
| | | { |
| | | var pack = packList[i]; |
| | | // 寻找死亡包 找到死亡包之后要找掉落包 不能超过技能包 |
| | | if (pack is HB422_tagMCTurnFightObjDead deadPack) |
| | | { |
| | | deadPacks.Add(deadPack); |
| | | deadPacks.Add(new BattleDeadPack { deadPack = deadPack }); |
| | | } |
| | | else if (pack is CustomHB426CombinePack) |
| | | else if (pack is CustomHB426CombinePack combinePack) |
| | | { |
| | | break; |
| | | if (deadPacks.Count > 0) |
| | | { |
| | | HB427_tagSCUseSkill hB427_TagSCUseSkill = combinePack.GetMainHB427SkillPack(); |
| | | |
| | | if (null == hB427_TagSCUseSkill) |
| | | { |
| | | break; |
| | | } |
| | | else |
| | | { |
| | | var skillID = hB427_TagSCUseSkill.SkillID; |
| | | var skillConfig = SkillConfig.Get((int)skillID); |
| | | |
| | | if ((SkillTriggerTiming)skillConfig.ClientTriggerTiming == SkillTriggerTiming.Death) |
| | | { |
| | | for (int j = 0 ; j < deadPacks.Count; j ++) |
| | | { |
| | | var parentPack = deadPacks[j]; |
| | | |
| | | if (parentPack.IsOwnSkill(hB427_TagSCUseSkill)) |
| | | { |
| | | parentPack.SetDeathSkill(combinePack); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | // Debug.LogError("find dead pack " + deadPacks.Count); |
| New file |
| | |
| | | |
| | | |
| | | using System; |
| | | |
| | | public class BattleDeadPack |
| | | { |
| | | public HB422_tagMCTurnFightObjDead deadPack; |
| | | |
| | | public CustomHB426CombinePack deadTriggerSkill; |
| | | |
| | | public bool isPlaySkill = false; |
| | | |
| | | public bool IsOwnSkill(HB427_tagSCUseSkill hB427_TagSCUseSkill) |
| | | { |
| | | if (deadTriggerSkill != null) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | if (deadPack != null) |
| | | { |
| | | return deadPack.ObjID == hB427_TagSCUseSkill.ObjID; |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | public void SetDeathSkill(CustomHB426CombinePack combinePack) |
| | | { |
| | | deadTriggerSkill = combinePack; |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 3a6717392be38c64ebe4554403650c8d |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | public HB427_tagSCUseSkill.tagSCUseSkillHurt hurt; |
| | | public HB427_tagSCUseSkill hB427_TagSCUseSkill; |
| | | public int hitIndex; |
| | | public HB422_tagMCTurnFightObjDead deadPack; |
| | | public BattleDeadPack deadPack; |
| | | public SkillConfig skillConfig; |
| | | |
| | | |
| New file |
| | |
| | | |
| | | |
| | | public enum SkillTriggerTiming |
| | | { |
| | | None, |
| | | |
| | | Death = 1, //死亡触发 |
| | | |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 45fcec403bdee7141a854305dfa66975 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | RoundChange,//回合切换 |
| | | |
| | | PreloadRes,//预加载资源 |
| | | |
| | | Reborn, // 复活 |
| | | } |
| | |
| | | private float MoveSpeed = 750f; |
| | | |
| | | private Dictionary<int, BattleDrops> tempDropList = new Dictionary<int, BattleDrops>(); |
| | | private Dictionary<int, HB422_tagMCTurnFightObjDead> tempDeadPackList = new Dictionary<int, HB422_tagMCTurnFightObjDead>(); |
| | | private Dictionary<int, BattleDeadPack> tempDeadPackList = new Dictionary<int, BattleDeadPack>(); |
| | | |
| | | protected List<HB428_tagSCBuffRefresh> buffCollections = new List<HB428_tagSCBuffRefresh>(); |
| | | |
| | |
| | | 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; |
| | |
| | | RectTransform target = battleField.GetTeamNode(caster.GetEnemyCamp(), skillConfig); |
| | | ExecuteMoveAndCastSequence(target, () => |
| | | { |
| | | // ShadowIllutionCreate(true); |
| | | MoveToTarget(battleField.GetTeamNode(caster.Camp, caster.teamHero.positionNum), Vector2.zero, () => |
| | | if (skillConfig.ClientTriggerTiming == 1) |
| | | { |
| | | // ShadowIllutionCreate(false); |
| | | OnAttackFinish(); |
| | | }, MoveSpeed); |
| | | } |
| | | else |
| | | { |
| | | // ShadowIllutionCreate(true); |
| | | MoveToTarget(battleField.GetTeamNode(caster.Camp, caster.teamHero.positionNum), Vector2.zero, () => |
| | | { |
| | | // ShadowIllutionCreate(false); |
| | | OnAttackFinish(); |
| | | }, MoveSpeed); |
| | | } |
| | | }); |
| | | } |
| | | |
| | |
| | | RectTransform target = battleField.GetTeamNode(caster.Camp, skillConfig); |
| | | ExecuteMoveAndCastSequence(target, () => |
| | | { |
| | | // ShadowIllutionCreate(true); |
| | | MoveToTarget(battleField.GetTeamNode(caster.Camp, caster.teamHero.positionNum), Vector2.zero, () => |
| | | if (skillConfig.ClientTriggerTiming == 1) |
| | | { |
| | | // ShadowIllutionCreate(false); |
| | | OnAttackFinish(); |
| | | }, MoveSpeed); |
| | | } |
| | | else |
| | | { |
| | | // ShadowIllutionCreate(true); |
| | | MoveToTarget(battleField.GetTeamNode(caster.Camp, caster.teamHero.positionNum), Vector2.zero, () => |
| | | { |
| | | // ShadowIllutionCreate(false); |
| | | OnAttackFinish(); |
| | | }, MoveSpeed); |
| | | } |
| | | }); |
| | | } |
| | | |
| | |
| | | // ============ 获取临时数据(掉落、死亡等) ============ |
| | | int objID = (int)target.ObjID; |
| | | tempDropList.TryGetValue(objID, out BattleDrops battleDrops); |
| | | tempDeadPackList.TryGetValue(objID, out HB422_tagMCTurnFightObjDead deadPack); |
| | | tempDeadPackList.TryGetValue(objID, out BattleDeadPack deadPack); |
| | | |
| | | // ============ 参数打包 ============ |
| | | BattleHurtParam hurtParam = BattleUtility.CalcBattleHurtParam(this, _hitIndex, target, hurt, battleDrops, deadPack); |
| | |
| | | // ============ 获取临时数据(掉落、死亡等) ============ |
| | | int objID = (int)target.ObjID; |
| | | tempDropList.TryGetValue(objID, out BattleDrops battleDrops); |
| | | tempDeadPackList.TryGetValue(objID, out HB422_tagMCTurnFightObjDead deadPack); |
| | | tempDeadPackList.TryGetValue(objID, out BattleDeadPack deadPack); |
| | | |
| | | // ============ 参数打包(将 tagSCUseSkillHurtEx 转换为 tagSCUseSkillHurt)============ |
| | | HB427_tagSCUseSkill.tagSCUseSkillHurt hurt = new HB427_tagSCUseSkill.tagSCUseSkillHurt |
| | |
| | | // 处理死亡相关逻辑:分配掉落和经验 |
| | | protected void HandleDead() |
| | | { |
| | | var deadPackList = BattleUtility.FindDeadPack(packList); |
| | | List<BattleDeadPack> deadPackList = BattleUtility.FindDeadPack(packList); |
| | | if (deadPackList.Count <= 0) return; |
| | | |
| | | CheckAfterDeadhPack(); |
| | |
| | | // 构造BattleDrops并缓存 |
| | | for (int i = 0; i < deadPackList.Count; i++) |
| | | { |
| | | int objID = (int)deadPackList[i].ObjID; |
| | | BattleDeadPack battleDeadPack = deadPackList[i]; |
| | | int objID = (int)battleDeadPack.deadPack.ObjID; |
| | | BattleObject deadTarget = battleField.battleObjMgr.GetBattleObject(objID); |
| | | |
| | | // 修复:添加空值检查 |
| | |
| | | } |
| | | |
| | | // 修复:避免在遍历时修改集合,先收集后删除 |
| | | var deadPacksToRemove = new List<GameNetPackBasic>(deadPackList.Cast<GameNetPackBasic>()); |
| | | var deadPacksToRemove = new List<GameNetPackBasic>(deadPackList.Select(d => d.deadPack)); |
| | | deadPacksToRemove.AddRange(deadPackList.Where(d => d.deadTriggerSkill != null).Select(d => d.deadTriggerSkill)); |
| | | foreach (var deadPack in deadPacksToRemove) |
| | | { |
| | | packList.Remove(deadPack); |
| | |
| | | packList.RemoveAt(removeIndexList[i]); |
| | | } |
| | | |
| | | |
| | | public virtual bool IsFinishedForJudge() |
| | | { |
| | | if (!isPlay) return false; |
| | | |
| | | if (skillEffect != null) |
| | | { |
| | | if (!skillEffect.IsFinished()) return false; |
| | | } |
| | | |
| | | if (otherSkillActionList.Count > 0) |
| | | { |
| | | foreach (var action in otherSkillActionList) |
| | | { |
| | | if (!action.IsFinishedForJudge()) return false; |
| | | } |
| | | } |
| | | |
| | | if (isFinished && moveFinished) |
| | | { |
| | | if (packList.Count > 0) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | // 检查技能是否完成:综合检查所有完成条件 |
| | | public virtual bool IsFinished() |
| | | { |
| | |
| | | // 强制结束技能:立即结束所有技能相关的处理 |
| | | public virtual void ForceFinished() |
| | | { |
| | | if (isFinished) |
| | | return; |
| | | |
| | | skillEffect?.ForceFinished(); |
| | | |
| | | otherSkillActionList.ForEach(action => action.ForceFinish()); |
| | |
| | | skillEffect = null; |
| | | packList = null; |
| | | } |
| | | |
| | | } |