From 8575e51128afcd4c195e0f6a9764a147dd6fc9bb Mon Sep 17 00:00:00 2001 From: liuliang <597380732@qq.com> Date: Sun, 29 Dec 2024 11:52:15 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E5=85=85=E6=95=B0=E6=8D=AE=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E7=9A=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../script/scene_Main/ui/FirstChargePanel.cs | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/meng_yao/Assets/script/scene_Main/ui/FirstChargePanel.cs b/meng_yao/Assets/script/scene_Main/ui/FirstChargePanel.cs index c4e59348..e6127792 100644 --- a/meng_yao/Assets/script/scene_Main/ui/FirstChargePanel.cs +++ b/meng_yao/Assets/script/scene_Main/ui/FirstChargePanel.cs @@ -9,20 +9,17 @@ public class FirstChargePanel : MonoBehaviour public GameObject firstitempr; public Transform Connact; - private void OnEnable() - { - Init(); - } - - async void Init() + List objlist = new List(); + private async void OnEnable() { productListResponse productListResponse = await Scene_main_jiekou.instance.ProductLists(); for (int i = 0; i < productListResponse.Data.Count; i++) { - GameObject obj = Instantiate(firstitempr,Connact); + GameObject obj = Instantiate(firstitempr, Connact); + objlist.Add(obj); obj.GetComponent().PackagesName.text = productListResponse.Data[i].Name; obj.GetComponent().Number.text = productListResponse.Data[i].Amount.ToString(); - obj.GetComponent().price.text = "¥"+productListResponse.Data[i].Price.ToString(); + obj.GetComponent().price.text = "¥" + productListResponse.Data[i].Price.ToString(); obj.GetComponent().id = productListResponse.Data[i].Id; obj.GetComponent().chargePanel = this; if (productListResponse.Data[i].first_status == 1) @@ -30,6 +27,25 @@ public class FirstChargePanel : MonoBehaviour obj.GetComponent().doubleLogo.gameObject.SetActive(true); } } + + } + + async void Init()//更新首充界面数据 + { + productListResponse productListResponse = await Scene_main_jiekou.instance.ProductLists(); + for (int i = 0; i < objlist.Count; i++) + { + + objlist[i].GetComponent().PackagesName.text = productListResponse.Data[i].Name; + objlist[i].GetComponent().Number.text = productListResponse.Data[i].Amount.ToString(); + objlist[i].GetComponent().price.text = "¥" + productListResponse.Data[i].Price.ToString(); + objlist[i].GetComponent().id = productListResponse.Data[i].Id; + objlist[i].GetComponent().chargePanel = this; + if (productListResponse.Data[i].first_status == 1) + { + objlist[i].GetComponent().doubleLogo.gameObject.SetActive(true); + } + } }