35 lines
697 B
C#
35 lines
697 B
C#
|
|
using System.Collections;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using AlicizaX.UI;
|
||
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
public class TestData : ISimpleViewData
|
||
|
|
{
|
||
|
|
public string Name;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
public class TestRecyclerView : MonoBehaviour
|
||
|
|
{
|
||
|
|
public RecyclerView itemListView;
|
||
|
|
public UGList<TestData> list;
|
||
|
|
|
||
|
|
void Start()
|
||
|
|
{
|
||
|
|
list = UGListCreateHelper.Create<TestData>(itemListView, (data) => { Debug.Log(data.Name); });
|
||
|
|
|
||
|
|
List<TestData> datas = new();
|
||
|
|
for (int i = 0; i < 150; i++)
|
||
|
|
{
|
||
|
|
datas.Add(new TestData { Name = $"Item {i}" });
|
||
|
|
}
|
||
|
|
|
||
|
|
list.Data = datas;
|
||
|
|
}
|
||
|
|
|
||
|
|
private void OnBtnItemClick(TestData obj)
|
||
|
|
{
|
||
|
|
Debug.Log(obj.Name);
|
||
|
|
}
|
||
|
|
}
|