From cdf7098c937c5f4a70383ef70897bf9fedbb3d99 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期四, 04 九月 2025 15:28:01 +0800
Subject: [PATCH] 删除大部分log 修复技能有时候播不出来的问题
---
Main/System/Battle/SkillEffect/NormalSkillEffect.cs | 19
Main/System/Battle/UIComp/DamageContent.cs | 42 +
Main/Config/ConfigManager.cs | 59 --
Main/System/Battle/BattleObject/BattleObjectFactory.cs | 14
Main/System/Battle/SkillEffect/BulletCurve/BounceBulletCurve.cs | 2
Main/System/Battle/SkillEffect/BulletCurve/StraightBulletCurve.cs | 15
Main/System/Battle/UIComp/DamageLine.cs | 16
Main/System/Battle/Motion/MotionBase.cs | 78 +--
Main/System/Battle/BattleField/StoryBattleField.cs | 4
Main/Config/Configs/SkillConfig.cs | 20
Main/System/Battle/Define/BattleDmgInfo.cs | 114 +++++
Main/System/Battle/BattleField/BattleField.cs | 11
Main/Core/NetworkPackage/CustomServerPack/CustomB421ActionPack.cs | 16
Main/System/GeneralConfig/GeneralDefine.cs | 3
Main/System/Battle/BattleObject/BattleObject.cs | 33 -
Main/System/Battle/Skill/DirectlyHealSkill.cs | 5
Main/System/Battle/Define/DamageType.cs | 38 +
Main/System/Battle/UIComp/BattleTips.cs | 1
Main/System/Battle/BattleEffectMgr.cs | 3
Main/Component/UI/Effect/BattleEffectPlayer.cs | 7
Main/Config/Configs/EffectConfig.cs | 5
Main/System/Battle/TestMoveToTarget.cs | 2
Main/Config/Configs/DamageNumConfig.cs | 27
Main/System/Battle/Skill/SkillFactory.cs | 3
Main/System/Battle/BattleManager.cs | 89 ++-
Main/System/Battle/BattleUtility.cs | 147 +++++-
Main/System/Battle/Skill/DirectlyDamageSkill.cs | 5
Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs | 97 +++-
Main/System/Battle/SkillEffect/BulletSkillEffect.cs | 188 +++++---
Main/System/Battle/RecordPlayer/RecordPlayer.cs | 56 ++
Main/System/Battle/Skill/SkillBase.cs | 48 +-
Main/System/Battle/BattleField/RecordActions/SkillRecordAction.cs | 1
Main/Core/NetworkPackage/GameNetPackBasic.cs | 1
Main/System/Battle/BattleField/OperationAgent/HandModeOperationAgent.cs | 2
34 files changed, 734 insertions(+), 437 deletions(-)
diff --git a/Main/Component/UI/Effect/BattleEffectPlayer.cs b/Main/Component/UI/Effect/BattleEffectPlayer.cs
index 177e1fb..528eeb4 100644
--- a/Main/Component/UI/Effect/BattleEffectPlayer.cs
+++ b/Main/Component/UI/Effect/BattleEffectPlayer.cs
@@ -121,6 +121,10 @@
rectTrans.anchoredPosition += new Vector2(effectConfig.effectPos[0], effectConfig.effectPos[1]);
}
+ if (effectConfig.effectScale > 0f)
+ {
+ rectTrans.localScale *= effectConfig.effectScale;
+ }
}
protected virtual void Clear()
@@ -351,6 +355,9 @@
protected void OnSortingChanged(string _sortingLayer, int _sortingOrder)
{
+ if (null == spineComp)
+ return;
+
sortingLayer = _sortingLayer;
sortingOrder = _sortingOrder;
// 澶勭悊鎺掑簭鍙樺寲
diff --git a/Main/Config/ConfigManager.cs b/Main/Config/ConfigManager.cs
index 7035beb..49c6096 100644
--- a/Main/Config/ConfigManager.cs
+++ b/Main/Config/ConfigManager.cs
@@ -38,32 +38,15 @@
// 鍔犺浇閰嶇疆鏂囦欢
HashSet<Type> configTypes = new HashSet<Type>() {
- typeof(ChestsAwardConfig),
- typeof(CTGConfig),
- typeof(DamageNumConfig),
typeof(DirtyWordConfig),
- typeof(FaceConfig),
typeof(FightPowerRatioConfig),
typeof(HeroLineupHaloConfig),
typeof(HeroQualityLVConfig),
typeof(InvestConfig),
typeof(ItemConfig),
- typeof(MainChapterConfig),
typeof(MainLevelConfig),
- typeof(NPCConfig),
- typeof(NPCExConfig),
- typeof(NPCLineupConfig),
- typeof(OrderInfoConfig),
- typeof(PlayerAttrConfig),
- typeof(PlayerFaceConfig),
- typeof(StoreConfig),
- typeof(SuccessConfig),
- typeof(SysInfoConfig),
- typeof(TitleStarUpConfig),
- typeof(TreasureSetConfig),
- typeof(TreeLVConfig),
- typeof(WindowSearchConfig),
- typeof(XBGetItemConfig)
+ typeof(PlayerLVConfig),
+ typeof(TitleStarUpConfig)
};
#if UNITY_EDITOR
@@ -213,16 +196,8 @@
public override void Release()
{
- // 娓呯┖ ChestsAwardConfig 瀛楀吀
- ClearConfigDictionary<ChestsAwardConfig>();
- // 娓呯┖ CTGConfig 瀛楀吀
- ClearConfigDictionary<CTGConfig>();
- // 娓呯┖ DamageNumConfig 瀛楀吀
- ClearConfigDictionary<DamageNumConfig>();
// 娓呯┖ DirtyWordConfig 瀛楀吀
ClearConfigDictionary<DirtyWordConfig>();
- // 娓呯┖ FaceConfig 瀛楀吀
- ClearConfigDictionary<FaceConfig>();
// 娓呯┖ FightPowerRatioConfig 瀛楀吀
ClearConfigDictionary<FightPowerRatioConfig>();
// 娓呯┖ HeroLineupHaloConfig 瀛楀吀
@@ -233,38 +208,12 @@
ClearConfigDictionary<InvestConfig>();
// 娓呯┖ ItemConfig 瀛楀吀
ClearConfigDictionary<ItemConfig>();
- // 娓呯┖ MainChapterConfig 瀛楀吀
- ClearConfigDictionary<MainChapterConfig>();
// 娓呯┖ MainLevelConfig 瀛楀吀
ClearConfigDictionary<MainLevelConfig>();
- // 娓呯┖ NPCConfig 瀛楀吀
- ClearConfigDictionary<NPCConfig>();
- // 娓呯┖ NPCExConfig 瀛楀吀
- ClearConfigDictionary<NPCExConfig>();
- // 娓呯┖ NPCLineupConfig 瀛楀吀
- ClearConfigDictionary<NPCLineupConfig>();
- // 娓呯┖ OrderInfoConfig 瀛楀吀
- ClearConfigDictionary<OrderInfoConfig>();
- // 娓呯┖ PlayerAttrConfig 瀛楀吀
- ClearConfigDictionary<PlayerAttrConfig>();
- // 娓呯┖ PlayerFaceConfig 瀛楀吀
- ClearConfigDictionary<PlayerFaceConfig>();
- // 娓呯┖ StoreConfig 瀛楀吀
- ClearConfigDictionary<StoreConfig>();
- // 娓呯┖ SuccessConfig 瀛楀吀
- ClearConfigDictionary<SuccessConfig>();
- // 娓呯┖ SysInfoConfig 瀛楀吀
- ClearConfigDictionary<SysInfoConfig>();
+ // 娓呯┖ PlayerLVConfig 瀛楀吀
+ ClearConfigDictionary<PlayerLVConfig>();
// 娓呯┖ TitleStarUpConfig 瀛楀吀
ClearConfigDictionary<TitleStarUpConfig>();
- // 娓呯┖ TreasureSetConfig 瀛楀吀
- ClearConfigDictionary<TreasureSetConfig>();
- // 娓呯┖ TreeLVConfig 瀛楀吀
- ClearConfigDictionary<TreeLVConfig>();
- // 娓呯┖ WindowSearchConfig 瀛楀吀
- ClearConfigDictionary<WindowSearchConfig>();
- // 娓呯┖ XBGetItemConfig 瀛楀吀
- ClearConfigDictionary<XBGetItemConfig>();
}
#if UNITY_EDITOR
diff --git a/Main/Config/Configs/DamageNumConfig.cs b/Main/Config/Configs/DamageNumConfig.cs
index e30673c..cc269a9 100644
--- a/Main/Config/Configs/DamageNumConfig.cs
+++ b/Main/Config/Configs/DamageNumConfig.cs
@@ -1,6 +1,6 @@
锘�//--------------------------------------------------------
// [Author]: YYL
-// [ Date ]: 2025骞�8鏈�6鏃�
+// [ Date ]: 2025骞�9鏈�3鏃�
//--------------------------------------------------------
using System.Collections.Generic;
@@ -8,7 +8,7 @@
using UnityEngine;
using LitJson;
-public partial class DamageNumConfig : ConfigBase<string, DamageNumConfig>
+public partial class DamageNumConfig : ConfigBase<int, DamageNumConfig>
{
static DamageNumConfig()
{
@@ -16,15 +16,16 @@
visit = true;
}
- public string id;
+ public int TypeID;
+ public string id;
public int prefix;
public int plus;
public int minus;
public int[] nums;
- public override string LoadKey(string _key)
+ public override int LoadKey(string _key)
{
- string key = GetKey(_key);
+ int key = GetKey(_key);
return key;
}
@@ -32,21 +33,23 @@
{
try {
string[] tables = input.Split('\t');
- id = tables[0];
+ int.TryParse(tables[0],out TypeID);
- int.TryParse(tables[1],out prefix);
+ id = tables[1];
- int.TryParse(tables[2],out plus);
+ int.TryParse(tables[2],out prefix);
- int.TryParse(tables[3],out minus);
+ int.TryParse(tables[3],out plus);
- if (tables[4].Contains("["))
+ int.TryParse(tables[4],out minus);
+
+ if (tables[5].Contains("["))
{
- nums = JsonMapper.ToObject<int[]>(tables[4]);
+ nums = JsonMapper.ToObject<int[]>(tables[5]);
}
else
{
- string[] numsStringArray = tables[4].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
+ string[] numsStringArray = tables[5].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
nums = new int[numsStringArray.Length];
for (int i=0;i<numsStringArray.Length;i++)
{
diff --git a/Main/Config/Configs/EffectConfig.cs b/Main/Config/Configs/EffectConfig.cs
index e1dd81d..713145a 100644
--- a/Main/Config/Configs/EffectConfig.cs
+++ b/Main/Config/Configs/EffectConfig.cs
@@ -1,6 +1,6 @@
锘�//--------------------------------------------------------
// [Author]: YYL
-// [ Date ]: 2025骞�8鏈�26鏃�
+// [ Date ]: 2025骞�9鏈�2鏃�
//--------------------------------------------------------
using System.Collections.Generic;
@@ -30,6 +30,7 @@
public int frontBack;
public float delayPlay;
public int[] effectPos;
+ public float effectScale;
public override int LoadKey(string _key)
{
@@ -92,6 +93,8 @@
int.TryParse(effectPosStringArray[i],out effectPos[i]);
}
}
+
+ float.TryParse(tables[14],out effectScale);
}
catch (Exception exception)
{
diff --git a/Main/Config/Configs/SkillConfig.cs b/Main/Config/Configs/SkillConfig.cs
index 4379b72..e0d0f65 100644
--- a/Main/Config/Configs/SkillConfig.cs
+++ b/Main/Config/Configs/SkillConfig.cs
@@ -1,6 +1,6 @@
锘�//--------------------------------------------------------
// [Author]: YYL
-// [ Date ]: Friday, August 29, 2025
+// [ Date ]: 2025骞�9鏈�2鏃�
//--------------------------------------------------------
using System.Collections.Generic;
@@ -47,8 +47,10 @@
public int BulletEffectId;
public int BulletPath;
public float BulletFlyTime;
+ public int Scattering;
public int ExplosionEffectId;
public int ExplosionEffect2;
+ public int ExplosionEffect3;
public int EffectId;
public int EffectId2;
public int MStartEffectId;
@@ -138,17 +140,21 @@
float.TryParse(tables[30],out BulletFlyTime);
- int.TryParse(tables[31],out ExplosionEffectId);
+ int.TryParse(tables[31],out Scattering);
- int.TryParse(tables[32],out ExplosionEffect2);
+ int.TryParse(tables[32],out ExplosionEffectId);
- int.TryParse(tables[33],out EffectId);
+ int.TryParse(tables[33],out ExplosionEffect2);
- int.TryParse(tables[34],out EffectId2);
+ int.TryParse(tables[34],out ExplosionEffect3);
- int.TryParse(tables[35],out MStartEffectId);
+ int.TryParse(tables[35],out EffectId);
- int.TryParse(tables[36],out TriggerEffect);
+ int.TryParse(tables[36],out EffectId2);
+
+ int.TryParse(tables[37],out MStartEffectId);
+
+ int.TryParse(tables[38],out TriggerEffect);
}
catch (Exception exception)
{
diff --git a/Main/Core/NetworkPackage/CustomServerPack/CustomB421ActionPack.cs b/Main/Core/NetworkPackage/CustomServerPack/CustomB421ActionPack.cs
index 718f080..f5b5f85 100644
--- a/Main/Core/NetworkPackage/CustomServerPack/CustomB421ActionPack.cs
+++ b/Main/Core/NetworkPackage/CustomServerPack/CustomB421ActionPack.cs
@@ -4,15 +4,24 @@
public class CustomB421ActionPack : GameNetPackBasic
{
+ public int actionPackId = 0;
+
+ private static int autoincreaseId = 10000;
+
+ public CustomB421ActionPack()
+ {
+ actionPackId = autoincreaseId++;
+ }
public string guid;
public Queue<GameNetPackBasic> actionPacks = new Queue<GameNetPackBasic>();
public static CustomB421ActionPack CreateB421ActionPack(string _guid, List<GameNetPackBasic> packList)
{
+ CustomB421ActionPack actionPack = new CustomB421ActionPack();
+
// 鍚堝苟涓�涓嬭繖涓鑹茬殑琛屽姩鍐呭鐨勬妧鑳� 鍒朵綔鎴怌ustomB421ActionPack
List<GameNetPackBasic> combinedPackList = CustomHB426CombinePack.CombineToSkillPackFromList(_guid, packList);
- CustomB421ActionPack actionPack = new CustomB421ActionPack();
actionPack.guid = _guid;
actionPack.actionPacks = new Queue<GameNetPackBasic>(combinedPackList);
return actionPack;
@@ -24,16 +33,13 @@
{
GameNetPackBasic pack = actionPacks.Dequeue();
- BattleDebug.LogError("CustomB421ActionPack distribute pack " + pack.GetType().Name);
- if (pack is CustomHB426CombinePack)
+ if (pack is CustomHB426CombinePack b426Pack)
{
- var b426Pack = pack as CustomHB426CombinePack;
b426Pack.Distribute();
}
else
{
- BattleDebug.LogError("distribute pack " + pack.GetType().Name);
PackageRegedit.Distribute(pack);
}
}
diff --git a/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs b/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs
index 2593088..3d7bc6b 100644
--- a/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs
+++ b/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs
@@ -31,8 +31,6 @@
}
endTag = _endTag;
toIndex = _toIndex;
-
- packList = CombineToSkillPackFromList(guid, packList);
}
@@ -74,66 +72,96 @@
return startTag.Tag == tag.Tag && tag.Sign == 1;
}
-
public static List<GameNetPackBasic> CombineToSkillPackFromList(string _guid, List<GameNetPackBasic> b421SeriesPackList)
{
- CustomHB426CombinePack combinePack = null;
+ Dictionary<string, CustomHB426CombinePack> combineDict = new Dictionary<string, CustomHB426CombinePack>();
+
+ Dictionary<int, GameNetPackBasic> indexDict = new Dictionary<int, GameNetPackBasic>();
+
for (int i = 0; i < b421SeriesPackList.Count; i++)
{
var pack = b421SeriesPackList[i];
if (pack is HB426_tagSCTurnFightTag)
{
var tag = pack as HB426_tagSCTurnFightTag;
- if (null == combinePack)
+ CustomHB426CombinePack combinePack;
+
+ if (!combineDict.TryGetValue(tag.Tag, out combinePack))
{
combinePack = new CustomHB426CombinePack();
combinePack.guid = _guid;
+ combineDict.Add(tag.Tag, combinePack);
+
+ indexDict.Add(i, combinePack);
+ }
+
+ if (tag.Sign == 0)
+ {
combinePack.SetHB426Start(i, tag);
continue;
}
- else
+ // 鎵惧埌瀵瑰簲鐨勫紑濮嬫爣绛�
+ if (combinePack.IsEndPack(tag))
{
- if (combinePack.IsEndPack(tag))
+ combinePack.SetHB426End(i, tag);
+ continue;
+ }
+
+ Debug.LogError("No matching start tag or end tag found: " + tag.Tag);
+ continue;
+ }
+ else
+ {
+ indexDict.Add(i, pack);
+ }
+ }
+
+ // 宓屽鍖呭唴鐨勫寘鍚堝苟
+ foreach (var combinePack in combineDict.Values)
+ {
+ for (int i = combinePack.fromIndex + 1; i < combinePack.toIndex; i++)
+ {
+ if (indexDict.TryGetValue(i, out var pack))
+ {
+ if (pack is CustomHB426CombinePack)
{
- combinePack.SetHB426End(i, tag);
- break;
+ // 濡傛灉鏄祵濂楃殑鍖� 鍔犲叆涔嬪悗 璋冩暣i
+ combinePack.AddPack(pack);
+ i = (pack as CustomHB426CombinePack).toIndex;
+ }
+ else
+ {
+ combinePack.AddPack(pack);
+ indexDict.Remove(i);
}
}
- }
-
- if (null != combinePack)
- {
- combinePack.AddPack(pack);
}
}
List<GameNetPackBasic> newPackList = new List<GameNetPackBasic>();
- if (null != combinePack)
+ // string temp = string.Empty;
+
+ for (int i = 0; i < b421SeriesPackList.Count; i++)
{
- // 鎶�鑳藉寘鍓嶉潰鐨勫寘锛堜笉鍖呮嫭b426鐨勫紑濮嬫爣绛撅級
- for (int i = 0; i < combinePack.fromIndex; i++)
+ if (indexDict.TryGetValue(i, out var pack))
{
- newPackList.Add(b421SeriesPackList[i]);
+ newPackList.Add(pack);
+ if (pack is CustomHB426CombinePack)
+ {
+ var cbpack = pack as CustomHB426CombinePack;
+ // temp += "pack type is " + pack.GetType().Name + " tag is " + cbpack.startTag.Tag + "\n";
+ }
+ else
+ {
+ // temp += "pack type is " + pack.GetType().Name + "\n";
+ }
}
-
- // 鎶婂悎骞剁殑鎶�鑳藉寘鍔犺繘鏉�
- newPackList.Add(combinePack);
-
- // 鎶�鑳藉寘鍚庨潰鐨勫寘锛堜笉鍖呮嫭b426鐨勭粨鏉熸爣绛撅級
- for (int i = combinePack.toIndex + 1; i < b421SeriesPackList.Count; i++)
- {
- newPackList.Add(b421SeriesPackList[i]);
- }
-
- return CombineToSkillPackFromList(_guid, newPackList);
-
- }
- else
- {
- return b421SeriesPackList;
}
+ // Debug.LogError(temp);
+
+ return newPackList;
}
public void Distribute()
@@ -151,6 +179,7 @@
{
battleField.PlayRecord(skillAction);
}
+
}
public SkillRecordAction CreateSkillAction()
diff --git a/Main/Core/NetworkPackage/GameNetPackBasic.cs b/Main/Core/NetworkPackage/GameNetPackBasic.cs
index 78c5db7..ce993e8 100644
--- a/Main/Core/NetworkPackage/GameNetPackBasic.cs
+++ b/Main/Core/NetworkPackage/GameNetPackBasic.cs
@@ -21,6 +21,7 @@
packUID = AutoIncreaseUID++;
}
+ public bool isDistribute = false;
public ServerType socketType = ServerType.Main; //榛樿涓斿敮涓�
diff --git a/Main/System/Battle/BattleEffectMgr.cs b/Main/System/Battle/BattleEffectMgr.cs
index f46b090..1bb3045 100644
--- a/Main/System/Battle/BattleEffectMgr.cs
+++ b/Main/System/Battle/BattleEffectMgr.cs
@@ -62,7 +62,6 @@
effectDict[effectId] = new List<BattleEffectPlayer>();
}
- BattleDebug.LogError("鎾斁鐗规晥 " + effectId);
BattleEffectPlayer effectPlayer = BattleEffectPlayer.Create(effectId, battleField.battleRootNode.transform);
// 璁剧疆鐗规晥缂╂斁鍜屾柟鍚�
@@ -95,7 +94,7 @@
}
else
{
- BattleDebug.LogError("could not find effect in list, effectid : " + effectId);
+ Debug.LogError("could not find effect in list, effectid : " + effectId);
}
}
diff --git a/Main/System/Battle/BattleField/BattleField.cs b/Main/System/Battle/BattleField/BattleField.cs
index d1e5180..0d0be34 100644
--- a/Main/System/Battle/BattleField/BattleField.cs
+++ b/Main/System/Battle/BattleField/BattleField.cs
@@ -153,7 +153,7 @@
if (operationAgent == null)
{
- BattleDebug.LogError("you should SetBattleMode before Run");
+ Debug.LogError("you should SetBattleMode before Run");
return;
}
@@ -185,7 +185,6 @@
break;
}
- BattleDebug.LogError("battleMode is " + battleMode.ToString());
}
public virtual void AutoSetBattleMode()
@@ -245,6 +244,8 @@
// TurnNum; // 褰撳墠杞
// Len;
// Msg; //size = Len +
+
+
if (State == 4)
{
//宸茬粡缁撴潫骞剁粨绠�
@@ -293,7 +294,7 @@
if (deadPackList.Count > 0)
{
DeathRecordAction recordAction = new DeathRecordAction(this, deadPackList);
- recordPlayer.PlayRecord(recordAction);
+ recordPlayer.ImmediatelyPlay(recordAction);
}
}
@@ -338,7 +339,7 @@
{
if (index < 0 || index >= battleRootNode.redTeamNodeList.Count)
{
- BattleDebug.LogError($"GetTeamNode: Index {index} is out of range for {battleCamp} camp.");
+ Debug.LogError($"GetTeamNode: Index {index} is out of range for {battleCamp} camp.");
return null;
}
@@ -413,7 +414,7 @@
}
else
{
- BattleDebug.LogError($"BattleObject with ID {vNetData.ObjID} not found for reborn.");
+ Debug.LogError($"BattleObject with ID {vNetData.ObjID} not found for reborn.");
}
}
diff --git a/Main/System/Battle/BattleField/OperationAgent/HandModeOperationAgent.cs b/Main/System/Battle/BattleField/OperationAgent/HandModeOperationAgent.cs
index bb1a516..85ffe18 100644
--- a/Main/System/Battle/BattleField/OperationAgent/HandModeOperationAgent.cs
+++ b/Main/System/Battle/BattleField/OperationAgent/HandModeOperationAgent.cs
@@ -19,8 +19,6 @@
// 閫氳繃涓荤晫闈㈢殑鎸夐挳鎺ㄥ姩(璋冪敤)DoNext
public override void DoNext()
{
- BattleDebug.LogError("HandModeOperationAgent DoNext");
-
base.DoNext();
storyBattleField.RequestFight();
diff --git a/Main/System/Battle/BattleField/RecordActions/SkillRecordAction.cs b/Main/System/Battle/BattleField/RecordActions/SkillRecordAction.cs
index 82010e9..e56eb36 100644
--- a/Main/System/Battle/BattleField/RecordActions/SkillRecordAction.cs
+++ b/Main/System/Battle/BattleField/RecordActions/SkillRecordAction.cs
@@ -11,7 +11,6 @@
: base(RecordActionType.Skill, _battleField, _caster)
{
skillBase = SkillFactory.CreateSkill(_caster, vNetData, packList, _battleField);
- BattleDebug.LogError("skill record action tpye : " + skillBase.GetType().Name);
}
public override bool IsFinished()
diff --git a/Main/System/Battle/BattleField/StoryBattleField.cs b/Main/System/Battle/BattleField/StoryBattleField.cs
index f993d41..e69b472 100644
--- a/Main/System/Battle/BattleField/StoryBattleField.cs
+++ b/Main/System/Battle/BattleField/StoryBattleField.cs
@@ -194,12 +194,10 @@
// 褰撳墠娌℃湁鍦ㄦ挱鏀炬垬鏂楀綍鍍�
if (!recordPlayer.IsPlaying())
{
- BattleDebug.LogError("HandModeOperationAgent DoNext 1");
// 娌℃湁涓嬩竴涓寘鍙互鍙戜簡
if (!BattleManager.Instance.DistributeNextPackage())
{
- BattleDebug.LogError("HandModeOperationAgent DoNext 2");
//鍐嶆鏌ヤ竴娆℃湁娌¤澶囨湭澶勭悊
if (PackManager.Instance.GetSinglePack(PackType.DropItem).GetItems().Count > 0)
@@ -234,7 +232,6 @@
// BOSS鎸戞垬璇存槑锛氫紤鎭腑鎸戞垬BOSS鎭㈠鍒颁紤鎭姸鎬� 涓嶅彂鍖咃紱
// 鎴樻枟涓寫鎴楤OSS鎭㈠鍒版垬鏂楃姸鎬� 鍙�4鍖咃紱鏈嶅姟绔寫鎴榖oss宸茬粡娓呭皬鎬満
- BattleDebug.LogError("HandModeOperationAgent DoNext 3");
byte reqType;
if (battleState == StoryBattleState.Break)
@@ -251,7 +248,6 @@
return;
}
- BattleDebug.LogError("HandModeOperationAgent DoNext 4 reqType is " + reqType);
// 濡傛灉璇锋眰鐨勬槸2 璇存槑瑕佸垵濮嬪寲涓�涓嬫垬鍦�
diff --git a/Main/System/Battle/BattleManager.cs b/Main/System/Battle/BattleManager.cs
index 581419d..177c95e 100644
--- a/Main/System/Battle/BattleManager.cs
+++ b/Main/System/Battle/BattleManager.cs
@@ -143,14 +143,13 @@
List<GameNetPackBasic> b421PackList = new List<GameNetPackBasic>();
i++; // 璺宠繃褰撳墠鐨凚421鍖�
+ // 鏀堕泦鎵�鏈夐潪B421鍖咃紝鐩村埌閬囧埌涓嬩竴涓狟421鎴栭槦鍒楃粨鏉�
for (; i < packQueueSnapshot.Count; i++)
{
GameNetPackBasic nextPack = packQueueSnapshot[i];
if (nextPack is HB421_tagMCTurnFightObjAction)
{
- // 閬囧埌浜嗗叾浠朆421 鍚姩瑙掕壊鐨凙ction寮�濮嬶紝
- // B421鍚庡啀纰板埌B421涓�瀹氭槸鏈変竴涓汉鐨勮鍔ㄧ粨鏉熶簡 鍥為��涓�涓綅缃�
- i--;
+ i--; // 鍥為��涓�涓綅缃紝鐣欑粰澶栧眰寰幆澶勭悊
break;
}
else
@@ -160,7 +159,7 @@
}
}
- // 鍙兘娌$敤浜� 涓昏灏辨槸鍒╃敤涓�涓媠kill鐨刢ombine 鏆傜暀 鐪嬩箣鍚庤繕鏈夋病鏈夊埆鐨勯渶姹�
+ // 鍚堝苟鎵�鏈夌浉鍏冲寘
CustomB421ActionPack actionPack = CustomB421ActionPack.CreateB421ActionPack(GetGUID(b421Pack.packUID), b421PackList);
newPackList.Add(actionPack);
@@ -178,7 +177,7 @@
Debug.LogWarning($"杩炵画绌烘垬鏂楃墖娈靛皝鍖呮鏁帮細{continousEmptyCount}");
if (continousEmptyCount >= MaxContinousEmptyCount)
{
- BattleDebug.LogError("杩炵画澶氭娌℃湁鎴樻枟鐗囨灏佸寘锛岃嚜鍔ㄥ洖鍩庝紤鎭紒");
+ Debug.LogError("杩炵画澶氭娌℃湁鎴樻枟鐗囨灏佸寘锛岃嚜鍔ㄥ洖鍩庝紤鎭紒");
MainFightRequest(0); // 0-鍋滄鎴樻枟鍥炲煄
continousEmptyCount = 0;
packQueue.Clear();
@@ -190,8 +189,9 @@
continousEmptyCount = 0; // 鏈夊寘灏遍噸缃�
}
+
// b421璺焍426鐨勫寘宸茬粡澶勭悊瀹屼簡
- packQueue = new Queue<GameNetPackBasic>(newPackList);
+ packQueue = new Queue<GameNetPackBasic>(newPackList);
DistributeNextPackage();
}
@@ -199,42 +199,55 @@
// 涓撳睘浜庝富绾挎垬鏂楃殑娲惧彂
public bool DistributeNextPackage()
{
- if (packQueue.Count > 0)
+ if (packQueue == null)
{
- GameNetPackBasic pack = packQueue.Peek();
-
- bool dequeue = false;
-
- if (pack is CustomHB426CombinePack)
- {
- CustomHB426CombinePack combinePack = pack as CustomHB426CombinePack;
- packQueue.Dequeue();
- combinePack.Distribute();
- }
- else if (pack is CustomB421ActionPack)
- {
- CustomB421ActionPack actionPack = pack as CustomB421ActionPack;
-
- dequeue = !actionPack.Distribute();
- }
- else
- {
- BattleDebug.LogError("distribute pack " + pack.GetType().Name);
- packQueue.Dequeue();
- PackageRegedit.Distribute(pack);
- }
-
- if (dequeue && packQueue.Count > 0)
- {
- packQueue.Dequeue();
- }
-
- return true;
+ Debug.LogWarning("DistributeNextPackage: packQueue涓虹┖鎴栧凡澶勭悊瀹屾瘯");
+ return false;
}
- else
+
+ if (packQueue.Count <= 0)
{
return false;
}
+
+ GameNetPackBasic pack = null;
+ try
+ {
+ pack = packQueue.Dequeue();
+ }
+ catch (Exception ex)
+ {
+ Debug.LogError("DistributeNextPackage: Peek寮傚父 " + ex);
+ return false;
+ }
+
+ try
+ {
+ if (pack is CustomHB426CombinePack combinePack)
+ {
+ combinePack.Distribute();
+ }
+ else if (pack is CustomB421ActionPack actionPack)
+ {
+ actionPack.Distribute();
+ }
+ else
+ {
+ PackageRegedit.Distribute(pack);
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.LogError("DistributeNextPackage: 鍒嗗彂鍖呭紓甯� " + ex);
+ // 鍑洪敊鏃朵富鍔ㄧЩ闄ゅ綋鍓嶅寘锛岄槻姝㈡寰幆
+ if (packQueue.Count > 0)
+ {
+ packQueue.Dequeue();
+ }
+ return false;
+ }
+
+ return packQueue.Count > 0;
}
public void OnConnected()
@@ -314,7 +327,6 @@
}
var pack = queue.Dequeue();
- BattleDebug.LogError("distribute pack " + pack.GetType().Name);
PackageRegedit.Distribute(pack);
@@ -324,7 +336,6 @@
battlePackRelationList.Remove(guid);
}
- BattleDebug.LogError("BattlePackage count is " + queue.Count);
}
#endregion
diff --git a/Main/System/Battle/BattleObject/BattleObject.cs b/Main/System/Battle/BattleObject/BattleObject.cs
index f7b532a..060bdb9 100644
--- a/Main/System/Battle/BattleObject/BattleObject.cs
+++ b/Main/System/Battle/BattleObject/BattleObject.cs
@@ -151,7 +151,7 @@
teamHero.rage = (int)GeneralDefine.GetFactValue(_refreshInfo.Value, _refreshInfo.ValueEx);
break;
default:
- BattleDebug.LogError("BattleObject.ObjInfoRefresh 鍑虹幇鎰忓绫诲瀷 " + _refreshInfo.RefreshType.ToString());
+ Debug.LogError("BattleObject.ObjInfoRefresh 鍑虹幇鎰忓绫诲瀷 " + _refreshInfo.RefreshType.ToString());
break;
}
}
@@ -239,23 +239,22 @@
return true;
}
- public virtual void Hurt(List<long> damageValues, long _totalDamage, uint attackType)
+ public virtual void Hurt(List<long> damageValues, long _totalDamage, HB427_tagSCUseSkill.tagSCUseSkillHurt hurt, SkillConfig skillConfig)
{
- PopDamage(teamHero.curHp, damageValues, attackType);
+ PopDamage(damageValues, hurt, skillConfig);
motionBase.PlayAnimation(MotionName.hit, false);
- // 鎵h
-
+ // 鎵h娴佺粰鍒殑鏁屾柟鍒锋柊濂戒簡
teamHero.curHp -= _totalDamage;
- }
+ }
- public void SuckHp(uint suckHP)
+ public void SuckHp(uint suckHP, SkillConfig skillConfig)
{
}
- public void HurtByReflect(uint bounceHP)
+ public void HurtByReflect(uint bounceHP, SkillConfig skillConfig)
{
}
@@ -285,14 +284,13 @@
public virtual void OnDeath(Action _onDeathAnimationComplete)
{
- BattleDebug.LogError(ObjID + " OnDeath called");
onDeathAnimationComplete = _onDeathAnimationComplete;
motionBase.PlayAnimation(MotionName.dead, false);
}
- protected virtual void OnAnimationComplete(MotionName motionName)
+ protected virtual void OnAnimationComplete(string motionName)
{
- if (motionName == MotionName.dead)
+ if (motionName == MotionName.dead.ToString().ToLower())
{
OnDeadAnimationComplete();
onDeathAnimationComplete?.Invoke();
@@ -315,18 +313,9 @@
}
// 浼ゅ杩樿鐪� 鏄惁闂伩 鏆村嚮 and so on 闇�瑕佹湁涓�涓狣amageType 鏈嶅姟鍣ㄥ簲璇ヤ細缁�
- protected virtual void PopDamage(long curHp, List<long> damageValues, uint attackType)
+ protected virtual void PopDamage(List<long> damageValues, HB427_tagSCUseSkill.tagSCUseSkillHurt hurt, SkillConfig skillConfig)
{
- // 鍏跺疄搴旇閫氱煡鍑哄幓缁橴I鐣岄潰瑙h�� 璁︰I鐣岄潰鑷繁鏉ユ樉绀虹殑 YYL TODO
- // 鎾斁浼ゅ鏁板瓧
- // 杩欓噷鍙互瀹炵幇涓�涓激瀹虫暟瀛楃殑寮瑰嚭鏁堟灉
- // 姣斿浣跨敤涓�涓猆I缁勪欢鏉ユ樉绀轰激瀹虫暟瀛�
- foreach (var damage in damageValues)
- {
- Debug.Log($"Damage: {damage}");
- }
-
- BattleDmgInfo battleDmgInfo = new BattleDmgInfo(battleField.guid, damageValues, this, (int)attackType);
+ BattleDmgInfo battleDmgInfo = new BattleDmgInfo(battleField.guid, damageValues, this, hurt, skillConfig);
// YYL TODO 鏄惁闇�瑕佹寕鍦ㄥ湪鑷韩鐨刦ollow鐐逛笂
EventBroadcast.Instance.Broadcast(EventName.BATTLE_DAMAGE_TAKEN, battleDmgInfo);
diff --git a/Main/System/Battle/BattleObject/BattleObjectFactory.cs b/Main/System/Battle/BattleObject/BattleObjectFactory.cs
index 3982ef4..9a4d010 100644
--- a/Main/System/Battle/BattleObject/BattleObjectFactory.cs
+++ b/Main/System/Battle/BattleObject/BattleObjectFactory.cs
@@ -17,19 +17,13 @@
HeroSkinConfig skinCfg = teamHero.skinConfig;
if (skinCfg == null)
{
- BattleDebug.LogError(teamHero.heroId + "BattleObjectFactory.CreateBattleObject: skinCfg is null for " + teamHero.SkinID);
+ Debug.LogError(teamHero.heroId + "BattleObjectFactory.CreateBattleObject: skinCfg is null for " + teamHero.SkinID);
return null;
}
GameObject battleGO = ResManager.Instance.LoadAsset<GameObject>("Hero/SpineRes", "Hero_001"/*skinCfg.SpineRes*/);
- if (battleGO == null)
- {
- BattleDebug.LogError("BattleObjectFactory.CreateBattleObject: battleGO is null for " + teamHero.heroId);
- return null;
- }
- BattleDebug.LogError("1 BattleObjectFactory.CreateBattleObject: Creating BattleObject for " + teamHero.ObjID + " at position " + teamHero.positionNum);
GameObject goParent = posNodeList[teamHero.positionNum];
BattleObject battleObject = new BattleObject(_battleField);
@@ -41,11 +35,10 @@
var skeletonDataAsset = ResManager.Instance.LoadAsset<SkeletonDataAsset>("Hero/SpineRes/", skinCfg.SpineRes);
if (skeletonDataAsset == null)
{
- BattleDebug.LogError("BattleObjectFactory.CreateBattleObject: skeletonDataAsset is null for " + skinCfg.SpineRes);
+ Debug.LogError("BattleObjectFactory.CreateBattleObject: skeletonDataAsset is null for " + skinCfg.SpineRes);
return null;
}
- BattleDebug.LogError("2 BattleObjectFactory.CreateBattleObject: Creating BattleObject for " + teamHero.ObjID + " at position " + teamHero.positionNum);
float finalScaleRate = modelScaleRate * teamHero.modelScale;
@@ -57,15 +50,12 @@
rectTrans.anchoredPosition = Vector2.zero;
battleObject.Init(realGO, teamHero, _Camp);
- BattleDebug.LogError(realGO.name + " /3 BattleObjectFactory.CreateBattleObject: Creating BattleObject for " + teamHero.ObjID + " at position " + teamHero.positionNum);
-
return battleObject;
}
public static void DestroyBattleObject(int key, BattleObject battleObj)
{
- BattleDebug.LogError("BattleObject destroy");
battleObj.Destroy();
battleObj = null;
}
diff --git a/Main/System/Battle/BattleUtility.cs b/Main/System/Battle/BattleUtility.cs
index 4a2c228..6f54c56 100644
--- a/Main/System/Battle/BattleUtility.cs
+++ b/Main/System/Battle/BattleUtility.cs
@@ -4,7 +4,7 @@
using UnityEngine.UI;
using DG.Tweening;
using DG.Tweening.Core;
-
+using System.Linq;
public static class BattleUtility
{
@@ -23,7 +23,7 @@
var battleField = BattleManager.Instance.storyBattleField;
if (battleField == null)
{
- BattleDebug.LogError("BattleManager.storyBattleField 鏈垵濮嬪寲锛�");
+ Debug.LogError("BattleManager.storyBattleField 鏈垵濮嬪寲锛�");
return;
}
@@ -119,11 +119,40 @@
public static string DisplayDamageNum(long num, int attackType)
{
+ // 鏈嶅姟鍣ㄤ綅鏁板埌瀹㈡埛绔被鍨婭D鐨勬槧灏�
+ Dictionary<int, int> serverToClientTypeMap = new Dictionary<int, int>
+ {
+ { 1, 2 }, // 鏅�氫激琛�
+ { 2, 4 }, // 鎭㈠鍥炶
+ { 3, 8 }, // 鍙嶅脊浼よ
+ { 4, 16 }, // 鎸佺画浼よ
+ { 5, 32 }, // 鏍兼尅
+ { 7, 64 }, // 鏆村嚮浼ゅ
+ { 9, 128 }, // 闂伩
+ // 鍏跺畠绫诲瀷濡傞渶琛ュ厖鍙户缁坊鍔�
+ };
+
+ int damageTypeValue = 0;
+ for (int i = 0; i < 32; i++)
+ {
+ int flag = 1 << i;
+ if ((attackType & flag) != 0)
+ {
+ // 鍙鐞嗘湁鏄犲皠鐨勭被鍨�
+ if (serverToClientTypeMap.TryGetValue(i + 1, out int clientTypeId))
+ {
+ damageTypeValue += clientTypeId;
+ }
+ }
+ }
+ DamageType damageType = (DamageType)damageTypeValue;
+
+ var config = DamageNumConfig.Get(damageTypeValue);
var basePowerStr = UIHelper.ReplaceLargeArtNum(num);
var result = string.Empty;
for (int i = 0; i < basePowerStr.Length; i++)
{
- var numChar = (char)GetDamageNumKey((DamageType)attackType, basePowerStr[i]);
+ var numChar = (char)GetDamageNumKey(config, basePowerStr[i]);
if (numChar > 0)
{
result += numChar;
@@ -132,34 +161,96 @@
return result;
}
- public static int GetDamageNumKey(DamageType damageType, int _num)
+ public static int GetMainTargetPositionNum(BattleObject caster, List<HB427_tagSCUseSkill.tagSCUseSkillHurt> targetList, SkillConfig skillConfig)
{
- var config = DamageNumConfig.Get(damageType.ToString());
- //.鐨凙SCII鐮佹槸46
- if (_num == 46)
+ int returnIndex = 0;
+ // 鏍规嵁鏁屾柟琛�閲忛樀钀� 瀛樻椿浜烘暟鏉ラ�夋嫨
+ BattleCamp battleCamp = skillConfig.TagFriendly != 0 ? caster.Camp : caster.GetEnemyCamp();
+ List<BattleObject> targetObjList = caster.battleField.battleObjMgr.GetBattleObjList(battleCamp);
+
+
+ // 鐬勫噯鐨勭洰鏍囪寖鍥达紝濡傛灉鐩爣涓暟涓�0鍒欎负鑼冨洿鍐呭叏閮�
+ // 0 鍏ㄩ儴鑼冨洿
+ // 1 瀵逛綅锛岄粯璁ゅ彧閫�1涓�
+ // 2 鍓嶆帓
+ // 3 鍚庢帓
+ // 4 绾垫帓锛屾寜瀵逛綅瑙勫垯閫夋嫨绾垫帓
+ // 5 鑷繁锛岄粯璁ゅ彧閫夎嚜宸�
+ // 6 缁ф壙涓绘妧鑳�/鏉ユ簮鎶�鑳界洰鏍�
+ // 涓�鑸槸棰濆瑙﹀彂鐨勬妧鑳戒娇鐢紝濡傛鐜囬檮鍔犳煇buff
+ // 棰濆瑙﹀彂鐨勬妧鑳藉鏋滅洰鏍囦笌涓绘妧鑳戒笉涓�鑷达紝鍒欓噸鏂拌瀹氱洰鏍囧嵆鍙�
+ // 鎴栬鍔ㄨЕ鍙戠殑鎶�鑳斤紝鍙户鎵胯Е鍙戞潵婧愭妧鑳界殑鏀婚槻鍙屾柟鍏崇郴
+
+ switch (skillConfig.TagAim)
{
- return config.nums[10];
+ case 0:
+ // 鍏ㄩ儴鑼冨洿
+ //鍏ㄩ儴鑼冨洿+鏁屾垜+鐩爣鏁伴噺涓�6
+ //灏辨槸鍙栨晫鎴戠珯浣嶄腑鐨�2鍙蜂綅
+ returnIndex = 1;
+ break;
+ case 1:
+ returnIndex = caster.teamHero.positionNum;
+ // 瀵绘壘瀵逛綅鏄惁鏈変汉 娌℃湁鐨勮瘽閫夋嫨鏈�灏忕殑
+ List<BattleObject> opposite = new List<BattleObject>(from bo in targetObjList where !bo.IsDead() && bo.teamHero.positionNum == returnIndex select bo);
+ if (opposite.Count > 0)
+ {
+ returnIndex = opposite[0].teamHero.positionNum;
+ }
+ else
+ {
+ opposite = new List<BattleObject>(from bo in targetObjList where !bo.IsDead() select bo);
+ opposite.Sort((a, b) => a.teamHero.positionNum.CompareTo(b.teamHero.positionNum));
+ returnIndex = opposite.Count > 0 ? opposite[0].teamHero.positionNum : returnIndex;
+ }
+ break;
+ case 2:
+ // 鐪嬬湅瀵归潰鍓嶆帓鏄惁閮芥椿鐫�
+ List<BattleObject> front = new List<BattleObject>(from bo in targetObjList where !bo.IsDead() && bo.teamHero.positionNum < 3 select bo);
+ if (front.Count > 0)
+ {
+ returnIndex = 1;
+ }
+ else
+ {
+ returnIndex = 4;
+ }
+ break;
+ case 3:
+ // 鐪嬬湅瀵归潰鍚庢帓鏄惁閮芥椿鐫�
+ List<BattleObject> back = new List<BattleObject>(from bo in targetObjList where !bo.IsDead() && bo.teamHero.positionNum >= 3 select bo);
+ if (back.Count > 0)
+ {
+ returnIndex = 4;
+ }
+ else
+ {
+ returnIndex = 1;
+ }
+ break;
+ // 4 绾垫帓锛屾寜瀵逛綅瑙勫垯閫夋嫨绾垫帓
+ case 4:
+ List<BattleObject> vertical = new List<BattleObject>(from bo in targetObjList where !bo.IsDead() && (bo.teamHero.positionNum - caster.teamHero.positionNum) % 3 == 0 select bo);
+ // TODO YYL
+ break;
+ // 5 鑷繁锛岄粯璁ゅ彧閫夎嚜宸�
+ case 5:
+ returnIndex = caster.teamHero.positionNum;
+ break;
+ default:
+ break;
}
- //k鐨凙SCII鐮佹槸107
- else if (_num == 107)
- {
- return config.nums[11];
- }
- //m鐨凙SCII鐮佹槸109
- else if (_num == 109)
- {
- return config.nums[12];
- }
- //b鐨凙SCII鐮佹槸98
- else if (_num == 98)
- {
- return config.nums[13];
- }
- //t鐨凙SCII鐮佹槸116
- else if (_num == 116)
- {
- return config.nums[14];
- }
+
+ return returnIndex;
+ }
+
+ public static int GetDamageNumKey(DamageNumConfig config, int _num)
+ {
+ if (_num == 46) return config.nums[10]; // '.'
+ else if (_num == 107) return config.nums[11]; // 'k'
+ else if (_num == 109) return config.nums[12]; // 'm'
+ else if (_num == 98) return config.nums[13]; // 'b'
+ else if (_num == 116) return config.nums[14]; // 't'
return config.nums[_num - 48];
}
diff --git a/Main/System/Battle/Define/BattleDmgInfo.cs b/Main/System/Battle/Define/BattleDmgInfo.cs
index b9f6a5a..44443ad 100644
--- a/Main/System/Battle/Define/BattleDmgInfo.cs
+++ b/Main/System/Battle/Define/BattleDmgInfo.cs
@@ -1,21 +1,125 @@
-
-
using System.Collections.Generic;
+
+public class BattleDmg
+{
+ public long damage;
+ public int attackType;
+}
public class BattleDmgInfo
{
+
public string battleFieldGuid { get; private set; }
public List<long> damageList { get; private set; }
- public int attackType { get; private set; }
public BattleObject hurtObj { get; private set; }
- public BattleDmgInfo(string battleFieldGuid, List<long> damageList, BattleObject hurtObj, int attackType)
+ public HB427_tagSCUseSkill.tagSCUseSkillHurt hurt { get; private set; }
+
+ public SkillConfig skillConfig { get; private set; }
+
+ // 鏄惁琚牸鎸′簡
+ public bool isBlocked = false;
+
+ public List<BattleDmg> battleDamageList = new List<BattleDmg>();
+
+ public BattleDmgInfo(string battleFieldGuid, List<long> damageList, BattleObject hurtObj, HB427_tagSCUseSkill.tagSCUseSkillHurt hurt, SkillConfig skillConfig)
{
this.battleFieldGuid = battleFieldGuid;
this.damageList = damageList;
this.hurtObj = hurtObj;
- this.attackType = attackType;
+ this.hurt = hurt;
+ this.skillConfig = skillConfig;
+ HandleAttackTypeAndDamage();
}
+ private void HandleAttackTypeAndDamage()
+ {
+ isBlocked = HaveBlockDamage();
+ int rawAttackType = (int)hurt.AttackTypes;
+ float blockRatio = float.Parse(GeneralDefine.parryCfg.Numerical3); // 鏍兼尅鍑忎激鐜�
+
+ for (int i = 0; i < damageList.Count; i++)
+ {
+ long actualDamage = damageList[i];
+
+ // 鏍兼尅澶勭悊
+ if (isBlocked)
+ {
+ // 鍘绘帀鏍兼尅绫诲瀷
+ int attackType = rawAttackType & (~(int)DamageType.Block);
+
+ // 璁$畻鏍兼尅浼ゅ
+ long totalDamage = (long)(actualDamage / (1 - blockRatio));
+ long blockDmg = totalDamage - actualDamage;
+ battleDamageList.Add(new BattleDmg { damage = blockDmg, attackType = (int)DamageType.Block });
+
+ // 鐪熷疄浼ゅ鐗规畩澶勭悊
+ if (IsRealdamage())
+ {
+ int showAttackType = (int)DamageType.Realdamage + (IsCrit() ? (int)DamageType.Crit : 0);
+ battleDamageList.Add(new BattleDmg { damage = actualDamage, attackType = showAttackType });
+ continue;
+ }
+
+ // 鏅�氫激瀹�/娌荤枟澶勭悊
+ if (DamageNumConfig.Get(attackType) == null)
+ {
+ UnityEngine.Debug.LogError($"鏈嶅姟鍣ㄧ粰鐨勪激瀹崇被鍨嬩笉瀵癸紝寮哄埗杞崲涓烘櫘閫氫激瀹�/娌荤枟, attackType: {attackType}");
+ if ((attackType & (int)DamageType.Damage) != 0)
+ attackType = (int)DamageType.Damage;
+ else if ((attackType & (int)DamageType.Recovery) != 0)
+ attackType = (int)DamageType.Recovery;
+ else
+ UnityEngine.Debug.LogError($"寮哄埗杞崲澶辫触锛岃绫诲瀷涓嶆槸娌荤枟涔熶笉鏄激瀹� {attackType}");
+ }
+ battleDamageList.Add(new BattleDmg { damage = actualDamage, attackType = attackType });
+ }
+ else
+ {
+ int attackType = rawAttackType;
+
+ // 鐪熷疄浼ゅ鐗规畩澶勭悊
+ if (IsRealdamage())
+ {
+ int showAttackType = (int)DamageType.Realdamage + (IsCrit() ? (int)DamageType.Crit : 0);
+ battleDamageList.Add(new BattleDmg { damage = actualDamage, attackType = showAttackType });
+ continue;
+ }
+
+ // 鏅�氫激瀹�/娌荤枟澶勭悊
+ if (DamageNumConfig.Get(attackType) == null)
+ {
+ UnityEngine.Debug.LogError($"鏈嶅姟鍣ㄧ粰鐨勪激瀹崇被鍨嬩笉瀵癸紝寮哄埗杞崲涓烘櫘閫氫激瀹�/娌荤枟, attackType: {attackType}");
+ if ((attackType & (int)DamageType.Damage) != 0)
+ attackType = (int)DamageType.Damage;
+ else if ((attackType & (int)DamageType.Recovery) != 0)
+ attackType = (int)DamageType.Recovery;
+ else
+ UnityEngine.Debug.LogError($"寮哄埗杞崲澶辫触锛岃绫诲瀷涓嶆槸娌荤枟涔熶笉鏄激瀹� {attackType}");
+ }
+ battleDamageList.Add(new BattleDmg { damage = actualDamage, attackType = attackType });
+ }
+ }
+ }
+
+ public bool IsType(DamageType damageType)
+ {
+ return (hurt.AttackTypes & (int)damageType) == (int)damageType;
+ }
+
+ public bool IsCrit()
+ {
+ return IsType(DamageType.Crit);
+ }
+
+ public bool HaveBlockDamage()
+ {
+ return IsType(DamageType.Block);
+ }
+
+ public bool IsRealdamage()
+ {
+ return skillConfig.HurtType / 10 == 1;
+ }
}
\ No newline at end of file
diff --git a/Main/System/Battle/Define/DamageType.cs b/Main/System/Battle/Define/DamageType.cs
index 95f6cc8..352eb75 100644
--- a/Main/System/Battle/Define/DamageType.cs
+++ b/Main/System/Battle/Define/DamageType.cs
@@ -3,16 +3,30 @@
public enum DamageType
{
- Damage, //鏅�氫激瀹�
- Recovery, //娌荤枟
- Reflect, //鍙嶅脊浼ゅ
- Bloody, //娴佽浼ゅ
- Block, //鏍兼尅
- Critical, //鏆村嚮
- Dodge, //闂伩
- Combo, //杩炲嚮
- CounterAttack, //鍙嶅嚮
- RageUp, //鎬掓皵鎻愬崌
+ Damage = 1, //鏅�氫激瀹�
-
-}
\ No newline at end of file
+ Recovery = 2, //娌荤枟
+
+ Reflect = 4, //鍙嶅脊浼ゅ
+
+ Bloody = 8, //娴佽浼ゅ
+
+ Block = 16, //鏍兼尅
+
+ Crit = 32, //鏆村嚮
+
+ Dodge = 64, //闂伩
+
+ RageUp = 128, //鎬掓皵鎻愬崌
+
+ SuckHP = 256, //鍚歌
+
+ Realdamage = 512, //鐪熶激
+
+ CritDamage = Crit + Damage, //鏆村嚮浼ゅ
+
+ CritHeal = Crit + Recovery, //鏆村嚮鍥炶
+
+ CritRealdamage = Crit + Realdamage, //鏆村嚮鐪熶激
+}
+
diff --git a/Main/System/Battle/Motion/MotionBase.cs b/Main/System/Battle/Motion/MotionBase.cs
index 1cb828c..41a1931 100644
--- a/Main/System/Battle/Motion/MotionBase.cs
+++ b/Main/System/Battle/Motion/MotionBase.cs
@@ -14,9 +14,9 @@
public static List<string> AttackMotionList = new List<string>
{
- MotionName.attack.ToString(),
- MotionName.angerSkill.ToString(),
- MotionName.passiveSkill.ToString(),
+ MotionName.attack.ToString().ToLower(),
+ MotionName.angerSkill.ToString().ToLower(),
+ MotionName.passiveSkill.ToString().ToLower(),
};
private Dictionary<Spine.TrackEntry, Action> trackEntryCompleteDict = new Dictionary<Spine.TrackEntry, Action>();
@@ -24,7 +24,7 @@
// 鍔ㄧ敾浜嬩欢
public Action OnAttackAnimationComplete;
public Action OnHitAnimationComplete;
- public Action<MotionName> onAnimationComplete;
+ public Action<string> onAnimationComplete;
#region 缁勪欢寮曠敤
@@ -147,8 +147,24 @@
return null;
}
- // 鑾峰彇鍔ㄧ敾
+
Spine.Animation anim = skeleton.Data.FindAnimation(skillConfig.SkillMotionName);
+
+ if (null == anim)
+ {
+ for (int i = 0; i < skeleton.Data.Animations.Count; i++)
+ {
+ var skeletonAnim = skeleton.Data.Animations.Items[i];
+ if (skeletonAnim.Name.ToLower() == skillConfig.SkillMotionName.ToLower())
+ {
+ anim = skeletonAnim;
+ // 鎵惧埌鍔ㄧ敾
+ break;
+ }
+ }
+ }
+
+ // 鑾峰彇鍔ㄧ敾
if (anim == null)
{
BattleDebug.LogError($"鎵句笉鍒板姩鐢�: {skillConfig.SkillMotionName}");
@@ -288,7 +304,7 @@
/// </summary>
protected virtual void OnAnimationComplete(Spine.TrackEntry trackEntry)
{
- string animation = trackEntry.Animation.Name;
+ string animation = trackEntry.Animation.Name.ToLower();
// 鏀诲嚮鍔ㄧ敾瀹屾垚鍚庢仮澶嶅埌寰呮満鐘舵��
if (AttackMotionList.Contains(animation))
@@ -297,12 +313,13 @@
PlayAnimation(MotionName.idle, true);
}
// 鍙椾激鍔ㄧ敾瀹屾垚鍚庢仮澶嶅埌寰呮満鐘舵�� 鍙兘瑙﹀彂澶氭 鍥犱负鏈夊娈垫敾鍑荤殑瀛樺湪
- else if (animation == MotionName.hit.ToString())
+ else if (animation == MotionName.hit.ToString().ToLower())
{
OnHitAnimationComplete?.Invoke();
PlayAnimation(MotionName.idle, true);
}
- onAnimationComplete?.Invoke((MotionName)Enum.Parse(typeof(MotionName), animation));
+
+ onAnimationComplete?.Invoke(animation);
// 鍙皟鐢ㄦ湰娆rackEntry鐨勫洖璋�
if (trackEntryCompleteDict.TryGetValue(trackEntry, out var cb))
@@ -312,51 +329,6 @@
}
}
-
- public void Test(string animationName, int beginFrame, int activeFrame, int endFrame, int activeFrameLoopCount)
- {
- // 瑕佸鐞嗗墠鎽嘼eginFrame 鍚庢憞endFrame 涓憞activeFrame
-
- // 涓憞鏄湁澶氭鐨刟ctiveFrameLoopCount
-
- var state = spineAnimationState;
- var anim = skeleton.Data.FindAnimation(animationName);
-
- // 璁惧畾浣犺寰幆鐨勫尯闂达紙鍗曚綅锛氱锛�
- float loopStart = 0.5f;
- float loopEnd = 1.2f;
-
- // 鎾斁鍔ㄧ敾
- state.SetAnimation(0, anim, true);
- // state.GetCurrent(0).TrackTime = loopStart;
-
- int curFrame = 0;
-
- skeletonGraphic.UpdateLocal += (skeletonAnim) =>
- {
- // if (curFrame == beginFrame)
- // {
- // OnBeginFrame?.Invoke();
- // }
- // else if (curFrame == activeFrame)
- // {
- // OnActiveFrame?.Invoke();
- // }
- // else if (curFrame == endFrame)
- // {
- // OnEndFrame?.Invoke();
- // }
- // var trackEntry = state.GetCurrent(0);
- // if (trackEntry != null && trackEntry.Animation == anim)
- // {
- // if (trackEntry.TrackTime > loopEnd)
- // {
- // // 鍥炲埌loopStart锛屽疄鐜板尯闂村惊鐜�
- // trackEntry.TrackTime = loopStart;
- // }
- // }
- };
- }
public virtual void Run()
diff --git a/Main/System/Battle/RecordPlayer/RecordPlayer.cs b/Main/System/Battle/RecordPlayer/RecordPlayer.cs
index d25115e..14376d4 100644
--- a/Main/System/Battle/RecordPlayer/RecordPlayer.cs
+++ b/Main/System/Battle/RecordPlayer/RecordPlayer.cs
@@ -9,6 +9,8 @@
private Queue<RecordAction> recordActionQueue = new Queue<RecordAction>();
protected RecordAction currentRecordAction;
+ protected List<RecordAction> immediatelyActionList = new List<RecordAction>();
+
private bool isWaitingNextAction = false;
private float waitTimer = 0f;
private const float waitInterval = 0.2f;
@@ -20,7 +22,7 @@
public bool IsPlaying()
{
- return currentRecordAction != null || recordActionQueue.Count > 0;
+ return currentRecordAction != null || recordActionQueue.Count > 0 || immediatelyActionList.Count > 0;
}
public void PlayRecord(RecordAction recordAction)
@@ -37,8 +39,60 @@
}
}
+ public void InsertRecord(RecordAction recordAction)
+ {
+ BattleDebug.LogError("Insert record action " + recordAction.GetType());
+ if (currentRecordAction != null)
+ {
+ Queue<RecordAction> tempQueue = new Queue<RecordAction>();
+ tempQueue.Enqueue(recordAction);
+ while (recordActionQueue.Count > 0)
+ {
+ tempQueue.Enqueue(recordActionQueue.Dequeue());
+ }
+ recordActionQueue = tempQueue;
+ }
+ else
+ {
+ recordActionQueue.Enqueue(recordAction);
+ }
+ }
+
+ public void ImmediatelyPlay(RecordAction recordAction)
+ {
+ immediatelyActionList.Add(recordAction);
+ }
+
+ protected void ImmediatelyPlayRun()
+ {
+ if (immediatelyActionList.Count > 0)
+ {
+ List<int> removeIndexList = new List<int>();
+
+ for (int i = immediatelyActionList.Count - 1; i >= 0; i--)
+ {
+ var action = immediatelyActionList[i];
+ if (action.IsFinished())
+ {
+ removeIndexList.Add(i);
+ }
+ else
+ {
+ action.Run();
+ }
+ }
+
+ for (int i = removeIndexList.Count - 1; i >= 0; i--)
+ {
+ immediatelyActionList.RemoveAt(removeIndexList[i]);
+ }
+ }
+ }
+
public virtual void Run()
{
+ ImmediatelyPlayRun();
+
// 绛夊緟涓嬩竴涓猘ction
if (isWaitingNextAction)
{
diff --git a/Main/System/Battle/Skill/DirectlyDamageSkill.cs b/Main/System/Battle/Skill/DirectlyDamageSkill.cs
index 5227c71..977e345 100644
--- a/Main/System/Battle/Skill/DirectlyDamageSkill.cs
+++ b/Main/System/Battle/Skill/DirectlyDamageSkill.cs
@@ -12,10 +12,7 @@
HB427_tagSCUseSkill _vNetData, List<GameNetPackBasic> _packList, BattleField _battleField)
: base(_caster, _skillCfg, _vNetData, _packList, _battleField)
{
- foreach (var pack in packList)
- {
- BattleDebug.LogError("directly damage skill pack type is " + pack.GetType());
- }
+
}
protected override void OnHitTargets(int _hitIndex, List<HB427_tagSCUseSkill.tagSCUseSkillHurt> hitList)
diff --git a/Main/System/Battle/Skill/DirectlyHealSkill.cs b/Main/System/Battle/Skill/DirectlyHealSkill.cs
index 9facf9f..cefe803 100644
--- a/Main/System/Battle/Skill/DirectlyHealSkill.cs
+++ b/Main/System/Battle/Skill/DirectlyHealSkill.cs
@@ -12,10 +12,7 @@
HB427_tagSCUseSkill _vNetData, List<GameNetPackBasic> _packList, BattleField _battleField)
: base(_caster, _skillCfg, _vNetData, _packList, _battleField)
{
- foreach (var pack in packList)
- {
- BattleDebug.LogError("directly heal skill pack type is " + pack.GetType());
- }
+
}
public override void Run()
diff --git a/Main/System/Battle/Skill/SkillBase.cs b/Main/System/Battle/Skill/SkillBase.cs
index a3c580b..247d755 100644
--- a/Main/System/Battle/Skill/SkillBase.cs
+++ b/Main/System/Battle/Skill/SkillBase.cs
@@ -39,6 +39,8 @@
protected List<HB405_tagMCAddExp> expPackList = new List<HB405_tagMCAddExp>();
+ protected bool moveFinished = false;
+
public SkillBase(BattleObject _caster, SkillConfig _skillCfg, HB427_tagSCUseSkill vNetData, List<GameNetPackBasic> _packList, BattleField _battleField = null)
{
caster = _caster;
@@ -46,6 +48,8 @@
tagUseSkillAttack = vNetData;
battleField = _battleField;
packList = _packList;
+
+
}
@@ -95,12 +99,10 @@
{
EventBroadcast.Instance.Broadcast<string, SkillConfig, TeamHero>(EventName.BATTLE_CAST_SKILL, battleField.guid, skillConfig, caster.teamHero);
- BattleDebug.LogError(GetType().Name + " Skill Cast Start");
// 楂樹寒鎵�鏈夋湰娆℃妧鑳界浉鍏崇殑鐩爣
HighLightAllTargets();
// 璺濈閰嶆垚璐熸暟瑕佽浆韬� TurnBack
- BattleDebug.LogError(GetType().Name + " Skill CastMode : " + skillConfig.castMode);
switch (skillConfig.castMode)
{
case SkillCastMode.Self:
@@ -119,15 +121,15 @@
// DashToTarget(() => BackToOrigin(OnSkillFinished));
// break;
default:
- BattleDebug.LogError("鏆傛椂涓嶆敮鎸佸叾浠栫殑鏂瑰紡閲婃斁 鏈夐渶姹傝鑱旂郴绛栧垝 鎶�鑳絠d:" + skillConfig.SkillID + " cast position " + skillConfig.CastPosition);
+ Debug.LogError("鏆傛椂涓嶆敮鎸佸叾浠栫殑鏂瑰紡閲婃斁 鏈夐渶姹傝鑱旂郴绛栧垝 鎶�鑳絠d:" + skillConfig.SkillID + " cast position " + skillConfig.CastPosition);
OnSkillFinished();
break;
}
+
}
protected void MoveToTarget(RectTransform target, Vector2 offset, float duration, Action onComplete = null)
{
- BattleDebug.LogError("Move to target , target is " + target.name);
// 鍘熷湴閲婃斁
if (skillConfig.CastDistance >= 9999)
{
@@ -193,7 +195,7 @@
// 鐩爣鏄晫鏂逛富鐩爣
if (tagUseSkillAttack.HurtCount <= 0)
{
- BattleDebug.LogError("鎶�鑳芥敾鍑诲寘娌℃湁鐩爣 HurtCount <= 0");
+ Debug.LogError("鎶�鑳芥敾鍑诲寘娌℃湁鐩爣 HurtCount <= 0");
OnSkillFinished();
return;
}
@@ -203,7 +205,7 @@
BattleObject mainTarget = battleField.battleObjMgr.GetBattleObject((int)mainHurt.ObjID);
if (mainTarget == null)
{
- BattleDebug.LogError("鐩爣涓虹┖ mainTarget == null ObjID : " + mainHurt.ObjID);
+ Debug.LogError("鐩爣涓虹┖ mainTarget == null ObjID : " + mainHurt.ObjID);
OnSkillFinished();
return;
}
@@ -235,7 +237,7 @@
protected virtual void OnAllAttackMoveFinished()
{
-
+ moveFinished = true;
}
protected void CastToAllies()
@@ -285,7 +287,7 @@
}
// 鎶�鑳藉紑濮�
- public virtual void OnSkillStart()
+ public void OnSkillStart()
{
skillEffect = SkillEffectFactory.CreateSkillEffect(
caster,
@@ -296,6 +298,9 @@
{
skillEffect.Play(OnHitTargets);
}
+
+
+
}
// 鎶�鑳藉墠鎽囧抚缁撴潫
@@ -310,12 +315,18 @@
/// <param name="times"></param>
public virtual void OnMiddleFrameStart(int times)
{
- skillEffect.OnMiddleFrameStart(times);
+ if (skillEffect != null)
+ {
+ skillEffect.OnMiddleFrameStart(times);
+ }
}
public virtual void OnMiddleFrameEnd(int times, int hitIndex)
{
- skillEffect.OnMiddleFrameEnd(times, hitIndex);
+ if (skillEffect != null)
+ {
+ skillEffect.OnMiddleFrameEnd(times, hitIndex);
+ }
}
/// <summary>
@@ -358,13 +369,12 @@
BattleObject target = caster.battleField.battleObjMgr.GetBattleObject((int)hurt.ObjID);
if (target == null)
{
- BattleDebug.LogError("鐩爣涓虹┖ target == null ObjId : " + hurt.ObjID);
+ Debug.LogError("鐩爣涓虹┖ target == null ObjId : " + hurt.ObjID);
continue;
}
OnHitEachTarget(_hitIndex, target, hurt);
}
-
HandleDead();
}
@@ -389,11 +399,11 @@
// TODO YYL AttackTypes 瑕佽〃鐜版垚浠�涔堟牱鍛紵 鏀寔澶氱绫诲瀷骞跺瓨锛屽鏃犺闃插尽涓旀毚鍑诲悓鏃惰鏍兼尅锛屼簩杩涘埗鎴栬繍绠楁渶缁堝�硷紱0-澶辫触锛�1-鏅�氾紱2-鍥炶锛�5-鏍兼尅锛�6-鏃犺闃插尽锛�7-鏆村嚮锛�9-闂伩
- target.Hurt(damageList, totalDamage, hurt.AttackTypes);
+ target.Hurt(damageList, totalDamage, hurt, skillConfig);
// TODO YYL 杩欓噷鏄鍋氱粺涓�璁$畻鍚庡啀hurt璺焥uckhp杩樻槸鎬庢牱
- // caster.SuckHp(hurt.SuckHP);// 鍚歌
- // caster.HurtByReflect(hurt.BounceHP);// 鍙嶅脊浼ゅ
+ caster.SuckHp(hurt.SuckHP, skillConfig);// 鍚歌
+ caster.HurtByReflect(hurt.BounceHP, skillConfig);// 鍙嶅脊浼ゅ
}
@@ -413,7 +423,6 @@
// 澶勭悊鎺夎惤鍖� 鎻愬墠distribute涔嬪悗 PackManager鎵嶆湁鎺夎惤鐗� 鎵�浠ヤ笉璺焌ssignexp涓�鏍穌istribute
foreach (var _dropPack in dropPackList)
{
- BattleDebug.LogError("distribute pack " + _dropPack.GetType().Name);
PackageRegedit.Distribute(_dropPack);
packList.Remove(_dropPack);
}
@@ -456,8 +465,6 @@
packList.Remove(deadPack);
}
deadPackList.Clear();
-
-
}
@@ -575,7 +582,7 @@
}
}
- return isFinished;
+ return isFinished && moveFinished;
}
public virtual void ForceFinished()
@@ -593,7 +600,6 @@
}
}
- BattleDebug.LogError(GetType().Name + " Skill Finished");
while (packList.Count > 0)
{
var pack = packList[0];
@@ -604,11 +610,11 @@
var combinePack = pack as CustomHB426CombinePack;
if (combinePack.startTag.Tag.StartsWith("Skill_"))
{
+ BattleDebug.LogError("other skill casting " + combinePack.startTag.Tag);
otherSkillAction = combinePack.CreateSkillAction();
return;
}
}
- BattleDebug.LogError("distribute pack " + pack.GetType().Name);
PackageRegedit.Distribute(pack);
}
diff --git a/Main/System/Battle/Skill/SkillFactory.cs b/Main/System/Battle/Skill/SkillFactory.cs
index 13db911..3654df9 100644
--- a/Main/System/Battle/Skill/SkillFactory.cs
+++ b/Main/System/Battle/Skill/SkillFactory.cs
@@ -53,9 +53,6 @@
return null;
}
- Debug.LogError("skill type is " + skillConfig.SkillType + " skill id is " + vNetData.SkillID);
-
-
SkillBase skill = null;
switch (skillConfig.SkillType)
{
diff --git a/Main/System/Battle/SkillEffect/BulletCurve/BounceBulletCurve.cs b/Main/System/Battle/SkillEffect/BulletCurve/BounceBulletCurve.cs
index 778b489..32f90d1 100644
--- a/Main/System/Battle/SkillEffect/BulletCurve/BounceBulletCurve.cs
+++ b/Main/System/Battle/SkillEffect/BulletCurve/BounceBulletCurve.cs
@@ -67,7 +67,7 @@
}
else
{
- BattleDebug.LogError("寮瑰皠鎵句笉鍒颁笅涓�涓洰鏍�");
+ Debug.LogError("寮瑰皠鎵句笉鍒颁笅涓�涓洰鏍�");
// 濡傛灉鐩爣涓㈠け锛岀洿鎺ョ敤涓婁竴涓猠nd
end = start;
}
diff --git a/Main/System/Battle/SkillEffect/BulletCurve/StraightBulletCurve.cs b/Main/System/Battle/SkillEffect/BulletCurve/StraightBulletCurve.cs
index be9d051..c9a41e2 100644
--- a/Main/System/Battle/SkillEffect/BulletCurve/StraightBulletCurve.cs
+++ b/Main/System/Battle/SkillEffect/BulletCurve/StraightBulletCurve.cs
@@ -10,7 +10,7 @@
public StraightBulletCurve(BattleObject caster, SkillConfig skillConfig, BattleEffectPlayer bulletEffect, RectTransform target, HB427_tagSCUseSkill tagUseSkillAttack, Action<int, List<HB427_tagSCUseSkill.tagSCUseSkillHurt>> onHit)
: base(caster, skillConfig, bulletEffect, target, tagUseSkillAttack, onHit)
{
- BattleDebug.LogError("StraightBulletCurve created bulletTrans is null = " + (bulletTrans == null).ToString());
+
}
public override void Reset()
@@ -28,18 +28,23 @@
if (bulletTrans == null)
{
- BattleDebug.LogError("BulletTrans is null, cannot run StraightBulletCurve");
- return;
+ Debug.LogError("BulletTrans is null, cannot run StraightBulletCurve");
}
elapsed += Time.deltaTime;
float t = Mathf.Clamp01(elapsed / duration);
Vector2 pos = Vector2.Lerp(start, end, t);
- bulletTrans.anchoredPosition = pos;
+ if (null != bulletTrans)
+ {
+ bulletTrans.anchoredPosition = pos;
+ }
Vector2 dir = end - start;
float angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg;
- bulletTrans.localRotation = Quaternion.Euler(0, bulletTrans.transform.localScale.x < 0f ? 180 : 0, angle);
+ if (null != bulletTrans)
+ {
+ bulletTrans.localRotation = Quaternion.Euler(0, bulletTrans.transform.localScale.x < 0f ? 180 : 0, angle);
+ }
// if (bulletTrans.transform.localScale.x < 0f)
// {
// bulletTrans.transform.localRotation *= Quaternion.Euler(0, 180, 0);
diff --git a/Main/System/Battle/SkillEffect/BulletSkillEffect.cs b/Main/System/Battle/SkillEffect/BulletSkillEffect.cs
index 0918bfe..c4112d5 100644
--- a/Main/System/Battle/SkillEffect/BulletSkillEffect.cs
+++ b/Main/System/Battle/SkillEffect/BulletSkillEffect.cs
@@ -30,7 +30,7 @@
BattleObject targetObject = caster.battleField.battleObjMgr.GetBattleObject((int)hurt.ObjID);
if (targetObject == null)
{
- BattleDebug.LogError("鐩爣涓虹┖ target == null ObjId : " + hurt.ObjID);
+ Debug.LogError("鐩爣涓虹┖ target == null ObjId : " + hurt.ObjID);
return;
}
ShotToTarget(targetObject);
@@ -38,43 +38,85 @@
// 鏅�氱殑鍋氭硶 鍖哄垎鎵撳悜闃佃惀鎴栬�呮墦鍚戜釜浣�
else
{
- Action<int, List<HB427_tagSCUseSkill.tagSCUseSkillHurt>> onHitFormation = (_hitIndex, _hurtList) =>
- {
- onHit?.Invoke(_hitIndex, tagUseSkillAttack.HurtList.ToList());
- };
- switch (skillConfig.castMode)
- {
- case SkillCastMode.Self:
- onHitFormation?.Invoke(0, tagUseSkillAttack.HurtList.ToList());
- BattleDebug.LogError("瀛愬脊鐨勭洰鏍囨槸鑷繁锛屾殏鏃朵笉鏀寔 鍗忓晢绋嬪簭瀹屾垚");
- break;
- case SkillCastMode.Enemy:
- var targetNode = caster.battleField.GetTeamNode(caster.GetEnemyCamp(), skillConfig);
- ShotToFormation(targetNode, onHitFormation);
- break;
- case SkillCastMode.Target:
- for (int i = 0; i < tagUseSkillAttack.HurtList.Length; i++)
- {
- var hurt = tagUseSkillAttack.HurtList[i];
- BattleObject target = caster.battleField.battleObjMgr.GetBattleObject((int)hurt.ObjID);
- if (target == null)
- {
- BattleDebug.LogError("鐗规晥鐩爣涓虹┖ target == null ObjId : " + hurt.ObjID);
- continue;
- }
+ // 鍖哄垎鏁e皠璺熻寖鍥存敾鍑�
- ShotToTarget(target);
+ if (skillConfig.Scattering == 1)
+ {
+ // 鏁e皠
+ for (int i = 0; i < tagUseSkillAttack.HurtList.Length; i++)
+ {
+ var hurt = tagUseSkillAttack.HurtList[i];
+ BattleObject target = caster.battleField.battleObjMgr.GetBattleObject((int)hurt.ObjID);
+ if (target == null)
+ {
+ Debug.LogError("鐗规晥鐩爣涓虹┖ target == null ObjId : " + hurt.ObjID);
+ continue;
}
- break;
- case SkillCastMode.Allies:
- var healNode = caster.battleField.GetTeamNode(caster.Camp, skillConfig);
- ShotToFormation(healNode, onHitFormation);
- break;
- default:
- BattleDebug.LogError("鏆傛椂涓嶆敮鎸佸叾浠栫殑鏂瑰紡閲婃斁 鏈夐渶姹傝鑱旂郴绋嬪簭 " + skillConfig.SkillID);
- break;
+
+ ShotToTarget(target);
+ }
+ }
+ else
+ {
+ // 鑼冨洿鏀诲嚮
+ // 鏀诲嚮鍚戝叧閿綅缃� 鐒跺悗鎵�鏈変汉鍙椾激
+ int mainTargetIndex = BattleUtility.GetMainTargetPositionNum(caster, tagUseSkillAttack.HurtList.ToList(), skillConfig);
+
+ BattleCamp battleCamp = skillConfig.TagFriendly != 0 ? caster.Camp : caster.GetEnemyCamp();
+
+ RectTransform rectTarget = caster.battleField.GetTeamNode(battleCamp, mainTargetIndex);
+
+ Action<int, List<HB427_tagSCUseSkill.tagSCUseSkillHurt>> onHitFormation = (_hitIndex, _hurtList) =>
+ {
+ onHit?.Invoke(_hitIndex, tagUseSkillAttack.HurtList.ToList());
+ };
+
+ if (skillConfig.TagCount >= 6)
+ {
+ ShotToFormation(rectTarget, onHitFormation);
+ }
+ else
+ {
+ ShotToFormationEx(rectTarget, onHitFormation);
+ }
}
}
+ }
+
+ private void ShotToFormationEx(RectTransform target, Action<int, List<HB427_tagSCUseSkill.tagSCUseSkillHurt>> _onHit)
+ {
+ BattleEffectPlayer effectPlayer = caster.battleField.battleEffectMgr.PlayEffect(caster.ObjID, skillConfig.BulletEffectId, caster.heroRectTrans, caster.Camp);
+
+ RectTransform effectTrans = effectPlayer.transform as RectTransform;
+
+ var bulletCurve = BulletCurveFactory.CreateBulletCurve(caster, skillConfig, effectPlayer, target, tagUseSkillAttack, (index, hitList) =>
+ {
+ // 鍑讳腑灏遍攢姣佸瓙寮�
+ caster.battleField.battleEffectMgr.RemoveEffect(skillConfig.BulletEffectId, effectPlayer);
+ // 鎾斁瀛愬脊鐖嗙偢鐗规晥
+
+ BattleCamp battleCamp = skillConfig.TagFriendly != 0 ? caster.Camp : caster.GetEnemyCamp();
+
+ foreach (var hurt in hitList)
+ {
+ BattleObject targetObj = caster.battleField.battleObjMgr.GetBattleObject((int)hurt.ObjID);
+ if (targetObj == null)
+ {
+ Debug.LogError("鐩爣涓虹┖ target == null ObjId : " + hurt.ObjID);
+ continue;
+ }
+
+ PlayExplosionEffect(skillConfig.ExplosionEffectId, targetObj.heroGo.transform, targetObj.Camp);
+ PlayExplosionEffect(skillConfig.ExplosionEffect2, targetObj.heroGo.transform, targetObj.Camp);
+ PlayExplosionEffect(skillConfig.ExplosionEffect3, targetObj.heroGo.transform, targetObj.Camp);
+ }
+
+ // 琛ㄧ幇瀛愬脊椋炶鍒扮洰鏍囦綅缃�
+ _onHit?.Invoke(index, hitList);
+ isFinish = true;
+ });
+
+ bulletCurves.Add(bulletCurve);
}
protected void ShotToFormation(RectTransform target, Action<int, List<HB427_tagSCUseSkill.tagSCUseSkillHurt>> _onHit)
@@ -85,34 +127,31 @@
var bulletCurve = BulletCurveFactory.CreateBulletCurve(caster, skillConfig, effectPlayer, target, tagUseSkillAttack, (index, hitList) =>
{
- // 琛ㄧ幇瀛愬脊椋炶鍒扮洰鏍囦綅缃�
- _onHit?.Invoke(index, hitList);
-
// 鍑讳腑灏遍攢姣佸瓙寮�
caster.battleField.battleEffectMgr.RemoveEffect(skillConfig.BulletEffectId, effectPlayer);
// 鎾斁瀛愬脊鐖嗙偢鐗规晥
+
+ BattleCamp battleCamp = skillConfig.TagFriendly != 0 ? caster.Camp : caster.GetEnemyCamp();
+ // 棣栧厛鏄洰鏍囪韩涓婄垎鐐�
+ PlayExplosionEffect(skillConfig.ExplosionEffectId, target, battleCamp);
+ PlayExplosionEffect(skillConfig.ExplosionEffect2, target, battleCamp);
foreach (var hurt in hitList)
{
BattleObject targetObj = caster.battleField.battleObjMgr.GetBattleObject((int)hurt.ObjID);
if (targetObj == null)
{
- BattleDebug.LogError("鐩爣涓虹┖ target == null ObjId : " + hurt.ObjID);
+ Debug.LogError("鐩爣涓虹┖ target == null ObjId : " + hurt.ObjID);
continue;
}
- var effect1 = caster.battleField.battleEffectMgr.PlayEffect(targetObj.ObjID, skillConfig.ExplosionEffectId, targetObj.heroGo.transform, targetObj.Camp);
- var effect2 = caster.battleField.battleEffectMgr.PlayEffect(targetObj.ObjID, skillConfig.ExplosionEffect2, targetObj.heroGo.transform, targetObj.Camp);
- if (effect1 != null)
- {
- effect1.transform.localRotation = effectTrans.localRotation;
- }
- if (effect2 != null)
- {
- effect2.transform.localRotation = effectTrans.localRotation;
- }
+ PlayExplosionEffect(skillConfig.ExplosionEffectId, targetObj.heroGo.transform, targetObj.Camp);
}
+ // 琛ㄧ幇瀛愬脊椋炶鍒扮洰鏍囦綅缃�
+ _onHit?.Invoke(index, hitList);
+
+ isFinish = true;
});
bulletCurves.Add(bulletCurve);
@@ -121,58 +160,53 @@
protected void ShotToTarget(BattleObject target)
{
- BattleDebug.LogError("鍙戝皠瀛愬脊 " + skillConfig.BulletEffectId);
BattleEffectPlayer effectPlayer = caster.battleField.battleEffectMgr.PlayEffect(caster.ObjID, skillConfig.BulletEffectId, caster.heroRectTrans, caster.Camp);
var bulletCurve = BulletCurveFactory.CreateBulletCurve(caster, skillConfig, effectPlayer, target.heroRectTrans, tagUseSkillAttack, (index, hitList) =>
{
- // 琛ㄧ幇瀛愬脊椋炶鍒扮洰鏍囦綅缃�
- onHit?.Invoke(index, hitList);
-
-
- BattleDebug.LogError("鍥炴敹瀛愬脊 " + skillConfig.BulletEffectId);
- // 鎾斁瀛愬脊鐖嗙偢鐗规晥
-
-
foreach (var hurt in hitList)
{
BattleObject targetObj = caster.battleField.battleObjMgr.GetBattleObject((int)hurt.ObjID);
if (targetObj == null)
{
- BattleDebug.LogError("鐩爣涓虹┖ target == null ObjId : " + hurt.ObjID);
+ Debug.LogError("鐩爣涓虹┖ target == null ObjId : " + hurt.ObjID);
continue;
}
- if (skillConfig.ExplosionEffectId > 0)
- {
- var eft = caster.battleField.battleEffectMgr.PlayEffect(targetObj.ObjID, skillConfig.ExplosionEffectId, targetObj.heroGo.transform, targetObj.Camp);
- eft.transform.localRotation = effectPlayer.transform.localRotation;
- if (eft.transform.localScale.x < 0f)
- {
- eft.transform.localRotation *= Quaternion.Euler(0, 180, 0);
- }
- }
-
- if (skillConfig.ExplosionEffect2 > 0)
- {
- var eft = caster.battleField.battleEffectMgr.PlayEffect(targetObj.ObjID, skillConfig.ExplosionEffect2, targetObj.heroGo.transform, targetObj.Camp);
- eft.transform.localRotation = effectPlayer.transform.localRotation;
- if (eft.transform.localScale.x < 0f)
- {
- eft.transform.localRotation *= Quaternion.Euler(0, 180, 0);
- }
- }
+ PlayExplosionEffect(skillConfig.ExplosionEffectId, targetObj.heroGo.transform, targetObj.Camp);
+ PlayExplosionEffect(skillConfig.ExplosionEffect2, targetObj.heroGo.transform, targetObj.Camp);
+ PlayExplosionEffect(skillConfig.ExplosionEffect3, targetObj.heroGo.transform, targetObj.Camp);
}
+ // 琛ㄧ幇瀛愬脊椋炶鍒扮洰鏍囦綅缃�
+ onHit?.Invoke(index, hitList);
// 鍑讳腑灏遍攢姣佸瓙寮�
caster.battleField.battleEffectMgr.RemoveEffect(skillConfig.BulletEffectId, effectPlayer);
+
+ // 鎾斁瀛愬脊鐖嗙偢鐗规晥
isFinish = true;
});
bulletCurves.Add(bulletCurve);
}
+ protected void PlayExplosionEffect(int effectId, Transform parent, BattleCamp camp)
+ {
+ if (effectId <= 0)
+ return;
+
+ var effect = caster.battleField.battleEffectMgr.PlayEffect(0, effectId, parent, camp);
+ if (effect != null)
+ {
+ effect.transform.localRotation = parent.localRotation;
+ if (effect.transform.localScale.x < 0f)
+ {
+ effect.transform.localRotation *= Quaternion.Euler(0, 180, 0);
+ }
+ }
+ }
+
public override void Run()
diff --git a/Main/System/Battle/SkillEffect/NormalSkillEffect.cs b/Main/System/Battle/SkillEffect/NormalSkillEffect.cs
index 3949b1c..be52bf9 100644
--- a/Main/System/Battle/SkillEffect/NormalSkillEffect.cs
+++ b/Main/System/Battle/SkillEffect/NormalSkillEffect.cs
@@ -20,19 +20,30 @@
public override void OnMiddleFrameEnd(int times, int hitIndex)
{
- BattleDebug.LogError($" NormalSkillEffect OnMiddleFrameEnd times : {times}, hitIndex : {hitIndex}");
for (int i = 0; i < tagUseSkillAttack.HurtList.Length; i++)
{
var hurt = tagUseSkillAttack.HurtList[i];
BattleObject target = caster.battleField.battleObjMgr.GetBattleObject((int)hurt.ObjID);
if (target == null)
{
- BattleDebug.LogError("鐗规晥鐩爣涓虹┖ target == null ObjId : " + hurt.ObjID);
+ Debug.LogError("鐗规晥鐩爣涓虹┖ target == null ObjId : " + hurt.ObjID);
continue;
}
- caster.battleField.battleEffectMgr.PlayEffect(target.ObjID, skillConfig.ExplosionEffectId, target.heroGo.transform, target.Camp);
- caster.battleField.battleEffectMgr.PlayEffect(target.ObjID, skillConfig.ExplosionEffect2, target.heroGo.transform, target.Camp);
+ if (skillConfig.ExplosionEffectId > 0)
+ {
+ caster.battleField.battleEffectMgr.PlayEffect(target.ObjID, skillConfig.ExplosionEffectId, target.heroGo.transform, target.Camp);
+ }
+
+ if (skillConfig.ExplosionEffect2 > 0)
+ {
+ caster.battleField.battleEffectMgr.PlayEffect(target.ObjID, skillConfig.ExplosionEffect2, target.heroGo.transform, target.Camp);
+ }
+
+ if (skillConfig.ExplosionEffect3 > 0)
+ {
+ caster.battleField.battleEffectMgr.PlayEffect(target.ObjID, skillConfig.ExplosionEffect3, target.heroGo.transform, target.Camp);
+ }
}
onHit?.Invoke(hitIndex, tagUseSkillAttack.HurtList.ToList());
diff --git a/Main/System/Battle/TestMoveToTarget.cs b/Main/System/Battle/TestMoveToTarget.cs
index 2ed3b91..d5d8d44 100644
--- a/Main/System/Battle/TestMoveToTarget.cs
+++ b/Main/System/Battle/TestMoveToTarget.cs
@@ -13,7 +13,7 @@
{
if (sourceRect == null || targetRect == null)
{
- BattleDebug.LogError("璇峰湪Inspector涓寚瀹歴ourceRect鍜宼argetRect锛�");
+ Debug.LogError("璇峰湪Inspector涓寚瀹歴ourceRect鍜宼argetRect锛�");
return;
}
diff --git a/Main/System/Battle/UIComp/BattleTips.cs b/Main/System/Battle/UIComp/BattleTips.cs
index d1b8e07..6457858 100644
--- a/Main/System/Battle/UIComp/BattleTips.cs
+++ b/Main/System/Battle/UIComp/BattleTips.cs
@@ -35,7 +35,6 @@
{
OnFinish?.Invoke();
OnFinish = null;
- gameObject.SetActive(false);
return;
}
diff --git a/Main/System/Battle/UIComp/DamageContent.cs b/Main/System/Battle/UIComp/DamageContent.cs
index 3c5e872..357149f 100644
--- a/Main/System/Battle/UIComp/DamageContent.cs
+++ b/Main/System/Battle/UIComp/DamageContent.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
using System;
+using Cysharp.Threading.Tasks;
public class DamageContent : MonoBehaviour
{
@@ -13,14 +14,33 @@
public PositionTween posTween;
+ public ScaleTween scaleTween;
+
+ private BattleDmgInfo battleDmgInfo;
+
void Awake()
{
line.SetActive(false);
}
- public void SetDamage(BattleDmgInfo damageInfo, Action _onComplete)
+ public async void SetDamage(BattleDmgInfo _damageInfo, Action _onComplete)
{
- var damages = damageInfo.damageList;
+ battleDmgInfo = _damageInfo;
+
+ var damages = battleDmgInfo.battleDamageList;
+
+ for (int i = damages.Count; i < damageLineList.Count; i++)
+ {
+ damageLineList[i].SetActive(false);
+ }
+
+ posTween.Play(_onComplete);
+
+ if (battleDmgInfo.IsCrit())
+ {
+ scaleTween.Play();
+ }
+
for (int i = 0; i < damages.Count; i++)
{
if (i >= damageLineList.Count)
@@ -29,24 +49,26 @@
damageLineList.Add(newLine.GetComponent<DamageLine>());
}
damageLineList[i].SetActive(true);
- damageLineList[i].SetDamage(damageInfo.attackType, damages[i]);
+ damageLineList[i].SetDamage(damages[i]);
+ await UniTask.Delay(100);
}
-
- for (int i = damages.Count; i < damageLineList.Count; i++)
- {
- damageLineList[i].SetActive(false);
- }
-
- posTween.Play(_onComplete);
}
public void Stop()
{
posTween.Stop();
+ if (battleDmgInfo.IsCrit())
+ {
+ scaleTween.Stop();
+ }
}
public void Resume()
{
posTween.Resume();
+ if (battleDmgInfo.IsCrit())
+ {
+ scaleTween.Resume();
+ }
}
}
diff --git a/Main/System/Battle/UIComp/DamageLine.cs b/Main/System/Battle/UIComp/DamageLine.cs
index 9d1b1bf..5d231df 100644
--- a/Main/System/Battle/UIComp/DamageLine.cs
+++ b/Main/System/Battle/UIComp/DamageLine.cs
@@ -5,19 +5,25 @@
public class DamageLine : MonoBehaviour
{
- public TextEx damageTypeLabel;
+ public TextEx damageTypeLabel;
- public TextEx damageValueLabel;
+ public TextEx damageValueLabel;
public void SetDamage(int damageType, long damage)
{
- damageTypeLabel.SetActive(false);
+ damageTypeLabel.SetActive(false);
damageValueLabel.text = BattleUtility.DisplayDamageNum(damage, damageType);
}
public void SetDamage(long damage)
{
- damageTypeLabel.SetActive(false);
- damageValueLabel.text = damage.ToString();
+ damageTypeLabel.SetActive(false);
+ damageValueLabel.text = damage.ToString();
+ }
+
+ public void SetDamage(BattleDmg damage)
+ {
+ damageTypeLabel.SetActive(false);
+ damageValueLabel.text = BattleUtility.DisplayDamageNum(damage.damage, damage.attackType);
}
}
diff --git a/Main/System/GeneralConfig/GeneralDefine.cs b/Main/System/GeneralConfig/GeneralDefine.cs
index 70e3091..3e4edb7 100644
--- a/Main/System/GeneralConfig/GeneralDefine.cs
+++ b/Main/System/GeneralConfig/GeneralDefine.cs
@@ -39,6 +39,7 @@
public static int acutionItemHour { get; private set; }
public static int maxXBGridCount { get; private set; }
+ public static FuncConfigConfig parryCfg;
public static void Init()
{
@@ -754,7 +755,7 @@
// flashOpenArr = JsonMapper.ToObject<int[]>(func.Numerical2);
// flashCntMoreArr = JsonMapper.ToObject<int[]>(func.Numerical3);
// flashKillMaxCount = int.Parse(func.Numerical4);
-
+ parryCfg = FuncConfigConfig.Get("ParryCfg");
}
catch (Exception ex)
{
--
Gitblit v1.8.0