using System; using System.Collections.Generic; using Cute; using UnityEngine; public class ConventionListUI : UIBase { private const int SCROLL_CONVENTION_COUNT = 3; [SerializeField] private ConventionListPlate _conventionItemOriginal; [SerializeField] private UIScrollView _scrollView; [SerializeField] private UIGrid _grid; [SerializeField] private GameObject _conventionListPlateRoot; [SerializeField] private GameObject _backGround; [SerializeField] private GameObject _layout1; [SerializeField] private GameObject[] _layout2; [SerializeField] private GameObject _scrollBar; private List _plateList = new List(); public Action OnSelect { get; set; } private void Awake() { _conventionItemOriginal.gameObject.SetActive(value: false); } public void Show(ConventionList conventionList) { List list = conventionList.List; int num = 0; foreach (ConventionInfo item in list) { GameObject parent = _conventionListPlateRoot; switch (list.Count) { case 1: parent = _layout1; break; case 2: parent = _layout2[num]; break; } num++; GameObject obj = NGUITools.AddChild(parent, _conventionItemOriginal.gameObject); obj.SetActive(value: true); ConventionListPlate component = obj.GetComponent(); component.Initialize(item); component.OnSelect = OnSelectConvention; _plateList.Add(component); } _backGround.SetActive(list.Count > 3); _grid.Reposition(); _scrollView.ResetPosition(); } private void OnSelectConvention(ConventionInfo convention) { OnSelect.Call(convention); foreach (ConventionListPlate plate in _plateList) { plate.FadeOutHide(); } } public void Hide() { _backGround.SetActive(value: false); _scrollBar.SetActive(value: false); } }