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); } } }
void OnUpdataGridData(UIGridBase grid, int index) { if (grid is UIDeliverGrid) { UIDeliverGrid tab = grid as UIDeliverGrid; if (index < m_lstTransfers.Count) { tab.SetGridData(index); tab.SetData(m_lstTransfers[index]); } } if (grid is UITabGrid) { UITabGrid tab = grid as UITabGrid; if (index < m_lst_TabType.Count) { tab.SetGridData(index); if (m_dic_TabName.ContainsKey(m_lst_TabType[index])) { tab.SetName(m_dic_TabName[m_lst_TabType[index]]); } tab.SetHightLight(index == activedIndex); } } }
void OnTreasureBossGridUpdate(UIGridBase grid, int index) { if (grid is UITreasureBossGrid) { if (m_lst_TreasureDatas != null) { if (index < m_lst_TreasureDatas.Count) { uint id = m_lst_TreasureDatas[index]; if (id != 0) { UITreasureBossGrid listGrid = grid as UITreasureBossGrid; listGrid.SetGridData(id); listGrid.SetHightLight(false); if (index == 0) { SelectBossGrid(listGrid); } } } } } if (grid is UITabGrid) { UITabGrid g = grid as UITabGrid; int tabID = index + 1; if (tabDic.ContainsKey((uint)tabID)) { g.SetName(tabDic[(uint)tabID]); g.TabID = tabID; } } }
private void InitEquipPosWidgets() { if (null == m_dic_EquipPartDic) { m_dic_EquipPartDic = new Dictionary <EquipPartMode, UITabGrid>(); } m_dic_EquipPartDic.Clear(); StructEquipPartInlayData(); //生成装备部位 if (null != m_ctor_InlayScrollView && null != m_trans_UIEquipPosStatusGrid) { m_ctor_InlayScrollView.RefreshCheck(); m_ctor_InlayScrollView.Initialize <UIEquipPosStatusGrid>(m_trans_UIEquipPosStatusGrid.gameObject , OnUpdateInlayGrid, OnInlayGridUIEventDlg); } //列表 if (null == m_dic_EquipPartDic) { m_dic_EquipPartDic = new Dictionary <EquipPartMode, UITabGrid>(); } m_dic_EquipPartDic.Clear(); if (null == m_trans_PartTab) { Engine.Utility.Log.Error("ForgingPanel->InitForgingWidgets failed Transform ListTab null"); } else { UITabGrid tabGrid = null; Transform ts = null; for (EquipPartMode i = EquipPartMode.AttackPart; i < EquipPartMode.Max; i++) { ts = m_trans_PartTab.Find(i.ToString() + "Tab"); if (null == ts) { continue; } tabGrid = ts.GetComponent <UITabGrid>(); if (null == tabGrid) { tabGrid = ts.gameObject.AddComponent <UITabGrid>(); } tabGrid.SetGridData(i); tabGrid.RegisterUIEventDelegate(OnUIEventCallback); tabGrid.SetName(GetEquipPartModeName(i)); tabGrid.SetHightLight(false); m_dic_EquipPartDic.Add(i, tabGrid); } } RefreshAllTab(); }
/// <summary> /// 商城格子数据刷新 /// </summary> /// <param name="grid"></param> /// <param name="index"></param> private void OnUpdateMallGridData(UIGridBase grid, int index) { if (grid is UITabGrid) { if (index > DailyTabValues.Count) { Engine.Utility.Log.Error("DailyPanel OnUpdateMallGridData faield,mallTabDic data errir"); return; } UITabGrid tabGrid = grid as UITabGrid; tabGrid.SetName(DailyTabValues[index]); tabGrid.SetHightLight(activeTabId == index ? true : false); tabGrid.SetGridData(index); } else if (grid is UIDailyGrid) { DailyDataBase data = dailyDataList[index]; if (DataManager.Manager <DailyManager>().ActiveDic.ContainsKey(data.id)) { LivenessData list = DataManager.Manager <DailyManager>().ActiveDic[data.id]; if (data != null && list != null) { UIDailyGrid dailyGrid = grid as UIDailyGrid; dailyGrid.SetDailyData(data, list); dailyGrid.SetSelect(index == m_lstDailyID.IndexOf(selectDailyId)); dailyGrid.onClickDailyGrid = onClickDailyGrid; } } } else if (grid is UIDailyCalendarGrid) { UIDailyCalendarGrid data = grid as UIDailyCalendarGrid; if (data != null) { data.SetGridData(dailyIDs[index]); data.SetBg(todayIsMatch); } } else if (grid is UIDailyRewardGrid) { UIDailyRewardGrid data = grid as UIDailyRewardGrid; if (data != null) { if (index < m_lstRewardID.Count) { data.SetGridData(m_lstRewardID[index]); } } } }
/// <summary> /// 单元格刷新委托 /// </summary> /// <param name="gridBase"></param> /// <param name="index"></param> private void OnUIGridUpdate(UIGridBase grid, int index) { if (grid is UITabGrid) { UITabGrid tab = grid as UITabGrid; tab.SetGridData((ConsignmentItemMode)(index + 1)); tab.SetName(tabNames[index]); if (previous == null && index == 0) { tab.SetHightLight(true); previous = tab; } } }
/// <summary> /// 商城格子数据刷新 /// </summary> /// <param name="grid"></param> /// <param name="index"></param> private void OnUpdateMallGridData(UIGridBase grid, int index) { if (grid is UIMallGrid) { if (index >= m_lst_mallDatas.Count) { Engine.Utility.Log.Error("MallPanel OnUpdateMallGridData faield,m_lst_mallDatas data errir"); return; } UIMallGrid mallGrid = grid as UIMallGrid; MallDefine.MallLocalData data = DataManager.Manager <MallManager>().GetMallLocalDataByMallItemId(m_lst_mallDatas[index]); if (null == data) { Engine.Utility.Log.Error("MallPanel OnUpdateMallGridData faield,mall data errir index:{0}", index); return; } mallGrid.SetGridData(data.MallId); bool select = (data.MallId == selectMallItemId) ? true : false; mallGrid.SetHightLight(select); } else if (grid is UITabGrid) { if (index > m_lst_mallTabDatas.Count) { Engine.Utility.Log.Error("MallPanel OnUpdateMallGridData faield,m_lst_mallTabDatas data errir"); return; } int tabKey = m_lst_mallTabDatas[index]; int startDepth = 2 + m_lst_mallTabDatas.Count * 2 - index * 2; UITabGrid tabGrid = grid as UITabGrid; tabGrid.SetName(DataManager.Manager <MallManager>().GetMallTagName((int)activeStore, tabKey)); tabGrid.SetHightLight(activeTabId == tabKey ? true : false); tabGrid.SetGridData(tabKey); tabGrid.SetDepth(startDepth); } else if (grid is UIToggleGrid) { UIToggleGrid tog = grid as UIToggleGrid; uint shopID = DataManager.Manager <Mall_NpcShopManager>().GetNpcShopKey(index); string shopName = DataManager.Manager <Mall_NpcShopManager>().GetNpcShopName(index); tog.SetName(shopName); tog.SetHightLight((uint)activeStore == shopID?true:false); tog.SetGridTab((int)shopID); } }
/// <summary> /// 非自动添加的页签初始化 /// </summary> /// <param name="tabTrans">页签的Transform</param> /// <param name="nTabType">页签的类型</param> /// <param name="nindex">页签索引</param> public void InitTabGrids(Transform tabTrans, int nTabType, int nindex, string strName = "") { Dictionary <int, UITabGrid> dicTabs = null; if (!dicUITabGrid.TryGetValue(nTabType, out dicTabs)) { dicTabs = new Dictionary <int, UITabGrid>(6); dicUITabGrid.Add(nTabType, dicTabs); } UITabGrid tab = tabTrans.GetComponent <UITabGrid>(); if (tab == null) { tab = tabTrans.gameObject.AddComponent <UITabGrid>(); } if (tab != null) { tab.TabID = nindex; tab.TabType = nTabType; dicTabs[tab.TabID] = tab; if (!string.IsNullOrEmpty(strName)) { tab.SetName(strName); } tab.SetHightLight(false); tab.RegisterUIEventDelegate((eventType, data, param) => { switch (eventType) { case UIEventType.Click: if (data is UITabGrid) { UITabGrid tabGRid = data as UITabGrid; UIPanelBase panelbase = this as UIPanelBase; UIFrameManager.Instance.OnCilckTogglePanel(ref panelbase, tabGRid.TabType, tabGRid.TabID); } break; default: break; } }); } }
void OnHuntingGridUpdate(UIGridBase grid, int index) { if (grid is UIHuntingListGrid) { HuntingDataBase data = huntingDataList[index]; if (data != null) { UIHuntingListGrid listGrid = grid as UIHuntingListGrid; listGrid.SetGridData(data); listGrid.SetHightLight(false); } } if (grid is UITabGrid) { UITabGrid g = grid as UITabGrid; g.SetName(toggleDic[(uint)index + 1]); g.TabID = index + 1; } }
void OnRideViewGridDataUpdate(UIGridBase data, int index) { if (data is UITabGrid) { UITabGrid tab = data as UITabGrid; tab.SetGridData(index + 1); tab.SetName(nameList[index]); bool active = (index == 0); tab.SetHightLight(active); if (active) { rideViewTabIndex = index; OnSelectTabs(1); } } else if (data is UIRideViewGrid) { if (m_lstRidedatasShow != null && index < m_lstRidedatasShow.Count) { data.SetGridData(m_lstRidedatasShow[index]); } } }
/// <summary> /// 随身商店格子滑动数据更新回调 /// </summary> /// <param name="data"></param> /// <param name="index"></param> private void OnCarryShopGridDataUpdate(UIGridBase grid, int index) { if (grid is UIMallGrid) { if (index >= m_lst_shopids.Count) { Engine.Utility.Log.Error("KnapsackPanel OnCarryShopGridDataUpdate faield,mallItemIdsDic data errir"); return; } UIMallGrid mallGrid = grid as UIMallGrid; MallDefine.MallLocalData data = DataManager.Manager <MallManager>().GetMallLocalDataByMallItemId(m_lst_shopids[index]); if (null == data) { Engine.Utility.Log.Error("KnapsackPanel OnCarryShopGridDataUpdate faield,mall data errir index:{0}", index); return; } mallGrid.SetGridData(data.MallId); bool select = (data.MallId == selectMallItemId) ? true : false; mallGrid.SetHightLight(select); } else if (grid is UITabGrid) { if (index > m_lst_shoptabs.Count) { Engine.Utility.Log.Error("KnapsackPanel OnCarryShopGridDataUpdate faield,mallTabDic data errir"); return; } int tabKey = m_lst_shoptabs[index]; int startDepth = 2 + m_lst_shoptabs.Count * 2 - index * 2; UITabGrid tabGrid = grid as UITabGrid; tabGrid.SetHightLight(activeTabId == tabKey ? true : false); tabGrid.SetGridData(tabKey); tabGrid.SetName(DataManager.Manager <MallManager>().GetMallTagName((int)GameCmd.CommonStore.CommonStore_Three, tabKey)); tabGrid.SetDepth(startDepth); } }
private void AddTab(UIPanelBase panelBase) { if (rightTabs == null) { return; } rightTabs.transform.parent = panelBase.transform; rightTabs.transform.localPosition = Vector3.zero; rightTabs.SetActive(true); //清空功能页签 m_dicTabFunc.Clear(); int index = 1; Dictionary <int, UITabGrid> dicTabs = null; if (!panelBase.dicUITabGrid.TryGetValue(index, out dicTabs)) { dicTabs = new Dictionary <int, UITabGrid>(6); panelBase.dicUITabGrid.Add(index, dicTabs); } dicTabs.Clear(); UITabGrid grid = null; List <UIPanelManager.PanelTabData.PanelTabUnit> tabUnitDatas = panelBase.PanelInfo.PanelTaData.GetTabUnitList(); UIPanelManager.PanelTabData.PanelTabUnit tabUnit = null; List <int> activeTabIndex = new List <int>(); bool tabFuncOpen = false; for (int i = 0; i < panelBase.PanelInfo.PanelTaData.Count; i++) { tabUnit = tabUnitDatas[i]; grid = m_lstTabGrid[tabUnit.PosIndex]; if (grid == null) { continue; } if (!activeTabIndex.Contains(tabUnit.PosIndex)) { activeTabIndex.Add(tabUnit.PosIndex); } //grid.transform.parent = root; grid.gameObject.SetActive(true); // grid.transform.localPosition = new UnityEngine.Vector3(0, -i * 93, 0); grid.SetHightLight(false); grid.TabID = tabUnit.EnumValue; grid.TabType = index; grid.SetName(tabUnit.EnumName); dicTabs.Add(grid.TabID, grid); grid.SetRedPointStatus(false); grid.SetSoundEffectType(ButtonPlay.ButtonSountEffectType.FuncTabFirst); tabFuncOpen = DataManager.Manager <GuideManager>().IsTabFuncOpen(tabUnit.FuncID); grid.SetOpenStatus(tabFuncOpen); grid.gameObject.name = tabUnit.ObjName; if (!tabFuncOpen && tabUnit.FuncID != 0 && !m_dicTabFunc.ContainsKey(tabUnit.FuncID)) { m_dicTabFunc.Add(tabUnit.FuncID, grid); } grid.RegisterUIEventDelegate((eventType, data, param) => { switch (eventType) { case UIEventType.Click: if (data is UITabGrid) { UITabGrid tabGRid = data as UITabGrid; OnCilckTogglePanel(ref panelBase, grid.TabType, tabGRid.TabID); } break; default: break; } }); } coudsss++; for (int j = 0; j < m_lstTabGrid.Count; j++) { if (!activeTabIndex.Contains(j)) { m_lstTabGrid[j].gameObject.SetActive(false); } } }
private void InitWidgets() { Transform cloneObj = null;// UIManager.GetObj((uint)GridID.Uiiteminfogrid); if (null != m_trans_ItemBaseGridRoot) { cloneObj = m_trans_ItemBaseGridRoot.GetChild(0); } if (null != cloneObj && null == m_exchangeItemBaseGrid) { m_exchangeItemBaseGrid = cloneObj.GetComponent <UIItemInfoGrid>(); if (null == m_exchangeItemBaseGrid) { m_exchangeItemBaseGrid = cloneObj.gameObject.AddComponent <UIItemInfoGrid>(); } if (null != m_exchangeItemBaseGrid) { m_exchangeItemBaseGrid.RegisterUIEventDelegate((eventType, data, param) => { if (eventType == UIEventType.Click) { //if (null != CurrentMallData && null != CurrentMallData.LocalItem) //{ // TipsManager.Instance.ShowItemTips(CurrentMallData.LocalItem); //} } }); } m_trans_ItemBaseGridRoot.localScale = new Vector3(0.9f, 0.9f, 0.9f); } if (null != m_ctor_RightTabRoot && null != m_trans_TogglePanel) { m_ctor_RightTabRoot.Initialize <UITabGrid>(m_trans_TogglePanel.gameObject , (gridBase, index) => { UITabGrid gGRid = gridBase as UITabGrid; if (null != gGRid) { Category tc = category.ChildCategoryData[index]; gGRid.SetGridData(tc.Id); gGRid.SetName(tc.Name); gGRid.SetHightLight((tc.Id == selectfTabID)); } } , (eventType, data, param) => { if (eventType == UIEventType.Click) { UITabGrid gGRid = data as UITabGrid; SetFirstActiveTab((uint)gGRid.Data); } }); } if (null != m_ctor_CategoryTagContent && null != m_trans_UITabGrid) { m_ctor_CategoryTagContent.Initialize <UITabGrid>(m_trans_UITabGrid.gameObject, OnGridUpdate, OnGridEventDlg); } if (null != m_ctor_ExchangeScrollView && null != m_trans_UIExchangeGrid) { m_ctor_ExchangeScrollView.Initialize <UIExchangeGrid>(m_trans_UIExchangeGrid.gameObject, OnGridUpdate, OnGridEventDlg); } }
/// <summary> /// 买格子数据刷新 /// </summary> /// <param name="grid"></param> /// <param name="index"></param> private void OnUpdateGridData(UIGridBase grid, int index) { //买 if (grid is UIHomeTradeBuyGrid) { if (index >= m_dicMallItem[m_nSelectTabId].Count) { Engine.Utility.Log.Error("Out Of Index !!!"); return; } UIHomeTradeBuyGrid buyGrid = grid as UIHomeTradeBuyGrid; if (buyGrid == null) { return; } HomeTradeDataBase htDb = GameTableManager.Instance.GetTableItem <HomeTradeDataBase>(m_dicMallItem[m_nSelectTabId][index]);//大管家 if (htDb == null) { Engine.Utility.Log.Error("Can Not Find Data !!!"); return; } SeedAndCubDataBase data = GameTableManager.Instance.GetTableItem <SeedAndCubDataBase>(htDb.itemID);//种子幼崽表中取 if (data == null) { Engine.Utility.Log.Error("Can Not Find Data !!!"); return; } buyGrid.SetGridData(htDb.indexId); buyGrid.SetIcon(data.icon); buyGrid.SetName(data.name); buyGrid.SetNum(htDb.pileNum); //叠加数量 buyGrid.SetPrice((GameCmd.MoneyType)htDb.moneyType, htDb.price); //现在的价格 bool select = (htDb.indexId == m_nSelectMallItemId) ? true : false; buyGrid.SetHightLight(select); //buyGrid.SetTag(""); } //卖 else if (grid is UIHomeTradeSellGrid) { if (index >= m_dicMallItem[m_nSelectTabId].Count) { Engine.Utility.Log.Error("Out Of Index !!!"); return; } UIHomeTradeSellGrid sellGrid = grid as UIHomeTradeSellGrid; if (sellGrid == null) { return; } HomeTradeDataBase htDb = GameTableManager.Instance.GetTableItem <HomeTradeDataBase>(m_dicMallItem[m_nSelectTabId][index]); if (htDb == null) { Engine.Utility.Log.Error("Can Not Find Data !!!"); return; } ItemDataBase data = GameTableManager.Instance.GetTableItem <ItemDataBase>(htDb.itemID);//item表中取 if (data == null) { Engine.Utility.Log.Error("Can Not Find Data !!!"); return; } CropLivestock cropLivestock = m_dicCropLivestock[data.itemID]; sellGrid.SetGridData(htDb.indexId); sellGrid.SetIcon(data.itemIcon); sellGrid.SetName(data.itemName); sellGrid.SetNum(htDb.pileNum); //叠加数量 sellGrid.SetPrice((GameCmd.MoneyType)htDb.moneyType, (uint)cropLivestock.m_nPrice, cropLivestock.m_fPriceChangeRate, cropLivestock.m_bUp); //现在的价格 bool select = (htDb.indexId == m_nSelectMallItemId) ? true : false; sellGrid.SetHightLight(select); //buyGrid.SetTag(""); } //页签 else if (grid is UITabGrid) { if (index > m_lstHomeTradeTab.Count) { Engine.Utility.Log.Error("Can Not Find Data !!!"); return; } UITabGrid tabGrid = grid as UITabGrid; if (grid == null) { return; } tabGrid.SetGridData(m_lstHomeTradeTab[index]); tabGrid.SetName(m_dicHomeTradeTab[m_lstHomeTradeTab[index]]); bool select = m_lstHomeTradeTab[index] == m_nSelectTabId ? true : false; tabGrid.SetHightLight(select); } }