using System; using System.Collections.Generic; using Kasizuki; using UnityEngine; using UnityEngine.Events; public class ListViewerWindow : NGUIWindow { public uGUIListViewer viewer { get { return this.m_ListViewer; } } public void Show(List dataList, Action itemSetUp) where ItemType : Component { this.m_ListViewer.Show(dataList.Count, delegate(int index, ItemType item) { DataType arg = dataList[index]; itemSetUp(index, arg, item); }); this.Reposition(); if (this.OnShow != null) { this.OnShow.Invoke(); } } public void Reposition() { UIGrid uigrid = this.m_UIGrid; if (uigrid == null) { uigrid = this.m_ListViewer.parentItemArea.GetComponent(); } if (uigrid) { uigrid.Reposition(); } UIScrollView uiscrollView = this.m_UIScrollView; if (uiscrollView == null) { uiscrollView = this.m_ListViewer.parentItemArea.GetComponentInParent(); } if (uiscrollView) { uiscrollView.ResetPosition(); } } [SerializeField] private uGUIListViewer m_ListViewer; [SerializeField] private UIGrid m_UIGrid; [SerializeField] private UIScrollView m_UIScrollView; public UnityEvent OnShow; }