void InitStoreItem(StoreInfo info, C2G.StoreLimitInfoGetAck ack) { m_BottomToggle.value = true; Array.ForEach(m_Grid.GetComponentsInChildren(typeof(StoreItem), true), i => DestroyImmediate(i.gameObject)); for (int i = 0; i < info.m_GoodsItem.Count; ++i) { StoreItem item = NGUITools.AddChild(m_Grid.gameObject, StoreItemPrefab).GetComponent <StoreItem>(); pd_StoreLimitInfo limit_info = null; if (ack.infos != null) { limit_info = ack.infos.Find(e => e.item_id == info.m_GoodsItem[i].ID); } item.Init(info.m_GoodsItem[i], limit_info); } m_Grid.Reposition(); UIScrollView scroll = m_Grid.GetComponentInParent <UIScrollView>(); if (scroll != null) { scroll.ResetPosition(); } UpdateBottomDesc(); }
void OnStoreLimitInfoGet(C2G.StoreLimitInfoGet packet, C2G.StoreLimitInfoGetAck ack) { InitStoreItem(CurrentStoreInfo, ack); }