30 lines
817 B
C#
30 lines
817 B
C#
using System.Collections.Generic;
|
|
using KitsuneCafe.UI;
|
|
using UnityEngine;
|
|
using UnityEngine.UIElements;
|
|
|
|
public class MainUIController : MonoBehaviour
|
|
{
|
|
public UIDocument uiDocument;
|
|
|
|
void OnEnable()
|
|
{
|
|
var rootVisualElement = uiDocument.rootVisualElement;
|
|
|
|
// Find the RecycleView in your UXML.
|
|
var recycleView = rootVisualElement.Q<RecycleView>("recycle-view");
|
|
|
|
// Create some dummy data.
|
|
var profiles = new List<UserProfile>();
|
|
for (int i = 0; i < 1000; i++)
|
|
{
|
|
profiles.Add(new UserProfile($"User {i}", $"Status: {Random.Range(0, 100)}", Random.ColorHSV()));
|
|
}
|
|
|
|
// Create our data source with the dummy data.
|
|
var dataSource = new UserProfileDataSource(profiles);
|
|
|
|
// Assign the data source to the RecycleView.
|
|
recycleView.DataSource = dataSource;
|
|
}
|
|
}
|