コード例 #1
0
    private LoopListViewItem2 OnGetItem1(LoopListView2 loopList, int index)
    {
        if (index < 0 || index >= dataNum)
        {
            return(null);
        }

        var data = new Item1Data()
        {
            HeadColor = Mathf.CorrelatedColorTemperatureToRGB(40000 * index / 20f),
            Desc      = $"#R这是第{index}个Item的描述,表情啊#{index},哈哈哈哈哈#{index}#{index}#{index}#{index}"
        };

        var item = loopList.NewListViewItem("Item1");

        if (!item.IsInitHandlerCalled)
        {
            var script = item.GetComponent <Item1Script>();
            item.UserObjectData = script;
            script.Init();
        }

        var item1Script = (Item1Script)item.UserObjectData;

        item1Script.SetData(data);
        return(item);
    }
コード例 #2
0
 public void SetData(Item1Data data)
 {
     Head.color = data.HeadColor;
     Desc.text  = data.Desc;
 }