void InitFirstPageData() { SelectedItemID = 0; EmailList.Sort((x, y) => { return(x.byState - y.byState); }); if (ItemList != null && ItemList.Count > 0) { view.Init(gameObject); int count = PageSize; if (EmailList.Count < PageSize) { count = EmailList.Count; } for (int i = 0; i < PageSize; i++) { ItemList [i].OnLoseFocus(); if (i < count) { ItemList [i].gameObject.SetActive(true); ItemList [i].InitItemData(EmailList [i]); } else { ItemList [i].gameObject.SetActive(false); } } UpdateListView(); } ItemTable.Reposition(); }
public void InitItemGrid() { m_scrollView = grid.transform.GetComponent <LoopScrollView>(); m_scrollView.Init(true); int count = 0; string[] tempItems = null; //if (itemList.TryGetValue(currLayer, out tempItems)) //{ // count = tempItems.Length; //} if (itemList.TryGetValue(maxTowerLevel, out tempItems)) { count = tempItems.Length; } m_scrollView.UpdateListItem(count); m_scrollView.SetDelegate(UpdateItemInfo, null); //yield return new WaitForSeconds(1.0f); for (int i = 0; i < grid.transform.childCount; i++) { UpdateItemInfo(grid.transform.GetChild(i).gameObject); } }
void Start() { m_HorLoopScrollView.ScrollEnd += OnHorLoopScrollViewEnd; m_VerLoopScrollView.ScrollEnd += OnVerLoopScrollViewEnd; m_HorLoopScrollView.Init(0); m_VerLoopScrollView.Init(1); }
/// <summary> /// 初始化 /// </summary> protected virtual void Awake() { PanelOriginalPos = ScrollView.transform.localPosition; ScrollView.Init(CheckUpdateGrid); bool isVertical = ScrollView.movement == UIScrollView.Movement.Vertical; ItemLength = isVertical ? (int)Grid.cellHeight : (int)Grid.cellWidth; VisibleCount = isVertical ? Mathf.CeilToInt(ScrollViewPanel.height / ItemLength) : Mathf.CeilToInt(ScrollViewPanel.width / ItemLength); // 頭尾各多一個 InstantiateItems(VisibleCount + 2, Grid.transform, isVertical); }
static int Init(IntPtr L) { try { ToLua.CheckArgsCount(L, 3); LoopScrollView obj = (LoopScrollView)ToLua.CheckObject <LoopScrollView>(L, 1); LoopItemData[] arg0 = ToLua.CheckObjectArray <LoopItemData>(L, 2); LoopScrollView.DelegateHandler arg1 = (LoopScrollView.DelegateHandler)ToLua.CheckDelegate <LoopScrollView.DelegateHandler>(L, 3); obj.Init(arg0, arg1); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
/// <summary> /// 初始化列表,显示拍卖信息 /// </summary> /// <param name="tempTable"></param> public void ShowAuctionItems(yuan.YuanMemoryDB.YuanTable tempTable) { EnableGrid(true); m_scrollView = itemGrid.transform.GetComponent <LoopScrollView>(); m_scrollView.Init(true); m_scrollView.UpdateListItem(tempTable.Rows.Count); m_scrollView.SetDelegate(UpdateItemInfo, ItemOnClick); aucTable = tempTable; for (int i = 0; i < itemGrid.transform.childCount; i++) { if (tempTable.Rows.Count != 0 && i <= tempTable.Rows.Count) { UpdateItemInfo(itemGrid.transform.GetChild(i).gameObject); } } }