From d767a5a0efbac267507be14b5b09bd64015fe560 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期四, 07 八月 2025 15:01:28 +0800
Subject: [PATCH] 125 【战斗】战斗系统 技能表 部分战斗内容
---
Main/System/Battle/BattleConst.cs | 2
Main/System/Battle/BattleField/BattleRootNode.cs | 39 +
Main/Core/NetworkPackage/ClientPack/CB4_FightDefine/CB415_tagCSMainDropItemOP.cs | 24
Main/System/KnapSack/Logic/ItemLogicUtility.cs | 35 +
Main/System/Battle/BattleField/StoryBattleField.cs | 67 ++
Main/Config/Configs/SkillConfig.cs | 115 ++-
Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB425_tagSCTurnFightReportSign.cs | 27
Main/Config/Configs/PlayerAttrConfig.cs | 65 ++
Main/System/Battle/BattleField/BattleField.cs | 155 +++--
Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB405_tagMCAddExp.cs | 11
Main/System/Battle/BattleTweenMgr.cs | 12
Main/System/Team/TeamManager.cs | 16
Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB405_tagMCAddExp.cs.meta | 11
Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB424_tagSCTurnFightInit.cs | 17
Main/System/Battle/BattleField/RecordActions/BattleStartAction.cs | 4
Main/System/Battle/BattleObject/BattleObject.cs | 70 +
Main/System/Battle/Skill/DirectlyHealSkill.cs | 84 +++
Main/Config/Configs/DamageNumConfig.cs.meta | 11
Main/System/Battle/Skill/DirectlyHealSkill.cs.meta | 11
Main/System/Battle/Define/DamageType.cs | 22
Main/System/Battle/BattleEffectMgr.cs | 15
Main/Core/NetworkPackage/ServerPack/HB4_FightDefine/HB405_tagMCAddExp.cs.meta | 11
Main/System/Battle/Skill/RebornSkill.cs.meta | 11
Main/Utility/EnumHelper.cs | 2
Main/Config/Configs/DamageNumConfig.cs | 62 ++
Main/System/Battle/BattleManager.cs | 103 ++-
Main/System/Battle/BattleUtility.cs | 46 +
Main/System/Battle/BattleHUDWin.cs | 5
Main/System/Battle/BattleWin.cs | 15
Main/System/Battle/Skill/DirectlyDamageSkill.cs | 4
Main/System/Battle/Skill/RebornSkill.cs | 81 +++
Main/Core/NetworkPackage/ServerPack/HB4_FightDefine/HB405_tagMCAddExp.cs | 21
Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs | 6
Main/System/Battle/SkillEffect/BulletSkillEffect.cs | 6
Main/Core/NetworkPackage/DTCFile/ServerPack/H06_PlayerVsNPC/DTC0604_tagUseSkillAttack.cs | 6
Main/Config/Configs/PlayerAttrConfig.cs.meta | 11
Main/System/Battle/RecordPlayer/RecordPlayer.cs | 6
Main/Core/NetworkPackage/ClientPack/CB4_FightDefine/CB415_tagCSMainDropItemOP.cs.meta | 11
Main/System/Battle/Skill/SkillBase.cs | 230 +++++++
Main/System/Battle/BattleObject/BattleObjMgr.cs | 49 +
Main/Core/NetworkPackage/DTCFile/ServerPack/H04_Scene/DTC0407_tagNPCDisappear.cs | 4
Main/System/Battle/BattleField/RecordActions/DeathRecordAction.cs | 2
Main/System/Battle/BattleField/OperationAgent/HandModeOperationAgent.cs | 57 ++
43 files changed, 1,317 insertions(+), 245 deletions(-)
diff --git a/Main/Config/Configs/DamageNumConfig.cs b/Main/Config/Configs/DamageNumConfig.cs
new file mode 100644
index 0000000..e30673c
--- /dev/null
+++ b/Main/Config/Configs/DamageNumConfig.cs
@@ -0,0 +1,62 @@
+锘�//--------------------------------------------------------
+// [Author]: YYL
+// [ Date ]: 2025骞�8鏈�6鏃�
+//--------------------------------------------------------
+
+using System.Collections.Generic;
+using System;
+using UnityEngine;
+using LitJson;
+
+public partial class DamageNumConfig : ConfigBase<string, DamageNumConfig>
+{
+ static DamageNumConfig()
+ {
+ // 璁块棶杩囬潤鎬佹瀯閫犲嚱鏁�
+ visit = true;
+ }
+
+ public string id;
+ public int prefix;
+ public int plus;
+ public int minus;
+ public int[] nums;
+
+ public override string LoadKey(string _key)
+ {
+ string key = GetKey(_key);
+ return key;
+ }
+
+ public override void LoadConfig(string input)
+ {
+ try {
+ string[] tables = input.Split('\t');
+ id = tables[0];
+
+ int.TryParse(tables[1],out prefix);
+
+ int.TryParse(tables[2],out plus);
+
+ int.TryParse(tables[3],out minus);
+
+ if (tables[4].Contains("["))
+ {
+ nums = JsonMapper.ToObject<int[]>(tables[4]);
+ }
+ else
+ {
+ string[] numsStringArray = tables[4].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
+ nums = new int[numsStringArray.Length];
+ for (int i=0;i<numsStringArray.Length;i++)
+ {
+ int.TryParse(numsStringArray[i],out nums[i]);
+ }
+ }
+ }
+ catch (Exception exception)
+ {
+ Debug.LogError(exception);
+ }
+ }
+}
diff --git a/Main/Config/Configs/DamageNumConfig.cs.meta b/Main/Config/Configs/DamageNumConfig.cs.meta
new file mode 100644
index 0000000..0224667
--- /dev/null
+++ b/Main/Config/Configs/DamageNumConfig.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 8189c5d3b27328346a2b8b3eb50d45cf
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Main/Config/Configs/PlayerAttrConfig.cs b/Main/Config/Configs/PlayerAttrConfig.cs
new file mode 100644
index 0000000..9922233
--- /dev/null
+++ b/Main/Config/Configs/PlayerAttrConfig.cs
@@ -0,0 +1,65 @@
+锘�//--------------------------------------------------------
+// [Author]: YYL
+// [ Date ]: 2025骞�8鏈�5鏃�
+//--------------------------------------------------------
+
+using System.Collections.Generic;
+using System;
+using UnityEngine;
+using LitJson;
+
+public partial class PlayerAttrConfig : ConfigBase<int, PlayerAttrConfig>
+{
+ static PlayerAttrConfig()
+ {
+ // 璁块棶杩囬潤鎬佹瀯閫犲嚱鏁�
+ visit = true;
+ }
+
+ public int ID;
+ public string Name;
+ public string ShowName;
+ public int ISPercentage;
+ public int type;
+ public int decimalCount;
+ public int showType;
+ public int showSequence;
+ public string desc;
+ public string Parameter;
+
+ public override int LoadKey(string _key)
+ {
+ int key = GetKey(_key);
+ return key;
+ }
+
+ public override void LoadConfig(string input)
+ {
+ try {
+ string[] tables = input.Split('\t');
+ int.TryParse(tables[0],out ID);
+
+ Name = tables[1];
+
+ ShowName = tables[2];
+
+ int.TryParse(tables[3],out ISPercentage);
+
+ int.TryParse(tables[4],out type);
+
+ int.TryParse(tables[5],out decimalCount);
+
+ int.TryParse(tables[6],out showType);
+
+ int.TryParse(tables[7],out showSequence);
+
+ desc = tables[8];
+
+ Parameter = tables[9];
+ }
+ catch (Exception exception)
+ {
+ Debug.LogError(exception);
+ }
+ }
+}
diff --git a/Main/Config/Configs/PlayerAttrConfig.cs.meta b/Main/Config/Configs/PlayerAttrConfig.cs.meta
new file mode 100644
index 0000000..bed99fc
--- /dev/null
+++ b/Main/Config/Configs/PlayerAttrConfig.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: f1fc6e60e5eeba644bf77f0c7b22879e
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Main/Config/Configs/SkillConfig.cs b/Main/Config/Configs/SkillConfig.cs
index 958ad9c..d08c339 100644
--- a/Main/Config/Configs/SkillConfig.cs
+++ b/Main/Config/Configs/SkillConfig.cs
@@ -1,6 +1,6 @@
锘�//--------------------------------------------------------
// [Author]: YYL
-// [ Date ]: 2025骞�8鏈�5鏃�
+// [ Date ]: 2025骞�8鏈�7鏃�
//--------------------------------------------------------
using System.Collections.Generic;
@@ -17,16 +17,22 @@
}
public int SkillID;
+ public int SkillTypeID;
+ public int SkillMaxLV;
public string SkillName;
public string Description;
- public string IconName;
public int FuncType;
public int SkillType;
public int HurtType;
public int AtkType;
public int TagAim;
+ public int TagFriendly;
+ public int TagAffect;
+ public int TagCount;
+ public int HappenRate;
public int LastTime;
public int CoolDownTime;
+ public int Priority;
public int EffectID1;
public int[] EffectValues1;
public int EffectID2;
@@ -54,6 +60,7 @@
public int EffectId;
public int EffectPos;
public int EffectType;
+ public string IconName;
public override int LoadKey(string _key)
{
@@ -67,35 +74,47 @@
string[] tables = input.Split('\t');
int.TryParse(tables[0],out SkillID);
- SkillName = tables[1];
+ int.TryParse(tables[1],out SkillTypeID);
- Description = tables[2];
+ int.TryParse(tables[2],out SkillMaxLV);
- IconName = tables[3];
+ SkillName = tables[3];
- int.TryParse(tables[4],out FuncType);
+ Description = tables[4];
- int.TryParse(tables[5],out SkillType);
+ int.TryParse(tables[5],out FuncType);
- int.TryParse(tables[6],out HurtType);
+ int.TryParse(tables[6],out SkillType);
- int.TryParse(tables[7],out AtkType);
+ int.TryParse(tables[7],out HurtType);
- int.TryParse(tables[8],out TagAim);
+ int.TryParse(tables[8],out AtkType);
- int.TryParse(tables[9],out LastTime);
+ int.TryParse(tables[9],out TagAim);
- int.TryParse(tables[10],out CoolDownTime);
+ int.TryParse(tables[10],out TagFriendly);
- int.TryParse(tables[11],out EffectID1);
+ int.TryParse(tables[11],out TagAffect);
- if (tables[12].Contains("["))
+ int.TryParse(tables[12],out TagCount);
+
+ int.TryParse(tables[13],out HappenRate);
+
+ int.TryParse(tables[14],out LastTime);
+
+ int.TryParse(tables[15],out CoolDownTime);
+
+ int.TryParse(tables[16],out Priority);
+
+ int.TryParse(tables[17],out EffectID1);
+
+ if (tables[18].Contains("["))
{
- EffectValues1 = JsonMapper.ToObject<int[]>(tables[12]);
+ EffectValues1 = JsonMapper.ToObject<int[]>(tables[18]);
}
else
{
- string[] EffectValues1StringArray = tables[12].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
+ string[] EffectValues1StringArray = tables[18].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
EffectValues1 = new int[EffectValues1StringArray.Length];
for (int i=0;i<EffectValues1StringArray.Length;i++)
{
@@ -103,15 +122,15 @@
}
}
- int.TryParse(tables[13],out EffectID2);
+ int.TryParse(tables[19],out EffectID2);
- if (tables[14].Contains("["))
+ if (tables[20].Contains("["))
{
- EffectValues2 = JsonMapper.ToObject<int[]>(tables[14]);
+ EffectValues2 = JsonMapper.ToObject<int[]>(tables[20]);
}
else
{
- string[] EffectValues2StringArray = tables[14].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
+ string[] EffectValues2StringArray = tables[20].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
EffectValues2 = new int[EffectValues2StringArray.Length];
for (int i=0;i<EffectValues2StringArray.Length;i++)
{
@@ -119,15 +138,15 @@
}
}
- int.TryParse(tables[15],out EffectID3);
+ int.TryParse(tables[21],out EffectID3);
- if (tables[16].Contains("["))
+ if (tables[22].Contains("["))
{
- EffectValues3 = JsonMapper.ToObject<int[]>(tables[16]);
+ EffectValues3 = JsonMapper.ToObject<int[]>(tables[22]);
}
else
{
- string[] EffectValues3StringArray = tables[16].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
+ string[] EffectValues3StringArray = tables[22].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
EffectValues3 = new int[EffectValues3StringArray.Length];
for (int i=0;i<EffectValues3StringArray.Length;i++)
{
@@ -135,15 +154,15 @@
}
}
- int.TryParse(tables[17],out ConnSkill);
+ int.TryParse(tables[23],out ConnSkill);
- if (tables[18].Contains("["))
+ if (tables[24].Contains("["))
{
- EnhanceSkillList = JsonMapper.ToObject<int[]>(tables[18]);
+ EnhanceSkillList = JsonMapper.ToObject<int[]>(tables[24]);
}
else
{
- string[] EnhanceSkillListStringArray = tables[18].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
+ string[] EnhanceSkillListStringArray = tables[24].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
EnhanceSkillList = new int[EnhanceSkillListStringArray.Length];
for (int i=0;i<EnhanceSkillListStringArray.Length;i++)
{
@@ -151,43 +170,45 @@
}
}
- int.TryParse(tables[19],out FightPower);
+ int.TryParse(tables[25],out FightPower);
- int.TryParse(tables[20],out StartupFrames);
+ int.TryParse(tables[26],out StartupFrames);
- int.TryParse(tables[21],out ActiveFrames);
+ int.TryParse(tables[27],out ActiveFrames);
- int.TryParse(tables[22],out RecoveryFrames);
+ int.TryParse(tables[28],out RecoveryFrames);
- int.TryParse(tables[23],out LoopCount);
+ int.TryParse(tables[29],out LoopCount);
- int.TryParse(tables[24],out CastPosition);
+ int.TryParse(tables[30],out CastPosition);
- int.TryParse(tables[25],out CastIndexNum);
+ int.TryParse(tables[31],out CastIndexNum);
- float.TryParse(tables[26],out CastDistance);
+ float.TryParse(tables[32],out CastDistance);
- DamageDivide = JsonMapper.ToObject<int[][]>(tables[27].Replace("(", "[").Replace(")", "]"));
+ DamageDivide = JsonMapper.ToObject<int[][]>(tables[33].Replace("(", "[").Replace(")", "]"));
- int.TryParse(tables[28],out BulletEffectId);
+ int.TryParse(tables[34],out BulletEffectId);
- int.TryParse(tables[29],out BulletPos);
+ int.TryParse(tables[35],out BulletPos);
- int.TryParse(tables[30],out BulletPath);
+ int.TryParse(tables[36],out BulletPath);
- int.TryParse(tables[31],out BulletFlyTime);
+ int.TryParse(tables[37],out BulletFlyTime);
- int.TryParse(tables[32],out ExplosionEffectId);
+ int.TryParse(tables[38],out ExplosionEffectId);
- int.TryParse(tables[33],out ExplosionPos);
+ int.TryParse(tables[39],out ExplosionPos);
- SkillMotionName = tables[34];
+ SkillMotionName = tables[40];
- int.TryParse(tables[35],out EffectId);
+ int.TryParse(tables[41],out EffectId);
- int.TryParse(tables[36],out EffectPos);
+ int.TryParse(tables[42],out EffectPos);
- int.TryParse(tables[37],out EffectType);
+ int.TryParse(tables[43],out EffectType);
+
+ IconName = tables[44];
}
catch (Exception exception)
{
diff --git a/Main/Core/NetworkPackage/ClientPack/CB4_FightDefine/CB415_tagCSMainDropItemOP.cs b/Main/Core/NetworkPackage/ClientPack/CB4_FightDefine/CB415_tagCSMainDropItemOP.cs
new file mode 100644
index 0000000..ee26f9d
--- /dev/null
+++ b/Main/Core/NetworkPackage/ClientPack/CB4_FightDefine/CB415_tagCSMainDropItemOP.cs
@@ -0,0 +1,24 @@
+using UnityEngine;
+using System.Collections;
+
+// B4 15 涓荤嚎鎺夎惤鐗╁搧鎿嶄綔 #tagCSMainDropItemOP
+
+public class CB415_tagCSMainDropItemOP : GameNetPackBasic {
+ public byte Count;
+ public ushort[] IndexList; // 鎺夎惤鑳屽寘涓殑鐗╁搧鏍煎瓙绱㈠紩鍒楄〃
+ public byte OPType; // 0 - 鎷惧彇闈炶澶囩墿鍝侊紱1 - 鍒嗚В锛�2 - 绌挎埓/鏇挎崲锛�
+ public byte OPValue; // 鎿嶄綔棰濆鎸囦护鍊硷紝鐢辨搷浣滅被鍨嬪喅瀹氾紝濡傜┛鎴存椂鍙彂閫佺┛鎴村悗鏄惁鑷姩鍒嗚В
+
+ public CB415_tagCSMainDropItemOP () {
+ combineCmd = (ushort)0x03FE;
+ _cmd = (ushort)0xB415;
+ }
+
+ public override void WriteToBytes () {
+ WriteBytes (Count, NetDataType.BYTE);
+ WriteBytes (IndexList, NetDataType.WORD, Count);
+ WriteBytes (OPType, NetDataType.BYTE);
+ WriteBytes (OPValue, NetDataType.BYTE);
+ }
+
+}
diff --git a/Main/Core/NetworkPackage/ClientPack/CB4_FightDefine/CB415_tagCSMainDropItemOP.cs.meta b/Main/Core/NetworkPackage/ClientPack/CB4_FightDefine/CB415_tagCSMainDropItemOP.cs.meta
new file mode 100644
index 0000000..73d9795
--- /dev/null
+++ b/Main/Core/NetworkPackage/ClientPack/CB4_FightDefine/CB415_tagCSMainDropItemOP.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 869e528814e57b34cb674f8b554a911f
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs b/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs
index cfa8274..d336c38 100644
--- a/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs
+++ b/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs
@@ -5,9 +5,9 @@
public class CustomHB426CombinePack : GameNetPackBasic
{
- protected HB426_tagSCTurnFightTag startTag;
+ public HB426_tagSCTurnFightTag startTag;
- protected HB426_tagSCTurnFightTag endTag;
+ public HB426_tagSCTurnFightTag endTag;
public int fromIndex;
@@ -139,10 +139,12 @@
return;
}
+ // 鎶�鑳藉寘
if (startTag.Tag.StartsWith("Skill_"))
{
H0604_tagUseSkillAttack skill = packList[0] as H0604_tagUseSkillAttack;
BattleObject caster = battleField.battleObjMgr.GetBattleObject((int)skill.ObjID);
+ // 娉ㄦ剰澶勭悊packList
SkillRecordAction skillRecordAction = new SkillRecordAction(battleField, caster, skill, packList);
battleField.PlayRecord(skillRecordAction);
}
diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/H04_Scene/DTC0407_tagNPCDisappear.cs b/Main/Core/NetworkPackage/DTCFile/ServerPack/H04_Scene/DTC0407_tagNPCDisappear.cs
index e503144..5c2c2ea 100644
--- a/Main/Core/NetworkPackage/DTCFile/ServerPack/H04_Scene/DTC0407_tagNPCDisappear.cs
+++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/H04_Scene/DTC0407_tagNPCDisappear.cs
@@ -11,9 +11,9 @@
//鐜╁涓诲姩鐐瑰嚮浼戞伅鏃讹紝鍚庣浼氬洖鏀跺垱寤虹殑鎴樻枟涓婚樀瀹规灏嗗疄渚嬶紝鍓嶇鏀跺埌//04 07 NPC娑堝け#tagNPCDisappear鏃惰繘琛岃В缁�
BattleField battleField = BattleManager.Instance.GetBattleField(vNetPack.packUID);
-
+ //04 07 NPC娑堝け#tagNPCDisappear 涓殑瀛楁NPCID瀹為檯涓婂悓姝ョ殑鏄疧bjID锛屽彧鏄懡鍚嶉棶棰�
// 鎻愬墠缁撴潫鎴樻枟 鍒犻櫎NPCID锛堬級瀹為檯涓婃槸瀵硅薄鐨凮bjID
- battleField.FinishBattleInAdvance(vNetData.NPCID);
+ battleField.NPCDisappear(vNetData.NPCID);
}
}
diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/H06_PlayerVsNPC/DTC0604_tagUseSkillAttack.cs b/Main/Core/NetworkPackage/DTCFile/ServerPack/H06_PlayerVsNPC/DTC0604_tagUseSkillAttack.cs
index 7b8aae0..ecf4920 100644
--- a/Main/Core/NetworkPackage/DTCFile/ServerPack/H06_PlayerVsNPC/DTC0604_tagUseSkillAttack.cs
+++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/H06_PlayerVsNPC/DTC0604_tagUseSkillAttack.cs
@@ -6,7 +6,7 @@
public class DTC0604_tagUseSkillAttack : DtcBasic {
public override void Done(GameNetPackBasic vNetPack) {
base.Done(vNetPack);
- H0604_tagUseSkillAttack vNetData = vNetPack as H0604_tagUseSkillAttack;
+ // H0604_tagUseSkillAttack vNetData = vNetPack as H0604_tagUseSkillAttack;
// public uint ObjID;
@@ -20,9 +20,9 @@
// ObjType绫诲瀷鐨凮bjID浣跨敤BattleType绫绘妧鑳絊killID鏀诲嚮浜咥ttackObjType绫诲瀷鐨凙ttackID 浼ゅ鏁板瓧鏄疕urtList
- BattleField battleField = BattleManager.Instance.GetBattleField(vNetPack.packUID);
+ // BattleField battleField = BattleManager.Instance.GetBattleField(vNetPack.packUID);
- battleField.ProcessUseSkillAttack(vNetData);
+ // battleField.ProcessUseSkillAttack(vNetData);
}
diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB405_tagMCAddExp.cs b/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB405_tagMCAddExp.cs
new file mode 100644
index 0000000..8a5e276
--- /dev/null
+++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB405_tagMCAddExp.cs
@@ -0,0 +1,11 @@
+using UnityEngine;
+using System.Collections;
+
+//B4 05 鑾峰緱缁忛獙 #tagMCAddExp
+
+public class DTCB405_tagMCAddExp : DtcBasic {
+ public override void Done(GameNetPackBasic vNetPack) {
+ base.Done(vNetPack);
+ HB405_tagMCAddExp vNetData = vNetPack as HB405_tagMCAddExp;
+ }
+}
diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB405_tagMCAddExp.cs.meta b/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB405_tagMCAddExp.cs.meta
new file mode 100644
index 0000000..0fffd61
--- /dev/null
+++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB405_tagMCAddExp.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 70b2b77edce0c7346a9df59f1266cb83
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB424_tagSCTurnFightInit.cs b/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB424_tagSCTurnFightInit.cs
index 29781ed..fabaec0 100644
--- a/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB424_tagSCTurnFightInit.cs
+++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB424_tagSCTurnFightInit.cs
@@ -57,20 +57,11 @@
}
}
-
- // 涓荤嚎
- // if (vNetData.MapID <= 2)
- // {
- // int chapter = (int)vNetData.FuncLineID / 10000;
- // int wave = (int)(vNetData.MapID == 1 ? vNetData.FuncLineID % 100 : 1);//绗嚑娉㈡��
- // int level = (int)(vNetData.FuncLineID % 10000) / 100;
- JsonData extendData = JsonMapper.ToObject(vNetData.Msg);
-
- // BattleManager.Instance.CreateStoryBattle(chapter, wave, level, extendData, redTeamList[0], blueTeamList[0]);
- // }
+ JsonData extendData = JsonMapper.ToObject(vNetData.Msg);
string guid = BattleManager.Instance.GetGUID(vNetPack.packUID);
-
- BattleManager.Instance.CreateBattleField(guid, (int)vNetData.MapID, (int)vNetData.FuncLineID, extendData, redTeamList, blueTeamList);
+ BattleField battleField = BattleManager.Instance.CreateBattleField(guid, (int)vNetData.MapID, (int)vNetData.FuncLineID, extendData, redTeamList, blueTeamList);
+ BattleStartAction battleStartAction = new BattleStartAction(battleField);
+ battleField.recordPlayer.PlayRecord(battleStartAction);
}
}
diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB425_tagSCTurnFightReportSign.cs b/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB425_tagSCTurnFightReportSign.cs
index b67d135..b4e3b53 100644
--- a/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB425_tagSCTurnFightReportSign.cs
+++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB425_tagSCTurnFightReportSign.cs
@@ -2,9 +2,30 @@
using System.Collections;
// B4 25 鍥炲悎鎴樻枟鎴樻姤鐗囨鏍囪 #tagSCTurnFightReportSign
+// 鎴樻枟鐩稿叧灏佸寘璇存槑
+// // B4 25 鍥炲悎鎴樻枟鎴樻姤鐗囨鏍囪 #tagSCTurnFightReportSign 鍚庣鍚屾鎴樻枟鐗囨鏃朵細鐢ㄨ灏佸寘鏍囪寮�濮嬭窡缁撴潫锛屼腑闂寸殑鎵�鏈夊皝鍖呭嵆涓烘湰娆℃垬鏂楃墖娈电殑鎵�鏈夊皝鍖咃紙涓荤嚎灏忔�垬鏂楀彲鑳藉寘鍚叾浠栭潪鎴樻枟绫荤殑灏佸寘锛屽鎴橀敜鏁伴噺鍚屾銆佺粡楠屽悓姝ャ�佸崌绾у悓姝ョ瓑锛�
+// // B4 24 鍥炲悎鎴樻枟鍒濆鍖� #tagSCTurnFightInit 鏍囪涓�鍦烘垬鏂楃殑鍒濆鍖栵紝涓荤嚎鍏冲崱鍒嗘尝銆佹瘡娉㈠彲鏀寔澶氫釜灏忛槦锛屼竴涓皬闃熺殑鎴樻枟灏辨槸涓�鍦烘垬鏂�
+// 涓荤嚎鎴樻枟涓紝Msg鍒濆鍖栦俊鎭寘鍚� {"teamNum":褰撳墠灏忛槦缂栧彿, "teamMax":鏈�澶у皬闃熸暟} 锛� 鍓嶇濡傛灉鏈夐渶瑕佸睍绀哄皬闃熺浉鍏充俊鎭殑璇濆彲浠ヨВ鏋愯鍊�
+// // B4 20 鍥炲悎鍒舵垬鏂楃姸鎬� #tagMCTurnFightState 涓�鑸悓姝ヨ鍦烘垬鏂楃浉鍏崇殑淇℃伅锛屽鍥炲悎鍙樺寲銆佹垬鏂楃姸鎬佺瓑锛岀洰鍓峉tate鍙悓姝� 2-鎴樻枟涓強 4-缁撶畻锛屽叾浠栨湁闇�瑕佺殑璇濆啀鎵╁睍
+// // B4 21 鍥炲悎鎴樻枟瀵硅薄寮�濮嬭鍔� #tagMCTurnFightObjAction
+// 鏍囪鏌愪釜鎴樻枟瀹炰緥寮�濮嬭鍔紝鍚庣画鐨勫皝鍖呴兘鏄娆¤鍔ㄤ骇鐢熺殑涓�浜涘垪琛屼负锛岀洿鍒颁笅涓�涓狟421灏佸寘锛堝彟涓�涓垬鏂楀疄渚嬭鍔級
+// // B4 22 鍥炲悎鎴樻枟瀵硅薄姝讳骸 #tagMCTurnFightObjDead
+// 閫氱煡鏌愪釜鎴樻枟瀹炰緥姝讳骸浜嗭紙鍚庣鎴樻枟瀹炰緥杩樺湪锛夛紝娉ㄦ剰鍜�0407鍖哄垎锛�0407浠h〃鐨勬槸NPC娑堝け浜嗭紙鍚庣鎴樻枟瀹炰緥涔熷凡缁忛攢姣佸洖鏀讹級
+// // B4 23 鍥炲悎鎴樻枟瀵硅薄澶嶆椿 #tagMCTurnFightObjReborn
+// //04 07 NPC娑堝け#tagNPCDisappear
+// 娉ㄦ剰涓嶣422鍖哄垎锛�0407浠呬唬琛ㄨ鎴樻枟瀹炰緥琚悗绔洖鏀朵簡
+// 鍚庣鎴樻枟瀹炰緥浼氶噸澶嶅埄鐢紝姣斿鍒囨崲灏忛槦鏃讹紝鍘熷皬闃熺殑瀹炰緥浼氬厛琚洖鏀讹紝鐒跺悗鍐嶅垱寤烘柊鐨勫皬闃熸垬鏂楀疄渚嬶紝鍙兘澶嶇敤鐩稿悓鐨勫疄渚婭D锛屽嵆ObjID
+// //04 18 鍛ㄥ洿瀵硅薄鍒锋柊#tagObjInfoRefresh
+// 閫氱煡鏌愪釜瀵硅薄锛堟垬鏂楀疄渚嬫垨鑰呯帺瀹惰嚜韬級鐩稿叧鐨勫睘鎬у埛鏂帮紝濡傞�氱煡鎴樻枟NPC鎬掓皵鍊煎埛鏂帮紝閫氱煡鐜╁鎴橀敜鏁伴噺鍒锋柊绛�
+// 鎶�鑳介�氱煡锛岃瑙� 銆愭妧鑳姐�� 璇存槑
+//06 04 鎶�鑳芥敾鍑讳娇鐢ㄦ垚鍔�#tagUseSkillAttack
+//04 23 瀵硅薄鐘舵�佸埛鏂伴�氱煡(鍙樉绀�)#tagObjPropertyRefreshView
-public class DTCB425_tagSCTurnFightReportSign : DtcBasic {
- public override void Done(GameNetPackBasic vNetPack) {
+
+public class DTCB425_tagSCTurnFightReportSign : DtcBasic
+{
+ public override void Done(GameNetPackBasic vNetPack)
+ {
base.Done(vNetPack);
HB425_tagSCTurnFightReportSign vNetData = vNetPack as HB425_tagSCTurnFightReportSign;
@@ -16,6 +37,6 @@
public static bool IsCorrectType(GameNetPackBasic vNetPack)
{
- return vNetPack is HB425_tagSCTurnFightReportSign;
+ return vNetPack is HB425_tagSCTurnFightReportSign;
}
}
diff --git a/Main/Core/NetworkPackage/ServerPack/HB4_FightDefine/HB405_tagMCAddExp.cs b/Main/Core/NetworkPackage/ServerPack/HB4_FightDefine/HB405_tagMCAddExp.cs
new file mode 100644
index 0000000..f6928c1
--- /dev/null
+++ b/Main/Core/NetworkPackage/ServerPack/HB4_FightDefine/HB405_tagMCAddExp.cs
@@ -0,0 +1,21 @@
+using UnityEngine;
+using System.Collections;
+
+//B4 05 鑾峰緱缁忛獙 #tagMCAddExp
+
+public class HB405_tagMCAddExp : GameNetPackBasic {
+ public uint ExpPoint; // 鍗曚綅浜跨偣
+ public uint Exp; // 鍗曚綅鐐�
+ public byte Source; //缁忛獙鑾峰彇鏉ユ簮
+
+ public HB405_tagMCAddExp () {
+ _cmd = (ushort)0xB405;
+ }
+
+ public override void ReadFromBytes (byte[] vBytes) {
+ TransBytes (out ExpPoint, vBytes, NetDataType.DWORD);
+ TransBytes (out Exp, vBytes, NetDataType.DWORD);
+ TransBytes (out Source, vBytes, NetDataType.BYTE);
+ }
+
+}
diff --git a/Main/Core/NetworkPackage/ServerPack/HB4_FightDefine/HB405_tagMCAddExp.cs.meta b/Main/Core/NetworkPackage/ServerPack/HB4_FightDefine/HB405_tagMCAddExp.cs.meta
new file mode 100644
index 0000000..148a0bd
--- /dev/null
+++ b/Main/Core/NetworkPackage/ServerPack/HB4_FightDefine/HB405_tagMCAddExp.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 657dd96a4b0eca64386a70ac86ec48a9
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Main/System/Battle/BattleConst.cs b/Main/System/Battle/BattleConst.cs
index a29c672..681e4b8 100644
--- a/Main/System/Battle/BattleConst.cs
+++ b/Main/System/Battle/BattleConst.cs
@@ -5,4 +5,6 @@
public const int BattleStartEffectID = 1001; // Example effect ID for battle start
public const int skillMotionFps = 30;
+
+ public const int BattlePointItemID = 3;//鎴橀敜ID
}
\ No newline at end of file
diff --git a/Main/System/Battle/BattleEffectMgr.cs b/Main/System/Battle/BattleEffectMgr.cs
index 7d78d36..8d507cc 100644
--- a/Main/System/Battle/BattleEffectMgr.cs
+++ b/Main/System/Battle/BattleEffectMgr.cs
@@ -84,4 +84,19 @@
}
}
}
+
+ public void HaveRest()
+ {
+ foreach (KeyValuePair<int, List<EffectPlayer>> kvPair in effectDict)
+ {
+ foreach (EffectPlayer effectPlayer in kvPair.Value)
+ {
+ if (effectPlayer != null)
+ {
+ GameObject.DestroyImmediate(effectPlayer.gameObject);
+ }
+ }
+ }
+ effectDict.Clear();
+ }
}
\ No newline at end of file
diff --git a/Main/System/Battle/BattleField/BattleField.cs b/Main/System/Battle/BattleField/BattleField.cs
index 9193c08..b812c99 100644
--- a/Main/System/Battle/BattleField/BattleField.cs
+++ b/Main/System/Battle/BattleField/BattleField.cs
@@ -26,24 +26,10 @@
public JsonData extendData;
- public bool IsActive
- {
- get;
- protected set;
- }
-
public bool IsBattleFinish
{
get;
protected set;
- }
-
- public virtual bool IsPvp
- {
- get
- {
- return false;
- }
}
private bool m_IsPause = false;
@@ -88,6 +74,20 @@
public BattleField(string _guid)
{
guid = _guid;
+
+ GameObject go = ResManager.Instance.LoadAsset<GameObject>("Battle/Prefabs", "BattleRootNode");
+ GameObject battleRootNodeGO = GameObject.Instantiate(go);
+ battleRootNode = battleRootNodeGO.GetComponent<BattleRootNode>();
+ battleRootNodeGO.name = this.GetType().Name;
+
+ battleObjMgr = new BattleObjMgr();
+ battleEffectMgr = new BattleEffectMgr();
+ battleTweenMgr = new BattleTweenMgr();
+ recordPlayer = new RecordPlayer();
+
+ battleEffectMgr.Init(this);
+ battleTweenMgr.Init(this);
+ recordPlayer.Init(this);
}
public virtual void Init(int _MapID, int _FuncLineID, JsonData _extendData,
@@ -102,32 +102,15 @@
redTeamIndex = 0;
blueTeamIndex = 0;
- GameObject go = ResManager.Instance.LoadAsset<GameObject>("Battle/Prefabs", "BattleRootNode");
- GameObject battleRootNodeGO = GameObject.Instantiate(go);
- battleRootNode = battleRootNodeGO.GetComponent<BattleRootNode>();
- battleRootNodeGO.name = this.GetType().Name;
-
- battleObjMgr = new BattleObjMgr();
if (blueTeamList == null)
{
battleObjMgr.Init(this, redTeamList[redTeamIndex], null);
- battleObjMgr.HaveRest(BattleCamp.Red);
+ HaveRest();
}
else
{
battleObjMgr.Init(this, redTeamList[redTeamIndex], blueTeamList[blueTeamIndex]);
}
-
- battleEffectMgr = new BattleEffectMgr();
- battleEffectMgr.Init(this);
- battleTweenMgr = new BattleTweenMgr();
- battleTweenMgr.Init(this);
-
- // 杩欓噷鐨処nit浜ょ粰鍚勪釜瀛愮被鐨処nit閲屽幓瀹炵幇
- // battleObjMgr.Init(this, _redTeam, _blueTeam);
-
- recordPlayer = new RecordPlayer();
- recordPlayer.Init(this);
}
// 鍦≧un涔嬪墠瑕佽缃畬姣� 瑕佸垱寤篈gent
@@ -227,7 +210,7 @@
}
- public virtual void OnTurnFightState(int turnNum, int State, int FuncLineID, JsonData extendData)
+ public virtual void OnTurnFightState(int turnNum, int State, int FuncLineID, JsonData turnFightStateData)
{
// 鍒囨崲鍥炲悎
// 鏄瘡涓垬鏂楀紑濮�/姣忎釜鍥炲悎鐨勭涓�涓垬鏂楀寘
@@ -239,6 +222,13 @@
// TurnNum; // 褰撳墠杞
// Len;
// Msg; //size = Len +
+
+ if (State == 4)
+ {
+ //宸茬粡缁撴潫骞剁粨绠�
+ OnBattleEnd(turnFightStateData);
+ return;
+ }
// 鍋氳〃鐜�
if (turnNum == 1)
@@ -287,29 +277,12 @@
// 閿�姣佸叏閮ㄥ唴瀹�
}
- public void FinishBattleInAdvance(uint[] ObjIDArr)
+ public void NPCDisappear(uint[] ObjIDArr)
{
- // 璁﹏pc闅愯棌鍚� 宸﹁竟鎾斁鐫¤鍔ㄤ綔
-
-
+ // 璁﹏pc娑堝け
+ battleObjMgr.DestroyObjIds(ObjIDArr);
}
- public virtual void ProcessUseSkillAttack(H0604_tagUseSkillAttack vNetData)
- {
- // H0604_tagUseSkillAttack
- // public uint ObjID;
- // public byte ObjType;
- // public byte BattleType; //鐗╃悊/榄旀硶
- // public ushort SkillID;
- // public uint AttackID; //涓绘敾鍑荤洰鏍�
- // public byte AttackObjType; //涓绘敾鍑荤洰鏍�
- // public ushort HurtCount; //浼ゅ鏁扮洰
- // public tagSkillHurtObj[] HurtList; //size = HurtCount
-
- // ObjType绫诲瀷鐨凮bjID浣跨敤BattleType绫绘妧鑳絊killID鏀诲嚮浜咥ttackObjType绫诲瀷鐨凙ttackID 浼ゅ鏁板瓧鏄疕urtList
- // SkillAction skillAction = new SkillAction();
-
- }
public RectTransform GetTeamNode(BattleCamp battleCamp)
{
@@ -323,8 +296,26 @@
}
}
- public RectTransform GetTeamNode(BattleCamp battleCamp, int index)
+ public RectTransform GetTeamNode(BattleCamp battleCamp, BattleObject target)
{
+ int index = target.teamHero.positionNum;
+ return GetTeamNode(battleCamp, index);
+ }
+
+ public RectTransform GetTeamNode(BattleCamp battleCamp, SkillConfig skillConfig)
+ {
+ int index = skillConfig.CastIndexNum - 1; // 鎶�鑳介厤缃殑index鏄粠1寮�濮嬬殑锛屾墍浠ヨ鍑�1
+ return GetTeamNode(battleCamp, index);
+ }
+
+ private RectTransform GetTeamNode(BattleCamp battleCamp, int index)
+ {
+ if (index < 0 || index >= battleRootNode.redTeamNodeList.Count)
+ {
+ Debug.LogError($"GetTeamNode: Index {index} is out of range for {battleCamp} camp.");
+ return null;
+ }
+
if (battleCamp == BattleCamp.Red)
{
return battleRootNode.redTeamNodeList[index].transform as RectTransform;
@@ -363,7 +354,7 @@
foreach (var obj in redTeam)
{
obj.motionBase.PlayAnimation(MotionName.run, true);
- RectTransform trans = obj.heroGo.transform as RectTransform;
+ RectTransform trans = obj.heroRectTrans;
tween = trans.DOMove(obj.GetAliasTeamNode().position, 0.5f).SetEase(Ease.Linear);
battleTweenMgr.OnPlayTween(tween);
}
@@ -380,4 +371,58 @@
efplayer.onDestroy += a => onMoveComplete();
};
}
+
+ public void OnObjDropItem(int positionNum, ItemModel item)
+ {
+ // 澶勭悊鎺夎惤鐗╁搧
+ //鏃犺濡備綍鍥惧眰搴旇鍦ㄤ汉鐗╀笂闈� 鎵�浠ヨ繖閲屽簲璇ユ湁涓寕鐐�
+ // YYL TODO
+
+
+ }
+
+ public void OnObjReborn(HB423_tagMCTurnFightObjReborn vNetData)
+ {
+ // 澶勭悊澶嶆椿閫昏緫
+ BattleObject battleObj = battleObjMgr.GetBattleObject((int)vNetData.ObjID);
+ if (battleObj != null)
+ {
+ battleObj.OnReborn(vNetData);
+ }
+ else
+ {
+ Debug.LogError($"BattleObject with ID {vNetData.ObjID} not found for reborn.");
+ }
+ }
+
+ public void OnObjDropExp(BattleObject battleObject)
+ {
+ // 澶勭悊鎺夎惤缁忛獙
+ // YYL TODO
+ battleObject.DropExp();
+ }
+
+ public virtual void OnBattleEnd(JsonData turnFightStateData)
+ {
+ // 澶勭悊鎴樻枟缁撴潫閫昏緫
+ IsBattleFinish = true;
+ // 缁撶畻閫昏緫
+
+ // {"winFaction":鑾疯儨闃佃惀, "statInfo":缁熻淇℃伅, 鈥渋temInfo鈥�:[濂栧姳鐗╁搧淇℃伅鍒楄〃]}
+ }
+
+ public virtual void HaveRest()
+ {
+ // 浼戞伅鐘舵��
+ battleObjMgr.HaveRest(BattleCamp.Red);
+ battleObjMgr.DestroyTeam(BattleCamp.Blue);
+
+ battleEffectMgr.HaveRest();
+ battleTweenMgr.HaveRest();
+ }
+
+ public bool IsBattleEnd()
+ {
+ return IsBattleFinish;
+ }
}
\ No newline at end of file
diff --git a/Main/System/Battle/BattleField/BattleRootNode.cs b/Main/System/Battle/BattleField/BattleRootNode.cs
index 4f17cd1..fd7a5ec 100644
--- a/Main/System/Battle/BattleField/BattleRootNode.cs
+++ b/Main/System/Battle/BattleField/BattleRootNode.cs
@@ -5,25 +5,48 @@
public class BattleRootNode : MonoBehaviour
{
public RectTransform redTeamNode;
- public List<GameObject> redTeamNodeList = new List<GameObject>();
+ public List<GameObject> redTeamNodeList
+ {
+ get
+ {
+ return _redTeamNodeList;
+ }
+ }
+
+ private List<GameObject> _redTeamNodeList = new List<GameObject>();
public RectTransform blueTeamNode;
- public List<GameObject> blueTeamNodeList = new List<GameObject>();
+ public List<GameObject> blueTeamNodeList
+ {
+ get
+ {
+ return _blueTeamNodeList;
+ }
+ }
+
+ private List<GameObject> _blueTeamNodeList = new List<GameObject>();
public RawImage imgBackground;
void Awake()
{
- if (redTeamNodeList.Count != TeamConst.MaxTeamSlotCount)
+ for (int i = 1; i <= TeamConst.MaxTeamSlotCount; i++)
{
- Debug.LogError("redTeamNodeList count is not equal to MaxTeamSlotCount: " + redTeamNodeList.Count);
- }
+ Transform redTrans = redTeamNode.Find("Pos" + i);
+ _redTeamNodeList.Add(redTrans.gameObject);
- if (blueTeamNodeList.Count != TeamConst.MaxTeamSlotCount)
- {
- Debug.LogError("blueTeamNodeList count is not equal to MaxTeamSlotCount: " + blueTeamNodeList.Count);
+ Transform blueTrans = blueTeamNode.Find("Pos" + i);
+ _blueTeamNodeList.Add(blueTrans.gameObject);
}
DontDestroyOnLoad(gameObject);
}
+ public void SetBackground(Texture texture)
+ {
+ if (imgBackground != null)
+ {
+ imgBackground.texture = texture;
+ imgBackground.SetNativeSize();
+ }
+ }
}
\ No newline at end of file
diff --git a/Main/System/Battle/BattleField/OperationAgent/HandModeOperationAgent.cs b/Main/System/Battle/BattleField/OperationAgent/HandModeOperationAgent.cs
index 9216cdf..b6d3283 100644
--- a/Main/System/Battle/BattleField/OperationAgent/HandModeOperationAgent.cs
+++ b/Main/System/Battle/BattleField/OperationAgent/HandModeOperationAgent.cs
@@ -1,11 +1,14 @@
using UnityEngine;
+// 鍙湁涓荤嚎鎴樻枟鐢ㄥ埌 鎵�浠ヨ繖閲屽彲鑳戒細鏀句竴浜涗富绾跨殑鐗规畩澶勭悊
public class HandModeOperationAgent : IOperationAgent
{
+ protected StoryBattleField storyBattleField;
+
public HandModeOperationAgent(BattleField battleField) : base(battleField)
{
-
+ storyBattleField = battleField as StoryBattleField;
}
public override void Run()
@@ -18,13 +21,63 @@
{
base.DoNext();
+ // 褰撳墠娌℃湁鍦ㄦ挱鏀炬垬鏂楀綍鍍�
if (!battleField.recordPlayer.IsPlaying())
{
- // ask for next action
+ // 娌℃湁涓嬩竴涓寘鍙互鍙戜簡
+ if (!BattleManager.Instance.DistributeNextPackage())
+ {
+ // 璇锋眰涓嬩竴涓垬鏂楀寘 鎴栬�呮鏌ユ垬鏂楁槸鍚︾粨鏉�
+ // ReqType; // 0-鍋滄鎴樻枟鍥炲煄锛�1-璁剧疆娑堣�楀�嶅�硷紱2-鎸戞垬鍏冲崱灏忔�紱3-鎸戞垬鍏冲崱boss锛�4-缁х画鎴樻枟锛�
+
+ // 濡傛灉鍦ㄤ紤鎭� 鐐逛竴涓嬩箣鍚庡簲璇ユ槸鎸戞垬灏忔�垨鑰呮寫鎴樺叧鍗�
+ // 濡傛灉鍦ㄦ垬鏂� 鎴樻枟鏄惁缁撴潫/鎴樻枟鎸佺画涓� 缁撴潫搴旇鏄寫鎴樹笅涓�鍏� 鎸佺画搴旇鏄户缁垬鏂�
+
+
+ // 妫�鏌ヤ竴涓嬮敜瀛愮殑娑堣��
+ //FightPoint 鐢ㄤ簬璁板綍娑堣�楁垬閿ゅ�嶆暟锛屽皬浜庣瓑浜�1鏃堕粯璁�1鍊嶏紝澶т簬1鏃朵负瀵瑰簲娑堣�楀�嶅�硷紝0418鍒锋柊绫诲瀷22
+ ulong costRate = PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.FightPoint);
+
+ int cost = (int)(costRate > 1 ? costRate : 1) * 1; // 1鏄粯璁ゆ秷鑰�
+
+
+ // 妫�鏌ヤ竴涓嬮敜瀛愮殑娑堣��
+ if (!ItemLogicUtility.CheckItemCount(PackType.Item, BattleConst.BattlePointItemID, cost, true))
+ {
+ return;
+ }
+
+ byte reqType;
+
+ if (storyBattleField.battleState == StoryBattleState.Break)
+ {
+ reqType = 2;
+ }
+ else if (storyBattleField.battleState == StoryBattleState.Battle)
+ {
+ if (battleField.IsBattleEnd())
+ {
+ reqType = 2; // 缁х画鎸戞垬灏忔��
+ }
+ else
+ {
+ reqType = 4; // 缁х画鎴樻枟
+ }
+ }
+ else
+ {
+ Debug.LogError("unknown battle state");
+ return;
+ }
+
+ BattleManager.Instance.MainFightRequest(reqType);
+ }
}
else
{
Debug.LogError("action doesnt finish, wait a moment please");
}
}
+
+
}
\ No newline at end of file
diff --git a/Main/System/Battle/BattleField/RecordActions/BattleStartAction.cs b/Main/System/Battle/BattleField/RecordActions/BattleStartAction.cs
index 6d098f1..2ab72f6 100644
--- a/Main/System/Battle/BattleField/RecordActions/BattleStartAction.cs
+++ b/Main/System/Battle/BattleField/RecordActions/BattleStartAction.cs
@@ -5,8 +5,8 @@
{
private bool isRun = false;
- public BattleStartAction(BattleField _battleField, BattleObject _caster, H0604_tagUseSkillAttack vNetData)
- : base(RecordActionType.BattleStart, _battleField, _caster)
+ public BattleStartAction(BattleField _battleField)
+ : base(RecordActionType.BattleStart, _battleField, null)
{
}
diff --git a/Main/System/Battle/BattleField/RecordActions/DeathRecordAction.cs b/Main/System/Battle/BattleField/RecordActions/DeathRecordAction.cs
index 9e21eea..86a19e5 100644
--- a/Main/System/Battle/BattleField/RecordActions/DeathRecordAction.cs
+++ b/Main/System/Battle/BattleField/RecordActions/DeathRecordAction.cs
@@ -30,6 +30,8 @@
private void OnDeathAnimationEnd()
{
+ // 鎺夎惤鐗╁搧 澧炲姞缁忛獙
+
isFinish = true;
}
}
\ No newline at end of file
diff --git a/Main/System/Battle/BattleField/StoryBattleField.cs b/Main/System/Battle/BattleField/StoryBattleField.cs
index ec22f81..c042d52 100644
--- a/Main/System/Battle/BattleField/StoryBattleField.cs
+++ b/Main/System/Battle/BattleField/StoryBattleField.cs
@@ -3,6 +3,20 @@
using UnityEngine;
using System.Collections.Generic;
+// 銆愪富绾挎垬鏂楁祦绋嬨��
+// 鍙戦�� B413 锛圧eqType 涓� 2 鎴� 3锛�
+// 鍚庣鍥炲 B425鏍囪0寮�濮� 锛堜腑闂碞涓垬鏂楃墖娈靛皝鍖咃級 B425鏍囪1缁撴潫
+// 鍓嶇瑙f瀽 N涓垬鏂楃墖娈靛皝鍖� 锛屾媶瑙f垚鍓嶇鏀寔鐨刟ction鎸囦护锛岀劧鍚庤繘琛屾垬鏂楄〃鐜�
+// 琛ㄧ幇瀹屾瘯鍚庣户缁彂閫� B413 锛圧eqType 涓� 4锛�
+// 鍚庣鍥炲 B425鏍囪0寮�濮� 锛堜腑闂碞涓垬鏂楃墖娈靛皝鍖咃級 B425鏍囪1缁撴潫
+// 鍓嶇瑙f瀽琛ㄧ幇锛岀劧鍚庝竴鐩村惊鐜嵆鍙�
+
+public enum StoryBattleState
+{
+ Break,
+ Battle,
+}
+
public class StoryBattleField : BattleField
{
protected int chapter;// 绔犺妭
@@ -14,15 +28,26 @@
protected MainLevelConfig levelConfig;
+ public StoryBattleState battleState;
+
public StoryBattleField() : base(string.Empty)
{
}
-
- public override void Init(int MapID, int FuncLineID, JsonData _extendData,
+
+ public override void Init(int MapID, int FuncLineID, JsonData _extendData,
List<TeamBase> _redTeamList, List<TeamBase> _blueTeamList)
{
base.Init(MapID, FuncLineID, extendData, _redTeamList, _blueTeamList);
+
+ if (null == _blueTeamList || _blueTeamList.Count == 0)
+ {
+ battleState = StoryBattleState.Break;
+ }
+ else
+ {
+ battleState = StoryBattleState.Battle;
+ }
LoadBattleMode();
@@ -34,6 +59,13 @@
chapterConfig = MainChapterConfig.Get(chapter);
levelConfig = MainLevelConfig.Get(level);
+ TeamManager.Instance.OnTeamChange += OnTeamChange;
+ }
+
+ public override void Release()
+ {
+ base.Release();
+ TeamManager.Instance.OnTeamChange -= OnTeamChange;
}
protected void LoadBattleMode()
@@ -46,7 +78,7 @@
SetBattleMode((BattleMode)Enum.Parse(typeof(BattleMode), savedStr));
}
- public override void TurnFightState(int TurnNum, int State,
+ public override void TurnFightState(int TurnNum, int State,
uint FuncLineID, JsonData extendData)
{
base.TurnFightState(TurnNum, State, FuncLineID, extendData);
@@ -80,7 +112,34 @@
public override void OnTurnFightState(int turnNum, int State, int FuncLineID, JsonData extendData)
{
base.OnTurnFightState(turnNum, State, FuncLineID, extendData);
-
+
+ }
+
+ protected void OnTeamChange(TeamType teamType)
+ {
+ if (teamType == TeamType.Story)
+ {
+ if (battleState == StoryBattleState.Break)
+ {
+ ReloadTeam();
+ }
+ }
+ }
+
+ public override void HaveRest()
+ {
+ base.HaveRest();
+ battleState = StoryBattleState.Break;
+ }
+
+ protected void ReloadTeam()
+ {
+ battleObjMgr.ReloadTeam(TeamManager.Instance.GetTeam(TeamType.Story), BattleCamp.Red);
+ }
+
+ public override void OnBattleEnd(JsonData turnFightStateData)
+ {
+ base.OnBattleEnd(turnFightStateData);
}
// public override void Run()
diff --git a/Main/System/Battle/BattleHUDWin.cs b/Main/System/Battle/BattleHUDWin.cs
index af94ed8..c528332 100644
--- a/Main/System/Battle/BattleHUDWin.cs
+++ b/Main/System/Battle/BattleHUDWin.cs
@@ -94,11 +94,8 @@
damageContentList.Add(content);
// heroGo 鐨� parent 浣滀负鍙傝�冭妭鐐�
- var heroGo = bo.heroGo;
- if (heroGo == null)
- return;
- var heroRect = heroGo.GetComponent<RectTransform>();
+ var heroRect = bo.heroRectTrans;
if (heroRect == null)
return;
diff --git a/Main/System/Battle/BattleManager.cs b/Main/System/Battle/BattleManager.cs
index 11e5d9e..f0b92a1 100644
--- a/Main/System/Battle/BattleManager.cs
+++ b/Main/System/Battle/BattleManager.cs
@@ -3,6 +3,8 @@
using LitJson;
+
+
public class BattleManager : GameSystemManager<BattleManager>
{
public StoryBattleField storyBattleField = null;
@@ -32,7 +34,7 @@
ulong exAttr1 = PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.ExAttr1);
ulong exAttr2 = PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.ExAttr2);
- int MapID = 0;
+ int MapID = 1;
int FuncLineID = (int)exAttr2;
CreateStoryBattle(MapID, FuncLineID, null, null);
@@ -44,12 +46,17 @@
{
if (null == storyBattleField)
{
- storyBattleField = new StoryBattleField();
-
- storyBattleField.guid = string.Empty; // 涓荤嚎鍓湰鐨刧uid涓虹┖
var redTeamList = new List<TeamBase>();
- redTeamList.Add(TeamManager.Instance.GetTeam(TeamType.Story));
- storyBattleField.Init(MapID, FuncLineID, extendData, redTeamList, blueTeamList);
+
+ TeamBase storyTeam = TeamManager.Instance.GetTeam(TeamType.Story);
+
+ redTeamList.Add(storyTeam);
+
+ CreateBattleField(string.Empty, MapID, FuncLineID, extendData, redTeamList, blueTeamList);
+ }
+ else
+ {
+ // storyBattleField
}
}
@@ -59,7 +66,7 @@
}
-#region 鎴柇缃戠粶娲惧彂鍖� 鍙敹鍏ュ綋鍓嶅寘鐨勫悗缁� b425鏄富绾跨殑 闈炰富绾跨殑鍖呭苟涓嶄細璧癰425
+ #region 鎴柇缃戠粶娲惧彂鍖� 鍙敹鍏ュ綋鍓嶅寘鐨勫悗缁� b425鏄富绾跨殑 闈炰富绾跨殑鍖呭苟涓嶄細璧癰425
private bool allow = true;
private Queue<GameNetPackBasic> packQueue = new Queue<GameNetPackBasic>();
@@ -81,7 +88,7 @@
// 鍙戦�佹垬鎶ョ墖娈电粨鏉熷寘
AnalysisPackQueueAndDistribute();
-
+
}
}
else
@@ -95,25 +102,34 @@
return allow;
}
+ protected int continousEmptyCount = 0; // 杩炵画绌哄寘璁℃暟
+
protected void AnalysisPackQueueAndDistribute()
{
+ // 寤鸿鍓嶇鍋氫竴涓槻鑼冩満鍒讹細褰撹繛缁娆¤姹傚緱鍒扮┖鐨勬垬鏂楃墖娈靛皝鍖呮椂锛堜笉鍖呭惈B425鏍囪鐨勫紑濮嬭窡缁撴潫灏佸寘锛屽嵆寮�濮嬭窡涓棿娌℃湁浠讳綍灏佸寘锛夛紝寮哄埗鑷姩甯帺瀹跺洖鍩庝紤鎭紝
+ // 鍘熷洜鍙兘鍓嶅悗绔暟鎹笉涓�鑷碽ug锛堟瘮濡傛垬閿ゅ彲鑳藉悗绔病鏈変簡锛屽墠绔涓鸿繕鏈夛級鎴栬�� 鍚庣鏈塨ug瀵艰嚧娌℃湁澶勭悊鎴樻枟
+ // 涓洪槻姝㈡寰幆锛屽彲寮哄埗鍥炲煄浼戞伅锛岃鐜╁閲嶆柊鐐瑰嚮鍏冲崱鎴樻枟鎴栨寫鎴榖oss锛�
+ // 姝e父鎯呭喌涓嬪湪鎴橀敜瓒冲鏃剁悊璁轰笂閮藉彲浠ヤ竴鐩村惊鐜埛鎬紝濡傛灉杩炵画澶氭娌℃湁鎴樻枟鐗囨灏佸寘锛屾瘮濡傞檺鍒朵釜杩炵画10娆′互鍐咃紝灏卞彲浠ョ悊瑙d负寮傚父浜�
+
+ const int MaxContinousEmptyCount = 10; // 杩炵画绌哄寘鏈�澶ф鏁�
+
List<GameNetPackBasic> packQueueSnapshot = new List<GameNetPackBasic>(packQueue);
List<GameNetPackBasic> newPackList = new List<GameNetPackBasic>();
- // 杩欓噷宸茬粡鏄寜鐓equeue鐨勯『搴忎簡
+ // 杩欓噷宸茬粡鏄寜鐓equeue鐨勯『搴忎簡
for (int i = 0; i < packQueueSnapshot.Count; i++)
{
GameNetPackBasic pack = packQueueSnapshot[i];
- // 纰板埌B421 鎴柇 寰�涓嬫敹闆哹421閲岀殑鍏ㄩ儴鍐呭
+ // 纰板埌B421 鎴柇 寰�涓嬫敹闆哹421閲岀殑鍏ㄩ儴鍐呭
if (pack is HB421_tagMCTurnFightObjAction)
{
HB421_tagMCTurnFightObjAction b421Pack = pack as HB421_tagMCTurnFightObjAction;
List<GameNetPackBasic> b421PackList = new List<GameNetPackBasic>();
- i++; // 璺宠繃褰撳墠鐨凚421鍖�
+ i++; // 璺宠繃褰撳墠鐨凚421鍖�
for (; i < packQueueSnapshot.Count; i++)
{
@@ -131,7 +147,7 @@
}
}
- // 鍙兘娌$敤浜� 涓昏灏辨槸鍒╃敤涓�涓媠kill鐨刢ombine 鏆傜暀 鐪嬩箣鍚庤繕鏈夋病鏈夊埆鐨勯渶姹�
+ // 鍙兘娌$敤浜� 涓昏灏辨槸鍒╃敤涓�涓媠kill鐨刢ombine 鏆傜暀 鐪嬩箣鍚庤繕鏈夋病鏈夊埆鐨勯渶姹�
CustomB421ActionPack actionPack = CustomB421ActionPack.CreateB421ActionPack(GetGUID(b421Pack.packUID), b421PackList);
while (actionPack.actionPacks.Count > 0)
@@ -146,8 +162,26 @@
}
}
+ // 闃茶寖鏈哄埗锛氳繛缁娆℃病鏈夋垬鏂楃墖娈靛皝鍖呮椂鑷姩鍥炲煄
+ if (newPackList.Count == 0)
+ {
+ continousEmptyCount++;
+ Debug.LogWarning($"杩炵画绌烘垬鏂楃墖娈靛皝鍖呮鏁帮細{continousEmptyCount}");
+ if (continousEmptyCount >= MaxContinousEmptyCount)
+ {
+ Debug.LogError("杩炵画澶氭娌℃湁鎴樻枟鐗囨灏佸寘锛岃嚜鍔ㄥ洖鍩庝紤鎭紒");
+ MainFightRequest(0); // 0-鍋滄鎴樻枟鍥炲煄
+ continousEmptyCount = 0;
+ packQueue.Clear();
+ return;
+ }
+ }
+ else
+ {
+ continousEmptyCount = 0; // 鏈夊寘灏遍噸缃�
+ }
- // b421璺焍426鐨勫寘宸茬粡澶勭悊瀹屼簡
+ // b421璺焍426鐨勫寘宸茬粡澶勭悊瀹屼簡
packQueue = new Queue<GameNetPackBasic>(newPackList);
DistributeNextPackage();
@@ -189,9 +223,9 @@
}
}
-#endregion
+ #endregion
-#region 鎴樻姤閮ㄥ垎
+ #region 鎴樻姤閮ㄥ垎
protected Dictionary<string, Queue<GameNetPackBasic>> battleReportDict = new Dictionary<string, Queue<GameNetPackBasic>>();
@@ -227,10 +261,6 @@
{
BattleField battleField = null;
battleFields.TryGetValue(guid, out battleField);
- if (battleField == null)
- {
- battleField = storyBattleField;
- }
return battleField;
}
@@ -243,7 +273,7 @@
if (kv.Value.Contains(packUID))
{
return kv.Key;
- }
+ }
}
return string.Empty;
}
@@ -267,7 +297,7 @@
battlePackRelationList.Remove(guid);
}
}
-#endregion
+ #endregion
public BattleField CreateBattleField(string guid, int MapID, int FuncLineID, JsonData extendData, List<TeamBase> redTeamList, List<TeamBase> blueTeamList)
{
@@ -279,13 +309,11 @@
battleField.Destroy();
}
+ battleField = BattleFieldFactory.CreateBattleField(guid, MapID, FuncLineID, extendData, redTeamList, blueTeamList);
+
if (string.IsNullOrEmpty(guid))
{
- battleField = storyBattleField;
- }
- else
- {
- battleField = BattleFieldFactory.CreateBattleField(guid, MapID, FuncLineID, extendData, redTeamList, blueTeamList);
+ storyBattleField = (StoryBattleField)battleField;
}
battleFields.Add(guid, battleField);
@@ -296,15 +324,28 @@
}
- // public void OnTurnFightObjAction(battleType, vNetData.TurnNum, (int)vNetData.ObjID)
+ // 鐩墠鏀寔 BYTE ReqType; // 0-鍋滄鎴樻枟鍥炲煄锛�1-璁剧疆娑堣�楀�嶅�硷紱2-鎸戞垬鍏冲崱灏忔�紱3-鎸戞垬鍏冲崱boss锛�4-缁х画鎴樻枟锛�
+ // 0-鍋滄鎴樻枟鍥炲煄 - 鐜╁涓诲姩鐐瑰嚮鍥炲煄鏃跺彂閫�
+ // 1-璁剧疆娑堣�楀�嶅�� - 鐜╁璁剧疆娑堣�楀�嶅�硷紝瀵瑰簲鍒扮帺瀹禙ightPoint鐨勫��
+ // 2-鎸戞垬鍏冲崱灏忔�� - 鐜╁鐐瑰嚮寮�濮嬫垬鏂楁椂鍙戦�侊紝浠呬粠浼戞伅鐘舵�佸埌寮�濮嬫垬鏂楁椂鍙戦�佸嵆鍙�
+ // 3-鎸戞垬鍏冲崱boss - 鐜╁璇锋眰鎸戞垬璇ュ叧鍗oss鏃跺彂閫�
+ // 4-缁х画鎴樻枟 - 鐜╁涓荤嚎鎴樻枟涓紙鍖呭惈涓荤嚎灏忔��佷富绾縝oss锛夛紝鍓嶇琛ㄧ幇瀹屽悗绔悓姝ョ殑鎴樻枟鐗囨鍚庯紝鍙啀鍥炲璇ュ�硷紝鍚庣浼氭牴鎹垬鏂楅�昏緫鍙婃祦绋嬭嚜鍔ㄥ洖澶嶄笅涓�娈电殑鎴樻枟鐗囨灏佸寘锛屼竴鐩村惊鐜�
+ public void MainFightRequest(byte reqType, uint reqValue = 0)
+ {
+ CB413_tagCSMainFightReq req = new CB413_tagCSMainFightReq();
+ req.ReqType = reqType;
+ req.ReqValue = reqValue;
+
+ GameNetSystem.Instance.SendInfo(req);
+ }
public void Run()
{
- if (null != storyBattleField)
- {
- storyBattleField.Run();
- }
+ // if (null != storyBattleField)
+ // {
+ // storyBattleField.Run();
+ // }
foreach (var battleField in battleFields)
{
diff --git a/Main/System/Battle/BattleObject/BattleObjMgr.cs b/Main/System/Battle/BattleObject/BattleObjMgr.cs
index f09454d..64c6db3 100644
--- a/Main/System/Battle/BattleObject/BattleObjMgr.cs
+++ b/Main/System/Battle/BattleObject/BattleObjMgr.cs
@@ -19,10 +19,16 @@
public void Init(BattleField _battleField, TeamBase _redTeam, TeamBase _blueTeam)
{
battleField = _battleField;
- CreateTeam(battleField.battleRootNode.redTeamNodeList, redCampDict, _redTeam, BattleCamp.Red);
- CreateTeam(battleField.battleRootNode.blueTeamNodeList, blueCampDict, _blueTeam, BattleCamp.Blue);
+ ReloadTeam(_redTeam, BattleCamp.Red);
+ ReloadTeam(_blueTeam, BattleCamp.Blue);
}
+ public void ReloadTeam(TeamBase teamBase, BattleCamp _camp)
+ {
+ var posNodeList = _camp == BattleCamp.Red ? battleField.battleRootNode.redTeamNodeList : battleField.battleRootNode.blueTeamNodeList;
+ var campDict = _camp == BattleCamp.Red ? redCampDict : blueCampDict;
+ CreateTeam(posNodeList, campDict, teamBase, _camp);
+ }
protected void CreateTeam(List<GameObject> posNodeList, Dictionary<int, BattleObject> campDict, TeamBase teamBase, BattleCamp _Camp)
{
@@ -32,14 +38,14 @@
return;
}
+
for (int i = 0; i < teamBase.serverHeroes.Length; i++)
{
TeamHero teamHero = teamBase.serverHeroes[i];
if (teamHero != null)
{
+
BattleObject battleObj = BattleObjectFactory.CreateBattleObject(battleField, posNodeList, teamHero, _Camp);
- if (battleObj.ObjID == 0)
- continue;
allBattleObjDict.Add(battleObj.ObjID, battleObj);
campDict.Add(teamHero.positionNum, battleObj);
}
@@ -82,6 +88,36 @@
return retList;
}
+ public void DestroyTeam(BattleCamp battleCamp)
+ {
+ Dictionary<int, BattleObject> campDict = battleCamp == BattleCamp.Red ? redCampDict : blueCampDict;
+ if (campDict == null)
+ {
+ return;
+ }
+
+ DestroyTeam(campDict);
+ }
+
+ public void DestroyObjIds(uint[] objIDs)
+ {
+ if (objIDs == null || objIDs.Length == 0)
+ {
+ return;
+ }
+
+ foreach (var objID in objIDs)
+ {
+ if (allBattleObjDict.TryGetValue((int)objID, out BattleObject battleObj))
+ {
+ allBattleObjDict.Remove((int)objID);
+ redCampDict.Remove((int)objID);
+ blueCampDict.Remove((int)objID);
+ BattleObjectFactory.DestroyBattleObject((int)objID, battleObj);
+ }
+ }
+ }
+
protected void DestroyTeam(Dictionary<int, BattleObject> campDict)
{
foreach (var item in campDict)
@@ -94,11 +130,10 @@
}
}
campDict.Clear();
-
}
// 绌洪棽鐘舵��
- public void HaveRest(BattleCamp _Camp)
+ public virtual void HaveRest(BattleCamp _Camp)
{
// 浼戞伅鐘舵��
if (_Camp == BattleCamp.Red)
@@ -117,7 +152,7 @@
}
}
- public void Release()
+ public virtual void Release()
{
DestroyTeam(redCampDict);
DestroyTeam(blueCampDict);
diff --git a/Main/System/Battle/BattleObject/BattleObject.cs b/Main/System/Battle/BattleObject/BattleObject.cs
index ee58fc9..8c8aa5d 100644
--- a/Main/System/Battle/BattleObject/BattleObject.cs
+++ b/Main/System/Battle/BattleObject/BattleObject.cs
@@ -48,11 +48,27 @@
private set;
}
+ private RectTransform m_heroRectTrans;
+
+ public RectTransform heroRectTrans
+ {
+ get
+ {
+ if (m_heroRectTrans == null)
+ {
+ m_heroRectTrans = heroGo.GetComponent<RectTransform>();
+ }
+ return m_heroRectTrans;
+ }
+ }
+
protected Action onDeathAnimationComplete;
protected Renderer[] renderers;
public Transform effectNode;
+
+ private List<HB405_tagMCAddExp> hB405_tagMCAddExps = new List<HB405_tagMCAddExp>();
public BattleObject(BattleField _battleField)
{
@@ -92,17 +108,19 @@
public virtual void Destroy()
{
- if (heroGo != null)
- {
- GameObject.DestroyImmediate(heroGo);
- heroGo = null;
- }
+
+ motionBase.onAnimationComplete -= OnAnimationComplete;
motionBase.Release();
motionBase = null;
teamHero = null;
ObjID = 0;
- motionBase.onAnimationComplete -= OnAnimationComplete;
+
+ if (heroGo != null)
+ {
+ GameObject.DestroyImmediate(heroGo);
+ heroGo = null;
+ }
}
public void OnObjInfoRefresh(H0418_tagObjInfoRefresh _refreshInfo)
@@ -207,28 +225,21 @@
return true;
}
- public virtual void Hurt(List<long> damageValues, int attackType)
+ public virtual void Hurt(List<long> damageValues, long _totalDamage, int attackType)
{
PopDamage(teamHero.curHp, damageValues, attackType);
motionBase.PlayAnimation(MotionName.hit, false);
- // 璁$畻浼ゅ
- long totalDamage = 0;
- foreach (var damage in damageValues)
- {
- totalDamage += damage;
- }
-
// 鎵h
- teamHero.curHp -= totalDamage;
+ teamHero.curHp -= _totalDamage;
}
// 闂伩寮�濮�
public virtual void OnDodgeBegin()
{
float pingpongTime = 0.2f;
- RectTransform rectTrans = heroGo.GetComponent<RectTransform>();
+ RectTransform rectTrans = heroRectTrans;
var tween = rectTrans.DOAnchorPos(new Vector3(-50, 50, 0), pingpongTime)
.SetEase(Ease.OutCubic);
@@ -239,7 +250,7 @@
public virtual void OnDodgeEnd()
{
float pingpongTime = 0.2f;
- RectTransform rectTrans = heroGo.GetComponent<RectTransform>();
+ RectTransform rectTrans = heroRectTrans;
var tween = rectTrans.DOAnchorPos(Vector3.zero, pingpongTime)
.SetEase(Ease.OutCubic);
@@ -269,6 +280,14 @@
heroGo.SetActive(false);
}
+ public void OnReborn(HB423_tagMCTurnFightObjReborn vNetData)
+ {
+ // 澶勭悊澶嶆椿閫昏緫
+ teamHero.curHp = GeneralDefine.GetFactValue(vNetData.HP, vNetData.HPEx);
+ heroGo.SetActive(true);
+ motionBase.PlayAnimation(MotionName.idle, true);
+ }
+
// 浼ゅ杩樿鐪� 鏄惁闂伩 鏆村嚮 and so on 闇�瑕佹湁涓�涓狣amageType 鏈嶅姟鍣ㄥ簲璇ヤ細缁�
protected virtual void PopDamage(long curHp, List<long> damageValues, int attackType)
{
@@ -281,6 +300,7 @@
Debug.Log($"Damage: {damage}");
}
+ // YYL TODO 鏄惁闇�瑕佹寕鍦ㄥ湪鑷韩鐨刦ollow鐐逛笂
EventBroadcast.Instance.Broadcast(EventName.BATTLE_DAMAGE_TAKEN, battleField.guid, this, damageValues);
}
@@ -304,8 +324,24 @@
// YYL TODO
// 浼戞伅鐘舵��
// 澶氫竴涓獄zz鐨勪竴涓壒鏁�
+
+ motionBase.PlayAnimation(MotionName.idle, true);
}
+ public void PushExpPackList(List<HB405_tagMCAddExp> _hB405_tagMCAddExps)
+ {
+ // YYL TODO 姝讳骸鍚庡脊鍑虹粡楠屾帀钀芥彁閱�
+ hB405_tagMCAddExps = _hB405_tagMCAddExps;
+ }
+
+ public void DropExp()
+ {
+ // YYL TODO
+ // hB405_tagMCAddExps
+ }
+
+
+
#if UNITY_EDITOR_STOP_USING
public void EditorRevive()
{
diff --git a/Main/System/Battle/BattleTweenMgr.cs b/Main/System/Battle/BattleTweenMgr.cs
index e36d309..ec5d21c 100644
--- a/Main/System/Battle/BattleTweenMgr.cs
+++ b/Main/System/Battle/BattleTweenMgr.cs
@@ -51,4 +51,16 @@
tween.Play();
}
+
+ public void HaveRest()
+ {
+ foreach (var tween in tweenList)
+ {
+ if (tween != null && !tween.IsComplete())
+ {
+ tween.Kill();
+ }
+ }
+ tweenList.Clear();
+ }
}
\ No newline at end of file
diff --git a/Main/System/Battle/BattleUtility.cs b/Main/System/Battle/BattleUtility.cs
index 5ac2287..f3ecdbc 100644
--- a/Main/System/Battle/BattleUtility.cs
+++ b/Main/System/Battle/BattleUtility.cs
@@ -29,4 +29,50 @@
.OnComplete(() => onComplete?.Invoke());
}
+ public static string DisplayDamageNum(long num, int attackType)
+ {
+ 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]);
+ if (numChar > 0)
+ {
+ result += numChar;
+ }
+ }
+ return result;
+ }
+
+ public static int GetDamageNumKey(DamageType damageType, int _num)
+ {
+ var config = DamageNumConfig.Get(damageType.ToString());
+ //.鐨凙SCII鐮佹槸46
+ if (_num == 46)
+ {
+ return config.nums[10];
+ }
+ //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 config.nums[_num - 48];
+ }
+
}
\ No newline at end of file
diff --git a/Main/System/Battle/BattleWin.cs b/Main/System/Battle/BattleWin.cs
index 76c25d1..006dfcc 100644
--- a/Main/System/Battle/BattleWin.cs
+++ b/Main/System/Battle/BattleWin.cs
@@ -23,13 +23,18 @@
private void PauseGame()
{
- Debug.LogError("PauseeGame");
- if (null == battleField)
- return;
+ // Debug.LogError("PauseeGame");
+ // if (null == battleField)
+ // return;
- battleField.IsPause = !battleField.IsPause;
+ // battleField.IsPause = !battleField.IsPause;
- Debug.LogError(" is pause " + battleField.IsPause.ToString());
+ // Debug.LogError(" is pause " + battleField.IsPause.ToString());
+
+ if (battleField != null)
+ {
+ battleField.operationAgent.DoNext();
+ }
}
protected override void OnPreOpen()
diff --git a/Main/System/Battle/Define/DamageType.cs b/Main/System/Battle/Define/DamageType.cs
index 11b4805..95f6cc8 100644
--- a/Main/System/Battle/Define/DamageType.cs
+++ b/Main/System/Battle/Define/DamageType.cs
@@ -3,14 +3,16 @@
public enum DamageType
{
- Normal, //鏅�氫激瀹�
- Dodge, //闂伩
- Heal, //娌荤枟
- Continuous,//鎸佺画浼ゅ
- Block, //鏍兼尅
- ReverseInjury,//鍙嶄激
- Recovery, //鍚歌
- Crit, //鏆村嚮
- Combo, //杩炲嚮
- Stuned, //鍑绘檿
+ Damage, //鏅�氫激瀹�
+ Recovery, //娌荤枟
+ Reflect, //鍙嶅脊浼ゅ
+ Bloody, //娴佽浼ゅ
+ Block, //鏍兼尅
+ Critical, //鏆村嚮
+ Dodge, //闂伩
+ Combo, //杩炲嚮
+ CounterAttack, //鍙嶅嚮
+ RageUp, //鎬掓皵鎻愬崌
+
+
}
\ No newline at end of file
diff --git a/Main/System/Battle/RecordPlayer/RecordPlayer.cs b/Main/System/Battle/RecordPlayer/RecordPlayer.cs
index 402df21..10b8da1 100644
--- a/Main/System/Battle/RecordPlayer/RecordPlayer.cs
+++ b/Main/System/Battle/RecordPlayer/RecordPlayer.cs
@@ -73,4 +73,10 @@
{
}
+
+ public void HaveRest()
+ {
+ currentRecordAction = null;
+ recordActionQueue.Clear();
+ }
}
\ No newline at end of file
diff --git a/Main/System/Battle/Skill/DirectlyDamageSkill.cs b/Main/System/Battle/Skill/DirectlyDamageSkill.cs
index 8499523..f99118c 100644
--- a/Main/System/Battle/Skill/DirectlyDamageSkill.cs
+++ b/Main/System/Battle/Skill/DirectlyDamageSkill.cs
@@ -64,9 +64,9 @@
base.OnHitTargets(_hitIndex, hitList);
}
- protected override void OnHitEachTarget(BattleObject target, List<long> damageList, ref H0604_tagUseSkillAttack.tagSkillHurtObj hurt)
+ protected override void OnHitEachTarget(BattleObject target, long totalDamage, List<long> damageList, ref H0604_tagUseSkillAttack.tagSkillHurtObj hurt)
{
- base.OnHitEachTarget(target, damageList, ref hurt);
+ base.OnHitEachTarget(target, totalDamage, damageList, ref hurt);
}
diff --git a/Main/System/Battle/Skill/DirectlyHealSkill.cs b/Main/System/Battle/Skill/DirectlyHealSkill.cs
new file mode 100644
index 0000000..99c8877
--- /dev/null
+++ b/Main/System/Battle/Skill/DirectlyHealSkill.cs
@@ -0,0 +1,84 @@
+
+using System.Collections.Generic;
+using UnityEngine;
+using System;
+using System.Linq;
+
+public class DirectlyHealSkill : SkillBase
+{
+ protected SkillEffect skillEffect;
+
+ public DirectlyHealSkill(BattleObject _caster, SkillConfig _skillCfg,
+ H0604_tagUseSkillAttack _vNetData, List<GameNetPackBasic> _packList, BattleField _battleField)
+ : base(_caster, _skillCfg, _vNetData, _packList, _battleField)
+ {
+ foreach (var pack in packList)
+ {
+ Debug.LogError("directly heal skill pack type is " + pack.GetType());
+ }
+ }
+
+ public override void Run()
+ {
+ if (null != skillEffect)
+ {
+ skillEffect.Run();
+ }
+
+ base.Run();
+ }
+
+
+ // 鎶�鑳藉姩鐢绘挱鏀惧畬姣�
+ protected override void DoSkillLogic(Action _onComplete = null)
+ {
+ // if (skillConfig.EffectId > 0)
+ // {
+ // // 鎾斁鎶�鑳界壒鏁�
+ // caster.battleField.battleEffectMgr.PlayEffect(
+ // caster.ObjID,
+ // skillConfig.EffectId,
+ // caster.heroGo.transform
+ // );
+ // }
+
+ _onComplete?.Invoke();
+ }
+
+ // 鍓嶆憞缁撴潫
+ protected override void OnStartSkillFrame()
+ {
+ skillEffect = SkillEffectFactory.CreateSkillEffect(
+ caster,
+ skillConfig,
+ tagUseSkillAttack
+ );
+ if (skillEffect != null)
+ {
+ skillEffect.Play(OnHitTargets);
+ }
+ }
+
+ protected override void OnHitTargets(int _healIndex, List<H0604_tagUseSkillAttack.tagSkillHurtObj> healList)
+ {
+ base.OnHitTargets(_healIndex, healList);
+ }
+
+ protected override void OnHitEachTarget(BattleObject target, long totalDamage, List<long> damageList, ref H0604_tagUseSkillAttack.tagSkillHurtObj hurt)
+ {
+ base.OnHitEachTarget(target, totalDamage, damageList, ref hurt);
+ }
+
+
+ // 涓憞缁撴潫
+ protected override void OnActiveSkillFrame()
+ {
+
+ }
+
+ // 鍚庢憞缁撴潫
+ protected override void OnEndSkillFrame()
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/Main/System/Battle/Skill/DirectlyHealSkill.cs.meta b/Main/System/Battle/Skill/DirectlyHealSkill.cs.meta
new file mode 100644
index 0000000..a68d771
--- /dev/null
+++ b/Main/System/Battle/Skill/DirectlyHealSkill.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 38e775dae78a7c9418366ae4f0f6514e
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Main/System/Battle/Skill/RebornSkill.cs b/Main/System/Battle/Skill/RebornSkill.cs
new file mode 100644
index 0000000..2a876e0
--- /dev/null
+++ b/Main/System/Battle/Skill/RebornSkill.cs
@@ -0,0 +1,81 @@
+
+using System.Collections.Generic;
+using UnityEngine;
+using System;
+using System.Linq;
+
+public class RebornSkill : SkillBase
+{
+ protected SkillEffect skillEffect;
+
+ public RebornSkill(BattleObject _caster, SkillConfig _skillCfg,
+ H0604_tagUseSkillAttack _vNetData, List<GameNetPackBasic> _packList, BattleField _battleField)
+ : base(_caster, _skillCfg, _vNetData, _packList, _battleField)
+ {
+
+ }
+
+ public override void Run()
+ {
+ if (null != skillEffect)
+ {
+ skillEffect.Run();
+ }
+
+ base.Run();
+ }
+
+
+ // 鎶�鑳藉姩鐢绘挱鏀惧畬姣�
+ protected override void DoSkillLogic(Action _onComplete = null)
+ {
+ // if (skillConfig.EffectId > 0)
+ // {
+ // // 鎾斁鎶�鑳界壒鏁�
+ // caster.battleField.battleEffectMgr.PlayEffect(
+ // caster.ObjID,
+ // skillConfig.EffectId,
+ // caster.heroGo.transform
+ // );
+ // }
+
+ _onComplete?.Invoke();
+ }
+
+ // 鍓嶆憞缁撴潫
+ protected override void OnStartSkillFrame()
+ {
+ skillEffect = SkillEffectFactory.CreateSkillEffect(
+ caster,
+ skillConfig,
+ tagUseSkillAttack
+ );
+ if (skillEffect != null)
+ {
+ skillEffect.Play(OnHitTargets);
+ }
+ }
+
+ protected override void OnHitTargets(int _hitIndex, List<H0604_tagUseSkillAttack.tagSkillHurtObj> hitList)
+ {
+ base.OnHitTargets(_hitIndex, hitList);
+ }
+
+ protected override void OnHitEachTarget(BattleObject target, long totalDamage, List<long> damageList, ref H0604_tagUseSkillAttack.tagSkillHurtObj hurt)
+ {
+ base.OnHitEachTarget(target, totalDamage, damageList, ref hurt);
+ }
+
+
+ // 涓憞缁撴潫
+ protected override void OnActiveSkillFrame()
+ {
+
+ }
+
+ // 鍚庢憞缁撴潫
+ protected override void OnEndSkillFrame()
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/Main/System/Battle/Skill/RebornSkill.cs.meta b/Main/System/Battle/Skill/RebornSkill.cs.meta
new file mode 100644
index 0000000..cbd55f6
--- /dev/null
+++ b/Main/System/Battle/Skill/RebornSkill.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 88762e1ee728ecd45808b8759a3431ca
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Main/System/Battle/Skill/SkillBase.cs b/Main/System/Battle/Skill/SkillBase.cs
index 64964ac..b8d127d 100644
--- a/Main/System/Battle/Skill/SkillBase.cs
+++ b/Main/System/Battle/Skill/SkillBase.cs
@@ -29,6 +29,10 @@
protected SkillBase otherSkill;
+ protected List<H0704_tagRolePackRefresh> dropPackList = new List<H0704_tagRolePackRefresh>();
+
+ protected List<HB405_tagMCAddExp> expPackList = new List<HB405_tagMCAddExp>();
+
public SkillBase(BattleObject _caster, SkillConfig _skillCfg, H0604_tagUseSkillAttack vNetData, List<GameNetPackBasic> _packList, BattleField _battleField = null)
{
caster = _caster;
@@ -88,7 +92,7 @@
PlayCastAnimation(() => DoSkillLogic(OnSkillFinished));
break;
case SkillCastMode.Enemy:
- MoveToTarget(caster.GetEnemyCamp(), skillConfig.CastIndexNum, _onComplete: () => TurnBack(() => PlayCastAnimation(() => DoSkillLogic(() => { BackToOrigin(OnSkillFinished); }))));
+ MoveToTarget(caster.GetEnemyCamp(), skillConfig, _onComplete: () => TurnBack(() => PlayCastAnimation(() => DoSkillLogic(() => { BackToOrigin(OnSkillFinished); }))));
break;
case SkillCastMode.Target:
// 鐩爣鏄晫鏂逛富鐩爣
@@ -99,10 +103,10 @@
OnSkillFinished();
return;
}
- MoveToTarget(mainTarget.Camp, mainTarget.teamHero.positionNum, _onComplete: () => TurnBack(() => PlayCastAnimation(() => DoSkillLogic(() => { BackToOrigin(OnSkillFinished); }))));
+ MoveToTarget(mainTarget.Camp, mainTarget, _onComplete: () => TurnBack(() => PlayCastAnimation(() => DoSkillLogic(() => { BackToOrigin(OnSkillFinished); }))));
break;
case SkillCastMode.Allies:
- MoveToTarget(caster.Camp, skillConfig.CastIndexNum, _onComplete: () => TurnBack(() => PlayCastAnimation(() => DoSkillLogic(() => { BackToOrigin(OnSkillFinished); }))));
+ MoveToTarget(caster.Camp, skillConfig, _onComplete: () => TurnBack(() => PlayCastAnimation(() => DoSkillLogic(() => { BackToOrigin(OnSkillFinished); }))));
break;
// case SkillCastMode.DashCast:
// DashToTarget(() => BackToOrigin(OnSkillFinished));
@@ -143,13 +147,24 @@
OnActiveSkillFrame);//鏀诲嚮涓憞缁撴潫
}
- public void MoveToTarget(BattleCamp camp, int index, float duration = 0.2f, Action _onComplete = null)
+ public void MoveToTarget(BattleCamp camp, BattleObject target, float duration = 0.2f, Action _onComplete = null)
{
- // GetTargetNode();
- targetNode = battleField.GetTeamNode(camp, index);
+ targetNode = battleField.GetTeamNode(camp, target);
Vector2 offset = new Vector2(skillConfig.CastDistance, 0);
- RectTransform selfRect = caster.heroGo.transform as RectTransform;
+ RectTransform selfRect = caster.heroRectTrans;
+ RectTransform targetRect = targetNode;
+
+ var tweener = BattleUtility.MoveToTarget(selfRect, targetRect, offset, duration, _onComplete);
+ battleField.battleTweenMgr.OnPlayTween(tweener);
+ }
+
+ public void MoveToTarget(BattleCamp camp, SkillConfig skillCfg, float duration = 0.2f, Action _onComplete = null)
+ {
+ targetNode = battleField.GetTeamNode(camp, skillCfg);
+
+ Vector2 offset = new Vector2(skillConfig.CastDistance, 0);
+ RectTransform selfRect = caster.heroRectTrans;
RectTransform targetRect = targetNode;
var tweener = BattleUtility.MoveToTarget(selfRect, targetRect, offset, duration, _onComplete);
@@ -168,7 +183,7 @@
public void BackToOrigin(Action _onComplete = null)
{
- RectTransform selfRect = caster.heroGo.transform as RectTransform;
+ RectTransform selfRect = caster.heroRectTrans;
Vector2 targetAnchoredPos = Vector2.zero;
var tween = selfRect.DOAnchorPos(targetAnchoredPos, 0.2f)
.SetEase(Ease.Linear)
@@ -187,7 +202,6 @@
// 楂樹寒鎵�鏈夌洰鏍�
HashSet<BattleObject> highlightList = new HashSet<BattleObject>(battleField.battleObjMgr.GetBattleObjList(tagUseSkillAttack));
highlightList.Add(caster);
-
// 鎶婅繖浜汢O鍏ㄩ珮浜� 鎴栬�呰鎶婇櫎浜嗚繖浜涚殑閮芥斁鍦ㄩ伄缃╁悗闈�
@@ -208,28 +222,50 @@
continue;
}
- // 浼ゅ缁撶畻
+ // 浼ゅ鍒嗗竷 (涓囧垎姣�)
int[] damageDivide = skillConfig.DamageDivide[_hitIndex];
-
- List<long> damageList = new List<long>();
long totalDamage = GeneralDefine.GetFactValue(hurt.HurtHP, hurt.HurtHPEx);
- for (int j = 0; j < damageDivide.Length; j++)
- {
- long damage = totalDamage * damageDivide[j] / 10000;
- damageList.Add(damage);
- }
+ // 淇濊瘉鎵�鏈夊垎閰嶉」鍔犺捣鏉ョ瓑浜巘otalDamage锛岄伩鍏嶅洜鏁撮櫎瀵艰嚧鐨勮宸�
+ List<long> damageList = DivideDamageToList(damageDivide, totalDamage);
- OnHitEachTarget(target, damageList, ref hurt);
+ OnHitEachTarget(target, totalDamage, damageList, ref hurt);
}
+ }
+
+ /// <summary>
+ /// 淇濊瘉鎵�鏈夊垎閰嶉」鍔犺捣鏉ョ瓑浜巘otalDamage锛岄伩鍏嶅洜鏁撮櫎瀵艰嚧鐨勮宸�
+ /// </summary>
+ protected List<long> DivideDamageToList(int[] damageDivide, long totalDamage)
+ {
+ List<long> fixedDamageList = new List<long>();
+ long assigned = 0;
+ int count = damageDivide.Length;
+
+ for (int i = 0; i < count; i++)
+ {
+ long damage;
+ if (i == count - 1)
+ {
+ // 鏈�鍚庝竴涓垎閰嶉」淇涓哄墿浣�
+ damage = totalDamage - assigned;
+ }
+ else
+ {
+ damage = (totalDamage * damageDivide[i] + 5000) / 10000; // 鍥涜垗浜斿叆
+ assigned += damage;
+ }
+ fixedDamageList.Add(damage);
+ }
+ return fixedDamageList;
}
- protected virtual void OnHitEachTarget(BattleObject target, List<long> damageList, ref H0604_tagUseSkillAttack.tagSkillHurtObj hurt)
+ protected virtual void OnHitEachTarget(BattleObject target, long totalDamage, List<long> damageList, ref H0604_tagUseSkillAttack.tagSkillHurtObj hurt)
{
- target.Hurt(damageList, hurt.AttackType);
+ target.Hurt(damageList, totalDamage, hurt.AttackType);
- // 鍑讳腑鐩爣鐨勬椂鍊�,涓嶇杩戞垬杩滅▼ 閮界‘璁や竴涓嬫槸鍚︽湁鐖嗙偢鐗规晥 鐒跺悗鎾斁
+ // 鍑讳腑鐩爣鐨勬椂鍊�,涓嶇杩戞垬杩滅▼ 閮界‘璁や竴涓嬫槸鍚︽湁鐖嗙偢鐗规晥 鐒跺悗鎾斁
if (skillConfig.ExplosionEffectId > 0)
{
// 鎾斁鐖嗙偢鐗规晥
@@ -239,8 +275,160 @@
target.heroGo.transform
);
}
+
+ // 鍙椾激涔嬪悗杈ㄥ埆姝讳骸鐘舵�� 姝讳骸鍖呭叾瀹炲墠鍚庡抚浼氬娆¤Е鍙� 搴旇瑕佸嵆鏃秗emove鍏朵粬鐨勫寘鏉ヤ繚璇佷笉閲嶅
+ if (target.IsDead())
+ {
+ // SkillRecordAction閲岀殑drop浜嬩欢鍓嶇Щ鍒癲ead涔嬪悗
+ HB422_tagMCTurnFightObjDead deadPack = FindDeadPack(target);
+ CheckAfterDeadhPack(target, deadPack);
+ if (deadPack != null)
+ {
+ // 澶勭悊鎺夎惤鍖�
+ for (int i = 0; i < dropPackList.Count; i++)
+ {
+ PackageRegedit.Distribute(dropPackList[i]);
+ }
+
+ dropPackList.Clear();
+
+ target.PushExpPackList(new List<HB405_tagMCAddExp>(expPackList));
+
+ expPackList.Clear();
+
+ // 澶勭悊姝讳骸鍖�
+ PackageRegedit.Distribute(deadPack);
+ packList.Remove(deadPack);
+ }
+
+ // 澶嶆椿鍖呮殏鏃朵笉绠� 鍙兘鏄妧鑳界殑鍖�
+ // HB423_tagMCTurnFightObjReborn rebornPack = FindRebornPack(target);
+ // if (rebornPack != null)
+ // {
+ // // 澶勭悊澶嶆椿鍖�
+ // PackageRegedit.Distribute(rebornPack);
+ // packList.Remove(rebornPack);
+ // }
+ }
}
+ protected HB423_tagMCTurnFightObjReborn FindRebornPack(BattleObject target)
+ {
+ HB423_tagMCTurnFightObjReborn rebornPack = null;
+ for (int i = 0; i < packList.Count; i++)
+ {
+ var pack = packList[i];
+ if (pack is HB423_tagMCTurnFightObjReborn)
+ {
+ rebornPack = pack as HB423_tagMCTurnFightObjReborn;
+ if (rebornPack.ObjID == target.ObjID)
+ {
+ return rebornPack;
+ }
+ }
+ else if (pack is CustomHB426CombinePack)
+ {
+ var combinePack = pack as CustomHB426CombinePack;
+ if (combinePack.startTag.Tag.StartsWith("Skill_"))
+ {
+ break; // 鎵惧埌鎶�鑳藉寘灏变笉闇�瑕佸啀澶勭悊浜�
+ }
+ }
+ }
+ return null;
+ }
+
+ protected HB422_tagMCTurnFightObjDead FindDeadPack(BattleObject target)
+ {
+ HB422_tagMCTurnFightObjDead deadPack = null;
+ for (int i = 0; i < packList.Count; i++)
+ {
+ var pack = packList[i];
+ // 瀵绘壘姝讳骸鍖� 鎵惧埌姝讳骸鍖呬箣鍚庤鎵炬帀钀藉寘 涓嶈兘瓒呰繃鎶�鑳藉寘
+ if (pack is HB422_tagMCTurnFightObjDead)
+ {
+ deadPack = pack as HB422_tagMCTurnFightObjDead;
+ if (deadPack.ObjID == target.ObjID)
+ {
+ return deadPack;
+ }
+ }
+ else if (pack is CustomHB426CombinePack)
+ {
+ // 鎵炬浜″寘涓嶈瓒婅繃鎶�鑳藉寘
+ var combinePack = pack as CustomHB426CombinePack;
+ if (combinePack.startTag.Tag.StartsWith("Skill_"))
+ {
+ break;
+ }
+ }
+ }
+ return null;
+ }
+
+ protected void CheckAfterDeadhPack(BattleObject target, HB422_tagMCTurnFightObjDead deadPack)
+ {
+ if (null == deadPack)
+ {
+ return;
+ }
+ var deadPackIndex = packList.IndexOf(deadPack);
+ if (deadPackIndex < 0)
+ {
+ return;
+ }
+ List<int> removeIndexList = new List<int>();
+ for (int i = deadPackIndex + 1; i < packList.Count; i++)
+ {
+ var pack = packList[i];
+
+ // 澶嶆椿鍩烘湰閮介潬鎶�鑳藉寘
+ if (pack is CustomHB426CombinePack)
+ {
+ var combinePack = pack as CustomHB426CombinePack;
+ if (combinePack.startTag.Tag.StartsWith("Skill_"))
+ {
+ break; // 鎵惧埌鎶�鑳藉寘灏变笉闇�瑕佸啀澶勭悊浜�
+ }
+ }
+ else if (pack is H0704_tagRolePackRefresh)
+ {
+ var h0704Pack = pack as H0704_tagRolePackRefresh;
+ if (h0704Pack.PackType == (byte)PackType.DropItem)
+ {
+ // 鎺夎惤鐨�
+ if (h0704Pack.IsBind == 1)
+ {
+ // 鎺夎惤鐨勭墿鍝�
+ dropPackList.Add(h0704Pack);
+ removeIndexList.Add(i);
+ }
+ else if (h0704Pack.IsBind == 0)
+ {
+ // 鏇挎崲鐨�
+ }
+ }
+ }
+ else if (pack is HB405_tagMCAddExp)
+ {
+ var h405Pack = pack as HB405_tagMCAddExp;
+
+ //B4 05 鑾峰緱缁忛獙 #tagMCAddExp 閫氱煡鑾峰緱鐨勭粡楠岋紝
+ //鍙敤浜庡仛缁忛獙鑾峰緱琛ㄧ幇 Source = 2 鏃朵负涓荤嚎鍑绘潃鎬墿鑾峰緱缁忛獙
+ if (h405Pack.Source == 2)
+ {
+ expPackList.Add(h405Pack);
+ removeIndexList.Add(i);
+ }
+ }
+
+ }
+
+ for (int i = removeIndexList.Count - 1; i >= 0; i--)
+ {
+ packList.RemoveAt(removeIndexList[i]);
+ }
+ }
public virtual bool IsFinished()
{
return isFinished;
diff --git a/Main/System/Battle/SkillEffect/BulletSkillEffect.cs b/Main/System/Battle/SkillEffect/BulletSkillEffect.cs
index 00dc173..2981d31 100644
--- a/Main/System/Battle/SkillEffect/BulletSkillEffect.cs
+++ b/Main/System/Battle/SkillEffect/BulletSkillEffect.cs
@@ -49,7 +49,7 @@
Debug.LogError("瀛愬脊鐨勭洰鏍囨槸鑷繁锛屾殏鏃朵笉鏀寔 鍗忓晢绋嬪簭瀹屾垚");
break;
case SkillCastMode.Enemy:
- var targetNode = caster.battleField.GetTeamNode(caster.GetEnemyCamp(), skillConfig.CastIndexNum);
+ var targetNode = caster.battleField.GetTeamNode(caster.GetEnemyCamp(), skillConfig);
ShotToFormation(targetNode, onHitFormation);
break;
case SkillCastMode.Target:
@@ -67,7 +67,7 @@
}
break;
case SkillCastMode.Allies:
- var healNode = caster.battleField.GetTeamNode(caster.Camp, skillConfig.CastIndexNum);
+ var healNode = caster.battleField.GetTeamNode(caster.Camp, skillConfig);
ShotToFormation(healNode, onHitFormation);
break;
default:
@@ -116,7 +116,7 @@
EffectPlayer effectPlayer = caster.battleField.battleEffectMgr.PlayEffect(caster.ObjID, skillConfig.BulletEffectId, caster.effectNode);
RectTransform effectTrans = effectPlayer.transform as RectTransform;
- var bulletCurve = BulletCurveFactory.CreateBulletCurve(caster, skillConfig, effectPlayer, target.heroGo.transform as RectTransform, tagUseSkillAttack, (index, hitList) =>
+ var bulletCurve = BulletCurveFactory.CreateBulletCurve(caster, skillConfig, effectPlayer, target.heroRectTrans, tagUseSkillAttack, (index, hitList) =>
{
// 鍑讳腑灏遍攢姣佸瓙寮� 瀛愬脊涓嶉渶瑕佽嚜鍔ㄩ攢姣� 閰嶇疆琛ㄩ噷autoDestroy涓篺alse
caster.battleField.battleEffectMgr.RemoveEffect(skillConfig.BulletEffectId, effectPlayer);
diff --git a/Main/System/KnapSack/Logic/ItemLogicUtility.cs b/Main/System/KnapSack/Logic/ItemLogicUtility.cs
index 818c197..dd5fd08 100644
--- a/Main/System/KnapSack/Logic/ItemLogicUtility.cs
+++ b/Main/System/KnapSack/Logic/ItemLogicUtility.cs
@@ -368,6 +368,41 @@
}
}
+ /// <summary>
+ /// <param name="packType 鑳屽寘绫诲瀷"></param>
+ /// <param name="itemId 鐗╁搧ID"></param>
+ /// <param name="needCount 闇�瑕佹暟閲�"></param>
+ /// <param name="needTips 鏄惁闇�瑕佹彁绀�"></param>
+ /// <returns></returns>
+ public static bool CheckItemCount(PackType packType, int itemId, int needCount, bool needTips)
+ {
+ if (needCount <= 0)
+ {
+ return true;
+ }
+
+ int haveCount = PackManager.Instance.GetItemCountByID(packType, itemId);
+
+ bool isEnough = haveCount >= needCount;
+
+ if (!isEnough && needTips)
+ {
+ var itemConfig = ItemConfig.Get(itemId);
+
+ if (null != itemConfig)
+ {
+ // SysNotifyMgr.Instance.ShowTip();
+ }
+ }
+
+ return isEnough;
+ }
+
+ public static bool CheckCurrencyCount()
+ {
+ return true;
+ }
+
public event Action<string> GetBetterEquipEvent; //寰楀埌鏇村ソ鐨勮澶� value 鐗╁搧鐨勫疄渚婭D
// public void OnGetEquip(ItemModel item)
diff --git a/Main/System/Team/TeamManager.cs b/Main/System/Team/TeamManager.cs
index d2594c9..2afd452 100644
--- a/Main/System/Team/TeamManager.cs
+++ b/Main/System/Team/TeamManager.cs
@@ -1,12 +1,14 @@
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
-
+using System;
public class TeamManager : GameSystemManager<TeamManager>
{
protected Dictionary<TeamType, TeamBase> teamDict = new Dictionary<TeamType, TeamBase>();
+
+ public Action<TeamType> OnTeamChange = null;
public override void Init()
{
@@ -29,9 +31,12 @@
public void OnHeroChangeEvent(HB124_tagSCLineupInfo vNetData)
{
var heroPack = PackManager.Instance.GetSinglePack(PackType.Hero);
+ HashSet<TeamType> teamTypeSet = new HashSet<TeamType>();
for (int i = 0; i < vNetData.LineupCnt; i++)
{
- var team = GetTeam((TeamType)vNetData.LineupList[i].LineupID);
+ TeamType teamType = (TeamType)vNetData.LineupList[i].LineupID;
+ teamTypeSet.Add(teamType);
+ var team = GetTeam(teamType);
for (int j = 0; j < vNetData.LineupList[i].HeroCnt; j++)
{
int index = vNetData.LineupList[i].HeroItemIndexList[j];
@@ -54,7 +59,12 @@
team.RefreshServerData(vNetData.LineupList[i].ShapeType, j, hero);
}
}
- }
+
+ foreach (var tt in teamTypeSet)
+ {
+ OnTeamChange?.Invoke(tt);
+ }
+ }
public bool HasTeam(TeamType teamType)
diff --git a/Main/Utility/EnumHelper.cs b/Main/Utility/EnumHelper.cs
index 3e95377..837e293 100644
--- a/Main/Utility/EnumHelper.cs
+++ b/Main/Utility/EnumHelper.cs
@@ -466,7 +466,7 @@
GoldPaper = 19, //閲戠エ 19,
Silver = 20, //閾跺瓙 20,
SilverPaper = 21, //閾剁エ 21,
- //FightPoint = 22, //鎴樻枟鍊� 22,
+ FightPoint = 22, //鎴樻枟鍊�(閿ゅ瓙) 22,
HappyPoint = 23, //濞变箰鍊� 23,
MapID = 24, //瑙掕壊鎵�鍦ㄥ湴鍥� 24,
PosX = 25, //瑙掕壊鍧愭爣 25,
--
Gitblit v1.8.0