_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/Address/AddressPanel.cs
2024-11-27 19:02:29 +08:00

35 lines
895 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AddressPanel : MonoBehaviour
{
public GameObject addressPrefab;
public Transform trans;
void Start()
{
getData();
}
public async void getData()
{
AdressResponse adressResponse = new AdressResponse();
AdressList83 adressList83 = new AdressList83();
adressResponse = await adressList83.AdressList();
int length = adressResponse.data.Count;
for(int i = 0; i < length; i++)
{
//Debug.Log(i);
GameObject addres = GameObject.Instantiate(addressPrefab,trans);
addres.name = "address_" + i;
addressItem item = addres.GetComponent<addressItem>();
Address address = adressResponse.data[i];
item.SetInfo(address);
}
}
}