using System.Collections; using System.Collections.Generic; using UnityEngine; using TMPro; using Unity.VisualScripting; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; public class KuangChangPop : MonoBehaviour { queryMiningContractList101 queryMiningContractList = new queryMiningContractList101();//10.110.1,查询可购买的挖矿合约 MiningContractList miningContractList = new MiningContractList(); [Header("合约父节点")] public GameObject ItemParent; [Header("合约预制体")] public GameObject kuanghcangItem; // Start is called before the first frame update async void Start() { //查询可购买的挖矿合约 miningContractList = await queryMiningContractList.QueryMiningContract(); Debug.Log(miningContractList.data.Count); for (int i = miningContractList.data.Count -1; i >= 0; i--) { var miningContract = miningContractList.data[i]; GameObject item = Instantiate(kuanghcangItem); item.transform.parent = ItemParent.transform; NewkuangchangItem newiItem = item.GetComponent(); newiItem.count.text = miningContract.voluteCoinBuy.ToString();//显示每一个合约的购买所需赋值 newiItem.miningContract = miningContractList.data[i];//给每一个合约赋值 } } }