public Dictionary <uint, CropLivestock> GetCropLivestockDic() { m_dicCropLivestock = new Dictionary <uint, CropLivestock>(); List <HomeLandRecycleDatabase> list = GameTableManager.Instance.GetTableList <HomeLandRecycleDatabase>(); for (int i = 0; i < list.Count; i++) { ItemDataBase itemData = GameTableManager.Instance.GetTableItem <ItemDataBase>(list[i].wdID); CropLivestock cropLivestock = new CropLivestock(); cropLivestock.m_nId = list[i].wdID; cropLivestock.m_strName = itemData.itemName; cropLivestock.m_nNum = (uint)DataManager.Manager <ItemManager>().GetItemNumByBaseId(list[i].wdID); //数量 if (m_dicItemPrice != null) { if (m_dicItemPrice[list[i].wdID] >= list[i].recyclePrice) { cropLivestock.m_bUp = true; //价格上涨 cropLivestock.m_fPriceChangeRate = (float)(m_dicItemPrice[list[i].wdID] - list[i].recyclePrice) / list[i].recyclePrice; //价格变化率 } else { cropLivestock.m_bUp = false; cropLivestock.m_fPriceChangeRate = (float)(list[i].recyclePrice - m_dicItemPrice[list[i].wdID]) / list[i].recyclePrice; } cropLivestock.m_nPrice = m_dicItemPrice[list[i].wdID]; } cropLivestock.m_nIcon = itemData.itemIcon; cropLivestock.m_strDes = itemData.description; //描述 m_dicCropLivestock.Add(list[i].wdID, cropLivestock); } return(m_dicCropLivestock); }
/// <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); } }