From c43c044ea821b217aab96161d29bfcd1a06eb94c Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期三, 02 七月 2025 19:41:22 +0800
Subject: [PATCH] 130 子 【战斗】战斗系统 / 【战斗】战斗系统-客户端 飘血+配置优化
---
Main/Config/ConfigBase.cs | 47 ++---
Main/System/Battle/UIComp/DamageContent.cs | 41 ++++
Main/System/Battle/UIComp.meta | 8
Main/Common/EventName.cs | 7
Main/Config/ConfigManager.cs | 177 ++----------------
Main/System/Battle/BattleHUDWin.cs | 119 +++++++++++++
Main/System/Battle/BattleWin.cs | 4
Main/System/Battle/UIComp/DamageLine.cs | 23 ++
Main/ResModule/ResManager.cs | 17 +
Main/System/Battle/BattleHUDWin.cs.meta | 11 +
Main/System/Battle/BattleObject/BattleObject.cs | 22 ++
Main/System/Battle/UIComp/DamageLine.cs.meta | 11 +
Main/System/Battle/UIComp/DamageContent.cs.meta | 11 +
13 files changed, 316 insertions(+), 182 deletions(-)
diff --git a/Main/Common/EventName.cs b/Main/Common/EventName.cs
index b7d2d1a..68165bb 100644
--- a/Main/Common/EventName.cs
+++ b/Main/Common/EventName.cs
@@ -2,6 +2,11 @@
public class EventName
{
-
+ public const string BATTLE_BUFF_MOUNTED = "BATTLE_BUFF_MOUNTED";//BUFF MOUNTED
+
+ public const string BATTLE_BUFF_DISAPEAR = "BATTLE_BUFF_DISAPEAR";//BUFF DISAPEAR
+
+ public const string BATTLE_DAMAGE_TAKEN = "BATTLE_DAMAGE_TAKEN";//閫犳垚浼ゅ
+
}
\ No newline at end of file
diff --git a/Main/Config/ConfigBase.cs b/Main/Config/ConfigBase.cs
index 3f4f3d0..acadfe4 100644
--- a/Main/Config/ConfigBase.cs
+++ b/Main/Config/ConfigBase.cs
@@ -13,11 +13,7 @@
public static T Get(U id)
{
- if (!isInit)
- {
- Debug.LogError("ConfigBase 娌℃湁鍒濆鍖�");
- return null; // 鎴栬�呮姏鍑哄紓甯革紝瑙嗘儏鍐佃�屽畾
- }
+ LazyInit();
if (dic.ContainsKey(id))
{
@@ -34,11 +30,7 @@
public static List<U> GetKeys()
{
- if (!isInit)
- {
- Debug.LogError(typeof(U).Name + " 娌℃湁鍒濆鍖� GetKeys");
- return null; // 鎴栬�呮姏鍑哄紓甯革紝瑙嗘儏鍐佃�屽畾
- }
+ LazyInit();
List<U> result = new List<U>();
result.AddRange(dic.Keys);
return result;
@@ -47,11 +39,7 @@
public static List<T> GetValues()
{
- if (!isInit)
- {
- Debug.LogError(typeof(T).Name + " 娌℃湁鍒濆鍖� GetValues");
- return null; // 鎴栬�呮姏鍑哄紓甯革紝瑙嗘儏鍐佃�屽畾
- }
+ LazyInit();
List<T> result = new List<T>();
result.AddRange(dic.Values);
return result;
@@ -59,19 +47,24 @@
public static bool HasKey(U key)
{
- if (!isInit)
- {
- Debug.LogError(typeof(T).Name + " 娌℃湁鍒濆鍖� HasKey");
- return false; // 鎴栬�呮姏鍑哄紓甯革紝瑙嗘儏鍐佃�屽畾
- }
+ LazyInit();
return dic.ContainsKey(key);
+ }
+
+ public static void LazyInit()
+ {
+ if (!isInit)
+ {
+ // 瀹為檯涓婃槸鍚屾鐨�
+ ConfigManager.Instance.LoadConfigByType(typeof(T));
+ }
}
public static void Init(string[] lines)
{
dic.Clear();
-
+
for (int i = 3; i < lines.Length; i++)
{
string line = lines[i];
@@ -86,18 +79,18 @@
U key = config.LoadKey(strKey);
config.LoadConfig(line);
config.OnConfigParseCompleted();
- #if UNITY_EDITOR
+#if UNITY_EDITOR
try
{
- #endif
- dic.Add(key, config);
- #if UNITY_EDITOR
+#endif
+ dic.Add(key, config);
+#if UNITY_EDITOR
}
catch (ArgumentException exception)
{
- Debug.LogError(typeof(T).Name + " 閲嶅鐨刱ey " + key + " " + exception.Message);
+ Debug.LogError(typeof(T).Name + " 閲嶅鐨刱ey " + key + " " + exception.Message);
}
- #endif
+#endif
}
foreach (var cfg in dic.Values)
diff --git a/Main/Config/ConfigManager.cs b/Main/Config/ConfigManager.cs
index baeb932..6057f84 100644
--- a/Main/Config/ConfigManager.cs
+++ b/Main/Config/ConfigManager.cs
@@ -33,81 +33,52 @@
isLoadFinished = false;
// 鍔犺浇閰嶇疆鏂囦欢
- int totalConfigs = 65;
+ int totalConfigs = 17;
Type[] configTypes = new Type[] {
- typeof(AppointItemConfig),
- typeof(AudioConfig),
- typeof(ChatBubbleBoxConfig),
typeof(ChestsAwardConfig),
- typeof(ChestsConfig),
typeof(CTGConfig),
- typeof(CTGSelectItemConfig),
- typeof(DailyLivenessRewardConfig),
- typeof(DailyQuestConfig),
- typeof(DailyQuestOpenTimeConfig),
- typeof(DienstgradConfig),
- typeof(DirtyNameConfig),
typeof(DirtyWordConfig),
- typeof(EffectConfig),
- typeof(EmojiPackConfig),
typeof(EquipGSParamConfig),
- typeof(EquipPlaceMapConfig),
- typeof(FamilyConfig),
- typeof(FamilyEmblemConfig),
- typeof(FirstGoldConfig),
- typeof(FrameAnimationConfig),
- typeof(FuncConfigConfig),
- typeof(FuncOpenLVConfig),
- typeof(FunctionTeamSetConfig),
- typeof(GetItemWaysConfig),
- typeof(GmCmdConfig),
- typeof(GuideConfig),
- typeof(HeroAwakeConfig),
- typeof(HeroBreakConfig),
- typeof(HeroConfig),
- typeof(HeroFetterConfig),
- typeof(HeroQualityAwakeConfig),
- typeof(HeroQualityBreakConfig),
- typeof(HeroQualityConfig),
- typeof(HeroSkinConfig),
- typeof(HeroTalentConfig),
- typeof(IconConfig),
- typeof(ItemConfig),
- typeof(KickOutReasonConfig),
- typeof(LanguageConfig),
- typeof(MailConfig),
typeof(NPCConfig),
typeof(NPCExConfig),
typeof(OrderInfoConfig),
- typeof(PlayerFaceConfig),
- typeof(PlayerFacePicConfig),
typeof(PlayerFacePicStarConfig),
typeof(PlayerFaceStarConfig),
typeof(PlayerLVConfig),
- typeof(PlayerPropertyConfig),
- typeof(priorbundleConfig),
- typeof(RealmConfig),
- typeof(RealmLVUPTaskConfig),
- typeof(RichTextMsgReplaceConfig),
- typeof(RuleConfig),
- typeof(SkillConfig),
typeof(StoreConfig),
typeof(SuccessConfig),
typeof(SysInfoConfig),
- typeof(TaskConfig),
typeof(TitleStarUpConfig),
- typeof(TreasureCntAwardConfig),
typeof(TreasureItemLibConfig),
typeof(TreasureSetConfig),
typeof(XBGetItemConfig)
};
+#if UNITY_EDITOR
+ List<string> fastName = new List<string>();
+#endif
// 閫愪釜鍔犺浇閰嶇疆骞舵洿鏂拌繘搴�
for (int i = 0; i < configTypes.Length; i++)
{
+ var sw = System.Diagnostics.Stopwatch.StartNew();
await LoadConfigByType(configTypes[i]);
+ sw.Stop();
+#if UNITY_EDITOR
+ if (sw.ElapsedMilliseconds >= 100)
+ {
+ Debug.LogError($"鍔犺浇閰嶇疆 {configTypes[i].Name} 鑰楁椂杈冮暱: {sw.ElapsedMilliseconds} ms");
+ }
+ else if (sw.ElapsedMilliseconds <= 5)
+ {
+ fastName.Add(configTypes[i].Name);
+ }
+ Debug.Log($"鍔犺浇閰嶇疆: {configTypes[i].Name} 鐢ㄦ椂: {sw.ElapsedMilliseconds} ms");
+#endif
loadingProgress = (float)(i + 1) / totalConfigs;
}
+#if UNITY_EDITOR
+ System.IO.File.WriteAllText(Application.dataPath + "/fastConfig.txt", string.Join("\n", fastName));
+#endif
// 鍔犺浇瀹屾垚鍚庤缃甶sLoadFinished涓簍rue
loadingProgress = 1f;
@@ -121,10 +92,10 @@
{
configName = configName.Substring(0, configName.Length - 6);
}
- TextAsset textAsset = ResManager.Instance.LoadAsset<TextAsset>("Config", configName);
- if (textAsset != null)
+ string[] texts = ResManager.Instance.LoadConfig(configName);
+ if (texts != null)
{
- string[] lines = textAsset.text.Split('\n');
+ string[] lines = texts;
var methodInfo = configType.GetMethod("Init", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.FlattenHierarchy);
if (methodInfo != null)
{
@@ -152,10 +123,10 @@
{
string configName = typeof(T).Name;
- TextAsset textAsset = ResManager.Instance.LoadAsset<TextAsset>("Config", configName);
- if (textAsset != null)
+ string[] texts = ResManager.Instance.LoadConfig(configName);
+ if (texts != null)
{
- string[] lines = textAsset.text.Split('\n');
+ string[] lines = texts;
var methodInfo = typeof(T).GetMethod("Init", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);
if (methodInfo != null)
{
@@ -196,130 +167,34 @@
public override void Release()
{
- // 娓呯┖ AppointItemConfig 瀛楀吀
- ClearConfigDictionary<AppointItemConfig>();
- // 娓呯┖ AudioConfig 瀛楀吀
- ClearConfigDictionary<AudioConfig>();
- // 娓呯┖ ChatBubbleBoxConfig 瀛楀吀
- ClearConfigDictionary<ChatBubbleBoxConfig>();
// 娓呯┖ ChestsAwardConfig 瀛楀吀
ClearConfigDictionary<ChestsAwardConfig>();
- // 娓呯┖ ChestsConfig 瀛楀吀
- ClearConfigDictionary<ChestsConfig>();
// 娓呯┖ CTGConfig 瀛楀吀
ClearConfigDictionary<CTGConfig>();
- // 娓呯┖ CTGSelectItemConfig 瀛楀吀
- ClearConfigDictionary<CTGSelectItemConfig>();
- // 娓呯┖ DailyLivenessRewardConfig 瀛楀吀
- ClearConfigDictionary<DailyLivenessRewardConfig>();
- // 娓呯┖ DailyQuestConfig 瀛楀吀
- ClearConfigDictionary<DailyQuestConfig>();
- // 娓呯┖ DailyQuestOpenTimeConfig 瀛楀吀
- ClearConfigDictionary<DailyQuestOpenTimeConfig>();
- // 娓呯┖ DienstgradConfig 瀛楀吀
- ClearConfigDictionary<DienstgradConfig>();
- // 娓呯┖ DirtyNameConfig 瀛楀吀
- ClearConfigDictionary<DirtyNameConfig>();
// 娓呯┖ DirtyWordConfig 瀛楀吀
ClearConfigDictionary<DirtyWordConfig>();
- // 娓呯┖ EffectConfig 瀛楀吀
- ClearConfigDictionary<EffectConfig>();
- // 娓呯┖ EmojiPackConfig 瀛楀吀
- ClearConfigDictionary<EmojiPackConfig>();
// 娓呯┖ EquipGSParamConfig 瀛楀吀
ClearConfigDictionary<EquipGSParamConfig>();
- // 娓呯┖ EquipPlaceMapConfig 瀛楀吀
- ClearConfigDictionary<EquipPlaceMapConfig>();
- // 娓呯┖ FamilyConfig 瀛楀吀
- ClearConfigDictionary<FamilyConfig>();
- // 娓呯┖ FamilyEmblemConfig 瀛楀吀
- ClearConfigDictionary<FamilyEmblemConfig>();
- // 娓呯┖ FirstGoldConfig 瀛楀吀
- ClearConfigDictionary<FirstGoldConfig>();
- // 娓呯┖ FrameAnimationConfig 瀛楀吀
- ClearConfigDictionary<FrameAnimationConfig>();
- // 娓呯┖ FuncConfigConfig 瀛楀吀
- ClearConfigDictionary<FuncConfigConfig>();
- // 娓呯┖ FuncOpenLVConfig 瀛楀吀
- ClearConfigDictionary<FuncOpenLVConfig>();
- // 娓呯┖ FunctionTeamSetConfig 瀛楀吀
- ClearConfigDictionary<FunctionTeamSetConfig>();
- // 娓呯┖ GetItemWaysConfig 瀛楀吀
- ClearConfigDictionary<GetItemWaysConfig>();
- // 娓呯┖ GmCmdConfig 瀛楀吀
- ClearConfigDictionary<GmCmdConfig>();
- // 娓呯┖ GuideConfig 瀛楀吀
- ClearConfigDictionary<GuideConfig>();
- // 娓呯┖ HeroAwakeConfig 瀛楀吀
- ClearConfigDictionary<HeroAwakeConfig>();
- // 娓呯┖ HeroBreakConfig 瀛楀吀
- ClearConfigDictionary<HeroBreakConfig>();
- // 娓呯┖ HeroConfig 瀛楀吀
- ClearConfigDictionary<HeroConfig>();
- // 娓呯┖ HeroFetterConfig 瀛楀吀
- ClearConfigDictionary<HeroFetterConfig>();
- // 娓呯┖ HeroQualityAwakeConfig 瀛楀吀
- ClearConfigDictionary<HeroQualityAwakeConfig>();
- // 娓呯┖ HeroQualityBreakConfig 瀛楀吀
- ClearConfigDictionary<HeroQualityBreakConfig>();
- // 娓呯┖ HeroQualityConfig 瀛楀吀
- ClearConfigDictionary<HeroQualityConfig>();
- // 娓呯┖ HeroSkinConfig 瀛楀吀
- ClearConfigDictionary<HeroSkinConfig>();
- // 娓呯┖ HeroTalentConfig 瀛楀吀
- ClearConfigDictionary<HeroTalentConfig>();
- // 娓呯┖ IconConfig 瀛楀吀
- ClearConfigDictionary<IconConfig>();
- // 娓呯┖ ItemConfig 瀛楀吀
- ClearConfigDictionary<ItemConfig>();
- // 娓呯┖ KickOutReasonConfig 瀛楀吀
- ClearConfigDictionary<KickOutReasonConfig>();
- // 娓呯┖ LanguageConfig 瀛楀吀
- ClearConfigDictionary<LanguageConfig>();
- // 娓呯┖ MailConfig 瀛楀吀
- ClearConfigDictionary<MailConfig>();
// 娓呯┖ NPCConfig 瀛楀吀
ClearConfigDictionary<NPCConfig>();
// 娓呯┖ NPCExConfig 瀛楀吀
ClearConfigDictionary<NPCExConfig>();
// 娓呯┖ OrderInfoConfig 瀛楀吀
ClearConfigDictionary<OrderInfoConfig>();
- // 娓呯┖ PlayerFaceConfig 瀛楀吀
- ClearConfigDictionary<PlayerFaceConfig>();
- // 娓呯┖ PlayerFacePicConfig 瀛楀吀
- ClearConfigDictionary<PlayerFacePicConfig>();
// 娓呯┖ PlayerFacePicStarConfig 瀛楀吀
ClearConfigDictionary<PlayerFacePicStarConfig>();
// 娓呯┖ PlayerFaceStarConfig 瀛楀吀
ClearConfigDictionary<PlayerFaceStarConfig>();
// 娓呯┖ PlayerLVConfig 瀛楀吀
ClearConfigDictionary<PlayerLVConfig>();
- // 娓呯┖ PlayerPropertyConfig 瀛楀吀
- ClearConfigDictionary<PlayerPropertyConfig>();
- // 娓呯┖ priorbundleConfig 瀛楀吀
- ClearConfigDictionary<priorbundleConfig>();
- // 娓呯┖ RealmConfig 瀛楀吀
- ClearConfigDictionary<RealmConfig>();
- // 娓呯┖ RealmLVUPTaskConfig 瀛楀吀
- ClearConfigDictionary<RealmLVUPTaskConfig>();
- // 娓呯┖ RichTextMsgReplaceConfig 瀛楀吀
- ClearConfigDictionary<RichTextMsgReplaceConfig>();
- // 娓呯┖ RuleConfig 瀛楀吀
- ClearConfigDictionary<RuleConfig>();
- // 娓呯┖ SkillConfig 瀛楀吀
- ClearConfigDictionary<SkillConfig>();
// 娓呯┖ StoreConfig 瀛楀吀
ClearConfigDictionary<StoreConfig>();
// 娓呯┖ SuccessConfig 瀛楀吀
ClearConfigDictionary<SuccessConfig>();
// 娓呯┖ SysInfoConfig 瀛楀吀
ClearConfigDictionary<SysInfoConfig>();
- // 娓呯┖ TaskConfig 瀛楀吀
- ClearConfigDictionary<TaskConfig>();
// 娓呯┖ TitleStarUpConfig 瀛楀吀
ClearConfigDictionary<TitleStarUpConfig>();
- // 娓呯┖ TreasureCntAwardConfig 瀛楀吀
- ClearConfigDictionary<TreasureCntAwardConfig>();
// 娓呯┖ TreasureItemLibConfig 瀛楀吀
ClearConfigDictionary<TreasureItemLibConfig>();
// 娓呯┖ TreasureSetConfig 瀛楀吀
diff --git a/Main/ResModule/ResManager.cs b/Main/ResModule/ResManager.cs
index b8318cb..b049bde 100644
--- a/Main/ResModule/ResManager.cs
+++ b/Main/ResModule/ResManager.cs
@@ -164,6 +164,23 @@
return asset;
}
+ public string[] LoadConfig(string name)
+ {
+ string path = string.Empty;
+ if (!AssetSource.isUseAssetBundle)
+ {
+#if UNITY_EDITOR
+ path = ResourcesPath.CONFIG_FODLER + "/" + name + ".txt";
+#endif
+ }
+ else
+ {
+ path = AssetVersionUtility.GetAssetFilePath($"Config/{name}.txt");
+ }
+
+ return File.ReadAllLines(path);
+ }
+
private Sprite LoadSprite(string atlasName, string spriteName)
{
#if !UNITY_EDITOR
diff --git a/Main/System/Battle/BattleHUDWin.cs b/Main/System/Battle/BattleHUDWin.cs
new file mode 100644
index 0000000..e260b67
--- /dev/null
+++ b/Main/System/Battle/BattleHUDWin.cs
@@ -0,0 +1,119 @@
+锘縰sing UnityEngine;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine.UI;
+using DG.Tweening;
+using Cysharp.Threading.Tasks;
+
+
+// 杩欎釜鐣岄潰鏄� persistent鐨勭晫闈�
+public class BattleHUDWin : UIBase
+{
+ // 缁勪欢寮曠敤
+ // private List<HUDContent> damageList = new List<HUDContent>();
+
+ // private List<BuffContent> buffList = new List<BuffContent>();
+
+ private GameObjectPoolManager.GameObjectPool damagePrefabPool;
+
+ private GameObjectPoolManager.GameObjectPool buffIconPrefabPool;
+
+ private GameObjectPoolManager.GameObjectPool buffLabelPrefabPool;
+
+ public Transform damageNode;
+
+ public Transform buffIconNode;
+
+ public Transform buffLabelNode;
+
+ // 鐢熷懡鍛ㄦ湡
+ protected override void InitComponent()
+ {
+ base.InitComponent();
+ // 鍒濆鍖栫粍浠跺紩鐢� 缁戝畾鎸夐挳绛塙I缁勪欢浜嬩欢
+ }
+
+ protected override void OnPreOpen()
+ {
+ base.OnPreOpen();
+ EventBroadcast.Instance.AddListener<BattleObject, List<int>>(EventName.BATTLE_DAMAGE_TAKEN, OnDamageTaken);
+ EventBroadcast.Instance.AddListener<BattleObject, SkillConfig>(EventName.BATTLE_BUFF_MOUNTED, OnBuffMounted);
+ EventBroadcast.Instance.AddListener<BattleObject, SkillConfig>(EventName.BATTLE_BUFF_DISAPEAR, OnBuffDisapear);
+ damagePrefabPool = GameObjectPoolManager.Instance.RequestPool(ResManager.Instance.LoadAsset<GameObject>("UIComp", "DamageContent"));
+ // buffIconPrefabPool = GameObjectPoolManager.Instance.RequestPool();
+ // buffLabelPrefabPool = GameObjectPoolManager.Instance.RequestPool(ResManager.Instance.LoadAsset<GameObject>("UIComp", "BuffContent"));
+ }
+
+ protected override void OnPreClose()
+ {
+ base.OnPreClose();
+ EventBroadcast.Instance.RemoveListener<BattleObject, List<int>>(EventName.BATTLE_DAMAGE_TAKEN, OnDamageTaken);
+ EventBroadcast.Instance.RemoveListener<BattleObject, SkillConfig>(EventName.BATTLE_BUFF_MOUNTED, OnBuffMounted);
+ EventBroadcast.Instance.RemoveListener<BattleObject, SkillConfig>(EventName.BATTLE_BUFF_DISAPEAR, OnBuffDisapear);
+ }
+
+ protected override void OnOpen()
+ {
+ base.OnOpen();
+ }
+
+ protected override void OnClose()
+ {
+ base.OnClose();
+ }
+
+ protected override void NextFrameAfterOpen()
+ {
+ base.NextFrameAfterOpen();
+ }
+
+ protected override void CompleteClose()
+ {
+ base.CompleteClose();
+ }
+
+ private void OnDamageTaken(BattleObject bo, List<int> damageList)
+ {
+ GameObject damageContent = damagePrefabPool.Request();
+ DamageContent content = damageContent.GetComponent<DamageContent>();
+ damageContent.transform.SetParent(damageNode, false);
+ damageContent.transform.localPosition = new Vector3(damageContent.transform.localPosition.x, damageContent.transform.localPosition.y, 0);
+ content.SetDamage(damageList, () => damagePrefabPool.Release(damageContent));
+
+ // heroGo 鐨� parent 浣滀负鍙傝�冭妭鐐�
+ var heroGo = bo.heroGo;
+ if (heroGo == null)
+ return;
+
+ var heroRect = heroGo.GetComponent<RectTransform>();
+ if (heroRect == null)
+ return;
+
+ // 璁$畻 heroGo 鍦� content 鐖惰妭鐐逛笅鐨� anchoredPosition
+ var contentRect = content.GetComponent<RectTransform>();
+ var contentParentRect = contentRect.parent as RectTransform;
+
+ // 鑾峰彇 heroGo 鐨勪笘鐣屽潗鏍�
+ Vector3 worldTargetPos = heroRect.TransformPoint(heroRect.anchoredPosition);
+
+ // 杞崲鍒� content 鐖惰妭鐐逛笅鐨� anchoredPosition
+ Vector2 anchoredPos;
+ RectTransformUtility.ScreenPointToLocalPointInRectangle(
+ contentParentRect,
+ RectTransformUtility.WorldToScreenPoint(null, worldTargetPos),
+ null,
+ out anchoredPos);
+
+ contentRect.anchoredPosition = anchoredPos;
+ }
+
+ private void OnBuffMounted(BattleObject bo, SkillConfig buffConfig)
+ {
+
+ }
+
+ private void OnBuffDisapear(BattleObject bo, SkillConfig buffConfig)
+ {
+
+ }
+}
diff --git a/Main/System/Battle/BattleHUDWin.cs.meta b/Main/System/Battle/BattleHUDWin.cs.meta
new file mode 100644
index 0000000..7678b17
--- /dev/null
+++ b/Main/System/Battle/BattleHUDWin.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 16f4cd28fdf242645943d06ae9d87c97
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Main/System/Battle/BattleObject/BattleObject.cs b/Main/System/Battle/BattleObject/BattleObject.cs
index b4f0057..cb3a713 100644
--- a/Main/System/Battle/BattleObject/BattleObject.cs
+++ b/Main/System/Battle/BattleObject/BattleObject.cs
@@ -40,7 +40,11 @@
protected MotionBase motionBase;
- protected GameObject heroGo;
+ public GameObject heroGo
+ {
+ get;
+ private set;
+ }
public BattleObject(BattleField _battleField)
{
@@ -175,7 +179,7 @@
return true;
}
-
+
public virtual void TakeDamage(List<int> damageValues)
{
if (IsDead())
@@ -192,6 +196,7 @@
totalDamage += damage;
}
+
// 鎵h
teamHero.curHp -= totalDamage;
@@ -200,6 +205,7 @@
// {
// OnDeath();
// }
+
}
// 闂伩寮�濮�
@@ -251,6 +257,8 @@
{
Debug.Log($"Damage: {damage}");
}
+
+ EventBroadcast.Instance.Broadcast<BattleObject, List<int>>(EventName.BATTLE_DAMAGE_TAKEN, this, damageValues);
}
public void PlaySkill(SkillConfig skillConfig, List<Dictionary<int, List<int>>> damageList, Action _onComplete)
@@ -378,7 +386,15 @@
int totalDamage = teamHero.attack - obj.teamHero.defense;
- damageList.Add(totalDamage);
+ int damage1 = (int)((float)totalDamage * 0.3f);
+
+ int damage2 = (int)((float)totalDamage * 0.25f);
+
+ int damage3 = totalDamage - damage1 - damage2;
+
+ damageList.Add(damage1);
+ damageList.Add(damage2);
+ damageList.Add(damage3);
return damageList;
}
diff --git a/Main/System/Battle/BattleWin.cs b/Main/System/Battle/BattleWin.cs
index 4fdb5cb..4291d09 100644
--- a/Main/System/Battle/BattleWin.cs
+++ b/Main/System/Battle/BattleWin.cs
@@ -24,11 +24,15 @@
base.OnPreOpen();
SetBattleField(BattleManager.Instance.storyBattleField);
+
+ if (!UIManager.Instance.GetUI<BattleHUDWin>())
+ UIManager.Instance.OpenWindow<BattleHUDWin>();
}
protected override void OnPreClose()
{
base.OnPreClose();
+ UIManager.Instance.CloseWindow<BattleHUDWin>();
}
protected override void OnOpen()
diff --git a/Main/System/Battle/UIComp.meta b/Main/System/Battle/UIComp.meta
new file mode 100644
index 0000000..cdb105d
--- /dev/null
+++ b/Main/System/Battle/UIComp.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 2df384ebef02f254193d75f1dfecdb76
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Main/System/Battle/UIComp/DamageContent.cs b/Main/System/Battle/UIComp/DamageContent.cs
new file mode 100644
index 0000000..a12d1b7
--- /dev/null
+++ b/Main/System/Battle/UIComp/DamageContent.cs
@@ -0,0 +1,41 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using System;
+
+public class DamageContent : MonoBehaviour
+{
+ public GameObject line;
+
+ public RectTransform parent;
+
+ protected List<DamageLine> damageLineList = new List<DamageLine>();
+
+ public PositionTween posTween;
+
+ void Awake()
+ {
+ line.SetActive(false);
+ }
+
+ public void SetDamage(List<int> damages, Action _onComplete)
+ {
+ for (int i = 0; i < damages.Count; i++)
+ {
+ if (i >= damageLineList.Count)
+ {
+ GameObject newLine = GameObject.Instantiate(line, parent);
+ damageLineList.Add(newLine.GetComponent<DamageLine>());
+ }
+ damageLineList[i].SetActive(true);
+ damageLineList[i].SetDamage(damages[i]);
+ }
+
+ for (int i = damages.Count; i < damageLineList.Count; i++)
+ {
+ damageLineList[i].SetActive(false);
+ }
+
+ posTween.Play(_onComplete);
+ }
+}
diff --git a/Main/System/Battle/UIComp/DamageContent.cs.meta b/Main/System/Battle/UIComp/DamageContent.cs.meta
new file mode 100644
index 0000000..608fe50
--- /dev/null
+++ b/Main/System/Battle/UIComp/DamageContent.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 942dffc0f5354064485a6012dbb1db96
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Main/System/Battle/UIComp/DamageLine.cs b/Main/System/Battle/UIComp/DamageLine.cs
new file mode 100644
index 0000000..68ae28b
--- /dev/null
+++ b/Main/System/Battle/UIComp/DamageLine.cs
@@ -0,0 +1,23 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class DamageLine : MonoBehaviour
+{
+
+ public TextEx damageTypeLabel;
+
+ public TextEx damageValueLabel;
+
+ public void SetDamage(DamageType damageType, int damage)
+ {
+ damageTypeLabel.SetActive(true);
+ damageValueLabel.text = damage.ToString();
+ }
+
+ public void SetDamage(int damage)
+ {
+ damageTypeLabel.SetActive(false);
+ damageValueLabel.text = damage.ToString();
+ }
+}
diff --git a/Main/System/Battle/UIComp/DamageLine.cs.meta b/Main/System/Battle/UIComp/DamageLine.cs.meta
new file mode 100644
index 0000000..9c3067e
--- /dev/null
+++ b/Main/System/Battle/UIComp/DamageLine.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 69c7e3c9c17e56542b39f18f4c17d43e
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
--
Gitblit v1.8.0