From df03c997716c6f5fbd4b87c01caef1d2e75165fc Mon Sep 17 00:00:00 2001 From: hch <305670599@qq.com> Date: 星期一, 29 九月 2025 18:50:56 +0800 Subject: [PATCH] 0312 武将培养界面升级属性飘字改用池子管理 --- Main/System/HeroUI/HeroTrainAddAttrCell.cs | 30 +++++++++++++++ Main/System/HeroUI/HeroTrainAddAttrCell.cs.meta | 11 +++++ Main/System/HeroUI/HeroTrainWin.cs | 40 +++++++++++++++----- 3 files changed, 71 insertions(+), 10 deletions(-) diff --git a/Main/System/HeroUI/HeroTrainAddAttrCell.cs b/Main/System/HeroUI/HeroTrainAddAttrCell.cs new file mode 100644 index 0000000..142df5f --- /dev/null +++ b/Main/System/HeroUI/HeroTrainAddAttrCell.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using UnityEngine.UI; + + +/// <summary> +/// 姝﹀皢鍩瑰吇椋樺瓧澶勭悊 +/// </summary> +public class HeroTrainAddAttrCell : MonoBehaviour +{ + [SerializeField] Text[] addPerText; //澧炲姞鐧惧垎姣旓紙椋樺姩锛� 鍔犲叆姹� + [SerializeField] PositionTween addPerObject; + + + public void Display(int value, Action func) + { + addPerObject.SetActive(true); + for (int i = 0; i < addPerText.Length; i++) + { + addPerText[i].text = "+" + PlayerPropertyConfig.GetValueDescription(PlayerPropertyConfig.basePerAttrs[i], value); + } + addPerObject.Play(() => + { + func?.Invoke(); + }); + } + +} \ No newline at end of file diff --git a/Main/System/HeroUI/HeroTrainAddAttrCell.cs.meta b/Main/System/HeroUI/HeroTrainAddAttrCell.cs.meta new file mode 100644 index 0000000..98d3b2a --- /dev/null +++ b/Main/System/HeroUI/HeroTrainAddAttrCell.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ebf03799112fc5244ad17cb46d2e32f8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Main/System/HeroUI/HeroTrainWin.cs b/Main/System/HeroUI/HeroTrainWin.cs index 6a9dcb3..103d004 100644 --- a/Main/System/HeroUI/HeroTrainWin.cs +++ b/Main/System/HeroUI/HeroTrainWin.cs @@ -54,8 +54,8 @@ [SerializeField] Text[] inheritAttrText; //姝﹀皢浼氱户鎵跨殑灞炴�� [SerializeField] RichText heroAddPerText; //涓诲叕锛堜笂闃碉級鍔犳垚鎻忚堪 [SerializeField] Text[] heroAddAttrPerText; //涓诲叕锛堜笂闃碉級鍔犳垚 - [SerializeField] Text[] addPerText; //澧炲姞鐧惧垎姣旓紙椋樺姩锛� - [SerializeField] PositionTween addPerObject; + [SerializeField] Transform addPerParent; + [SerializeField] HeroTrainAddAttrCell addPerObject; [SerializeField] Image lvupMoneyIcon; [SerializeField] Text lvupMoneyText; [SerializeField] Text lvupBtnText; @@ -92,6 +92,9 @@ [SerializeField] Image redpointAwake; [SerializeField] Image redpointGift; [SerializeField] Image redpointLVUP; + + + Queue<HeroTrainAddAttrCell> lvupAttrQueue = new Queue<HeroTrainAddAttrCell>(); string guid; HeroInfo hero; @@ -457,15 +460,14 @@ GameNetSystem.Instance.SendInfo(pack); //棰勬樉绀� lvupEffect.Play(); - addPerObject.SetActive(true); - for (int i = 0; i < addPerText.Length; i++) - { - addPerText[i].text = "+" + PlayerPropertyConfig.GetValueDescription(PlayerPropertyConfig.basePerAttrs[i], hero.qualityConfig.LVAddPer); - } - addPerObject.Play(() => - { - addPerObject.SetActive(false); + var cell = RequestCell(); + cell.transform.localPosition = new Vector3(0, 0, 0); + cell.Display(hero.qualityConfig.LVAddPer, ()=> + { + cell.SetActive(false); + ReturnCell(cell); }); + HeroUIManager.Instance.lastFightPower = new KeyValuePair<string, long>(hero.itemHero.guid, hero.CalculatePower(false)); } @@ -473,6 +475,24 @@ } + + HeroTrainAddAttrCell RequestCell() + { + + if (lvupAttrQueue.Count == 0) + { + return Instantiate(addPerObject, addPerParent); + } + return lvupAttrQueue.Dequeue(); + } + + + void ReturnCell(HeroTrainAddAttrCell cell) + { + lvupAttrQueue.Enqueue(cell); + } + + void RefreshAllPotential() { if (!HeroBreakConfig.configDics.ContainsKey(hero.heroId)) -- Gitblit v1.8.0