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); + } + } }