123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- 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<DataType, ItemType>(List<DataType> dataList, Action<int, DataType, ItemType> itemSetUp) where ItemType : Component
- {
- this.m_ListViewer.Show<ItemType>(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<UIGrid>();
- }
- if (uigrid)
- {
- uigrid.Reposition();
- }
- UIScrollView uiscrollView = this.m_UIScrollView;
- if (uiscrollView == null)
- {
- uiscrollView = this.m_ListViewer.parentItemArea.GetComponentInParent<UIScrollView>();
- }
- if (uiscrollView)
- {
- uiscrollView.ResetPosition();
- }
- }
- [SerializeField]
- private uGUIListViewer m_ListViewer;
- [SerializeField]
- private UIGrid m_UIGrid;
- [SerializeField]
- private UIScrollView m_UIScrollView;
- public UnityEvent OnShow;
- }
|