/// <summary> /// 消耗信息 /// </summary> private void SetCostInfo() { EquipStar star_info = EquipStarConfig.GetEquipStarInfo(cur_equip_info.id, cur_star_num); if (star_info == null || string.IsNullOrEmpty(star_info.cost)) { return; } string[] need_str_arr = star_info.cost.Split(';'); // 默认打开球队卡牌界面 List <object> listObj = new List <object>(); for (int i = 0; i < need_str_arr.Length; i++) { EquipCostInfo info = new EquipCostInfo(); string[] info_arr = need_str_arr[i].Split(':'); info.item_id = GameConvert.IntConvert(info_arr[0]); info.need_num = GameConvert.IntConvert(info_arr[1]); if (info.item_id == 0) { continue; } listObj.Add(info); } panel.costGrid.AddCustomDataList(listObj); }
private void OnUpdateCost(UIGridItem item) { if (item == null || item.mScripts == null || item.oData == null) { return; } EquipCostInfo info = item.oData as EquipCostInfo; UISprite color = item.mScripts[0] as UISprite; UITexture icon = item.mScripts[1] as UITexture; UILabel num = item.mScripts[2] as UILabel; ItemInfo item_info = ItemManager.GetItemInfo(info.item_id.ToString()); if (item_info == null) { return; } color.spriteName = "color" + item_info.color; LoadSprite.LoaderItem(icon, info.item_id.ToString(), false); int total_num = ItemManager.GetBagItemCount(info.item_id.ToString()); num.text = string.Format("{0}/{1}", total_num, info.need_num.ToString()); num.color = total_num >= info.need_num ? Color.white : Color.red; }
/// <summary> /// 消耗信息 /// </summary> public void SetCostInfo() { string[] need_str_arr = cur_make_info.Cost.Split(','); // 默认打开球队卡牌界面 List <object> listObj = new List <object>(); for (int i = 0; i < need_str_arr.Length; i++) { EquipCostInfo info = new EquipCostInfo(); string[] info_arr = need_str_arr[i].Split(':'); info.item_id = GameConvert.IntConvert(info_arr[0]); info.need_num = GameConvert.IntConvert(info_arr[1]); listObj.Add(info); } panel.costGrid.AddCustomDataList(listObj); }