private void OnGridUpdate(UIGridBase gridBase, int index) { if (gridBase is UITabGrid) { UITabGrid tGrid = gridBase as UITabGrid; Category c = null; if (category.TryGetCategory(selectfTabID, out c)) { Category s = c.ChildCategoryData[index]; tGrid.SetGridData(s.Id); tGrid.SetName(s.Name, 3); tGrid.SetHightLight(s.Id == selectsTabID); } } else if (gridBase is UIExchangeGrid) { UIExchangeGrid eGrid = gridBase as UIExchangeGrid; Category f = null; Category s = null; if (category.TryGetCategory(selectfTabID, out f) && f.TryGetCategory(selectsTabID, out s)) { eGrid.SetGridData(s.Datas[index]); eGrid.SetHightLight(s.Datas[index] == selectExchangeId); } } }
/// <summary> /// 设置选中兑换物品ID /// </summary> /// <param name="selectID"></param> /// <param name="force"></param> /// <param name="focus"></param> private void SetSelectId(uint selectID, bool force = false, bool focus = false, bool needResetChooseNum = false) { if (selectExchangeId == selectID && !force) { return; } Category f = null; Category s = null; if (category.TryGetCategory(selectfTabID, out f) && f.TryGetCategory(selectsTabID, out s)) { if (s.Datas.Contains(selectID)) { UIExchangeGrid grid = null; int index = s.Datas.IndexOf(selectExchangeId); grid = m_ctor_ExchangeScrollView.GetGrid <UIExchangeGrid>(index); if (null != grid) { grid.SetHightLight(false); } index = s.Datas.IndexOf(selectID); grid = m_ctor_ExchangeScrollView.GetGrid <UIExchangeGrid>(index); if (null != grid) { grid.SetHightLight(true); } selectExchangeId = selectID; if (needResetChooseNum) { exchangeNum = 1; } if (focus) { m_ctor_ExchangeScrollView.FocusGrid(index); } UpdateSelectIdExchangeInfo(); } } }