using CodeStage.AntiCheat.ObscuredTypes; using PlayFab.ClientModels; using System.Collections.Generic; using UnityEngine; public class ScrollViewMgr : BackKeyAdd { public UIScrollView m_scrollview; public UIGrid m_grid; public UITable m_table; public GameObject go_card; protected List list_CardBase = new List(); bool m_Repos = true; protected void Reset_Grid() { if (m_grid) m_grid.repositionNow = true; else if (m_table) m_table.repositionNow = true; } protected void Reset_Pos(bool _forcerepos = false) { if (m_Repos || _forcerepos) { m_Repos = false; Reset_Grid(); if (m_scrollview != null) m_scrollview.ResetPosition(); } } public List Get_Cards() { return list_CardBase; } protected void CardBase_AllOff() { for (int i = 0; i < list_CardBase.Count; i++) list_CardBase[i].gameObject.SetActive(false); } CardBase MakeCard(int i) { CardBase temp; if (list_CardBase.Count > i) temp = list_CardBase[i]; else { temp = DSUtil.Get_Clone(go_card, m_grid ? m_grid.transform : m_table.transform); list_CardBase.Add(temp); } return temp; } protected virtual void Set_ScrollView(List _lst, bool _forcerepos = false) { CardBase_AllOff(); for (int i = 0; i < _lst.Count; i++) MakeCard(i).Set(_lst[i]); Reset_Pos(_forcerepos); } protected virtual void Set_ScrollView(List _lst, int _id, bool _forcerepos = false) { CardBase_AllOff(); for (int i = 0; i < _lst.Count; i++) MakeCard(i).Set(_lst[i], _id); Reset_Pos(_forcerepos); } protected virtual void Set_ScrollView_NotSet(int _makecount, bool _forcerepos = false) { CardBase_AllOff(); for (int i = 0; i < _makecount; i++) { if (list_CardBase.Count > i) { } else list_CardBase.Add(DSUtil.Get_Clone(go_card, m_grid.transform)); } Reset_Pos(); } }