From f0b84a5808e4ee357e8770282b77c6355aec9404 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期五, 07 十一月 2025 23:03:11 +0800
Subject: [PATCH] 0312 增加飘经验值
---
Main/System/Equip/EquipModel.cs | 10 +++++-----
Main/System/Equip/ItemsOnFloor.cs | 32 +++++++++++++++++++++++++++++---
Main/System/Battle/BattleObject/BattleObject.cs | 2 +-
3 files changed, 35 insertions(+), 9 deletions(-)
diff --git a/Main/System/Battle/BattleObject/BattleObject.cs b/Main/System/Battle/BattleObject/BattleObject.cs
index ba3afa0..90db068 100644
--- a/Main/System/Battle/BattleObject/BattleObject.cs
+++ b/Main/System/Battle/BattleObject/BattleObject.cs
@@ -473,7 +473,7 @@
public void PerformDrop()
{
- if (null == m_battleDrops || m_battleDrops.dropItemPackIndex.Count == 0)
+ if (null == m_battleDrops)
return;
EventBroadcast.Instance.Broadcast<string, BattleDrops, Action>(
diff --git a/Main/System/Equip/EquipModel.cs b/Main/System/Equip/EquipModel.cs
index 8828597..4b8f35d 100644
--- a/Main/System/Equip/EquipModel.cs
+++ b/Main/System/Equip/EquipModel.cs
@@ -11,7 +11,7 @@
public const int TotleEquip = 12; //瑁呭鏍忓ぇ灏�
public bool waitEquipOPPack = false; // 绌挎埓瑁呭鐨勬搷浣� 涓嶅惈鍒嗚В
public event Action<bool, int> OnEquipOPResultAction; //鏄惁鎹笂浜嗘柊瑁呭涓斿垎瑙d簡 瑁呭绱㈠紩
- public event Action<List<int>, RectTransform> OnItemDropEvent;
+ public event Action<BattleDrops> OnItemDropEvent;
//鐢ㄤ簬椋樺姩閫昏緫
// public Dictionary<int, EquipOnFloorInfo> equipFloorInfo = new Dictionary<int, EquipOnFloorInfo>(); //鐪熷疄鑳屽寘鐨勭储寮曪紝瀵瑰簲鍦版澘瑁呭鐨勪俊鎭�
@@ -98,9 +98,9 @@
if (!string.IsNullOrEmpty(guid))
return;
- lastDropIndexs = drops.dropItemPackIndex;
+ // lastDropIndexs = drops.dropItemPackIndex;
// Debug.Log("-鎺夎惤瑁呭 " + lastDropIndexs.Count + " 涓�" + JsonMapper.ToJson(lastDropIndexs));
- NotifyItemDrop(drops.dropItemPackIndex, drops.rectTransform);
+ NotifyItemDrop(drops);
action?.Invoke();
}
@@ -140,7 +140,7 @@
//鎺夎惤閫氱煡
- public void NotifyItemDrop(List<int> indexs, RectTransform rect)
+ public void NotifyItemDrop(BattleDrops drops)//(List<int> indexs, RectTransform rect)
{
// 鐣岄潰涓嶆樉绀哄垯绔嬪嵆澶勭悊
// if (!UIManager.Instance.IsOpened<HomeWin>())
@@ -154,7 +154,7 @@
// {
// OnItemDropEvent?.Invoke(indexs, rect);
// }
- OnItemDropEvent?.Invoke(indexs, rect);
+ OnItemDropEvent?.Invoke(drops);
}
public void CalcFloorEquip(int itemIndex)
diff --git a/Main/System/Equip/ItemsOnFloor.cs b/Main/System/Equip/ItemsOnFloor.cs
index 2cafd37..038d2d8 100644
--- a/Main/System/Equip/ItemsOnFloor.cs
+++ b/Main/System/Equip/ItemsOnFloor.cs
@@ -12,7 +12,7 @@
[SerializeField] FloorItemCell floorItemCell; //闈炶澶囨樉绀虹粍浠�
[SerializeField] MoneyMoveByPath moneyMoveByPathCell; //鎺夎惤鐗╅噾閽�
[SerializeField] RectTransform defaultDropRect; //榛樿鎺夎惤浣嶇疆
-
+ [SerializeField] Text[] expTexts;
FloorItemCell[] floorItemCells = new FloorItemCell[20]; //鍖呭惈闈炶澶囩殑鎴樺埄鍝佹帀钀�
MoneyMoveByPath[] moneyMoveByPathArr = new MoneyMoveByPath[20]; //鎺夎惤璐у竵锛岄噾閽憋紝缁忛獙绛�
@@ -48,6 +48,10 @@
Display(true, EquipModel.Instance.lastDropIndexs);
EquipModel.Instance.OnItemDropEvent += NotifyPlayItemDrop;
PackManager.Instance.DeleteItemEvent += DeleteDropItem;
+ for (int i = 0; i < expTexts.Length; i++)
+ {
+ expTexts[i].text = "";
+ }
}
@@ -59,11 +63,33 @@
}
- void NotifyPlayItemDrop(List<int> itemIndexs, RectTransform rect)
+ void NotifyPlayItemDrop(BattleDrops drops)
{
- Display(true, itemIndexs, rect);
+ if (drops.dropItemPackIndex.Count > 0)
+ {
+ Display(true, drops.dropItemPackIndex, drops.rectTransform);
+ }
+ DisplayExp(drops);
}
+ int expIndex = 0;
+ void DisplayExp(BattleDrops drops)
+ {
+ // startPos = new Vector2(transform.localPosition.x + UnityEngine.Random.Range(-30, 30), transform.localPosition.y + UnityEngine.Random.Range(50, 100));
+
+ if (drops.expDrops.Count > 0)
+ {
+ var nowIndex = expIndex;
+ expTexts[nowIndex].text = "E+" + (drops.expDrops[0].Exp + drops.expDrops[0].ExpPoint * Constants.ExpPointValue);
+ expTexts[nowIndex].transform.position = drops.rectTransform.position;
+ expTexts[nowIndex].transform.DOLocalMove(expTexts[nowIndex].transform.localPosition + new Vector3(0, 20, 0), 1f).SetEase(Ease.InOutSine).onComplete = () =>
+ {
+ expTexts[nowIndex].text = "";
+ };
+
+ expIndex = (expIndex + 1) % 6;
+ }
+ }
void DeleteDropItem(PackType packType, string guid, int itemID, int index, int clearType)
{
--
Gitblit v1.8.0