using System.Collections.Generic; using UnityEngine; public class PhantasmPavilionChatBoxCell : MonoBehaviour { readonly PhantasmPavilionType type = PhantasmPavilionType.ChatBox; [SerializeField] List items = new List(); PhantasmPavilionManager manager { get { return PhantasmPavilionManager.Instance; } } public void Display(int rowIndex) { List 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); } } } } }