hch
1 天以前 89fa96e505af9fe7baf676591222bfdb23b48262
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System.Collections.Generic;
using UnityEngine;
 
public class PhantasmPavilionChatBoxCell : MonoBehaviour
{
    readonly PhantasmPavilionType type = PhantasmPavilionType.ChatBox;
    [SerializeField] List<PhantasmPavilionChatBoxItem> items = new List<PhantasmPavilionChatBoxItem>();
    PhantasmPavilionManager manager { get { return PhantasmPavilionManager.Instance; } }
    public void Display(int rowIndex)
    {
 
        List<int> showItemList = manager.ShowItemList(type);
        if (showItemList.IsNullOrEmpty() || !manager.TryGetRowCountMax(type, out int rowCountMax))
            return;
        for (int i = 0; i < items.Count; i++)
        {
            int index = rowIndex * rowCountMax + i;
            if (!showItemList.IsNullOrEmpty())
            {
                if (index < showItemList.Count)
                {
                    items[i].SetActive(true);
                    items[i].Display(showItemList[index]);
                }
                else
                {
                    items[i].SetActive(false);
                }
            }
        }
    }
 
}