使用Json读取数据,写入带UI,并且还有分页-创新互联
public int index = 0;
public int pangeCount = 15;
public int totalindex;
public int yuCount;
public List>datalist = new List
>();
private GameObject prefabs;
private GameObject parent;
public InputField inputField;
// Start is called before the first frame update
void Start()
{
totalindex = tempcode.data.Count / pangeCount;
yuCount = tempcode.data.Count % pangeCount;
if (yuCount< 15)
{
for (int i = 0; i< tempcode.data.Count-yuCount; i+=pangeCount)
{
List< CaiJueGongchengUIDtata >singlePange = new List();
for (int j = 0; j< pangeCount; j++)
{
singlePange.Add(tempcode.data[i]);
}
datalist.Add(singlePange);
}
}
else
{
List();
for (int j = 0; j< yuCount; j++)
{
singlePange.Add(tempcode.data[i]);
}
datalist.Add(singlePange);
}
}
public void OnNextClick()
{
if(index>totalindex)
{
index = totalindex;
}
index += 1;
UpdateUI(index);
}
public void OnUpOnvlick()
{
if (index == 1)
{
return;
}
index += 1;
UpdateUI(index);
}
private void UpdateUI(int index)
{
for (int i = 0; i< datalist[index].Count; i++)
{
GameObject go = Instantiate(prefabs, parent.transform);
}
}
你是否还在寻找稳定的海外服务器提供商?创新互联www.cdcxhl.cn海外机房具备T级流量清洗系统配攻击溯源,准确流量调度确保服务器高可用性,企业级服务器适合批量采购,新人活动首月15元起,快前往官网查看详情吧
网页题目:使用Json读取数据,写入带UI,并且还有分页-创新互联
网站路径:http://scjbc.cn/article/shgdj.html