private void CostUpdataItem(UIGridItem item) { if (item == null || item.mScripts == null || item.oData == null) { return; } CompoundInfo info = item.oData as CompoundInfo; UISprite color = item.mScripts[0] as UISprite; UITexture icon = item.mScripts[1] as UITexture; UILabel num = item.mScripts[2] as UILabel; UISprite add = item.mScripts[3] as UISprite; color.spriteName = "color" + 1; add.transform.gameObject.SetActive(info.m_select == 0); item.transform.FindChild("contain").gameObject.SetActive(info.m_select == 1); if (info.m_gem != null) { GemItem gem = GemItemConfig.GetGemItem(int.Parse(info.m_gem.itemID)); ItemInfo item_info = ItemManager.GetItemInfo(info.m_gem.itemID); num.text = "1"; color.spriteName = "color" + item_info.color; LoadSprite.LoaderItem(icon, item_info.itemID, false); } }
private void ChooseGrid_UpdateItem(UIGridItem item) { if (item == null || item.mScripts == null || item.oData == null) { return; } Item info = item.oData as Item; item.onClick = ClickGemItem; UILabel name = item.mScripts[0] as UILabel; UITexture icon = item.mScripts[1] as UITexture; UILabel level = item.mScripts[2] as UILabel; UISprite color = item.mScripts[3] as UISprite; ItemInfo item_info = ItemManager.GetItemInfo(info.itemID); GemItem gem = GemItemConfig.GetGemItem(int.Parse(info.itemID)); if (item_info == null) { return; } color.spriteName = "color" + item_info.color; name.text = TextManager.GetItemString(info.itemID); level.text = info.amount.ToString(); LoadSprite.LoaderItem(icon, item_info.itemID, false); }
private void SetGem() { GemItem gem = select_gem == null ? null : GemItemConfig.GetGemItem(int.Parse(select_gem.itemID)); GemCompound compound = select_gem == null ? null : GemCompoundConfig.GetGemCompound(int.Parse(select_gem.itemID)); GemItem compoundGem = compound == null?null: GemItemConfig.GetGemItem(compound.compoundId); string name = select_gem == null?TextManager.GetUIString("UI2065") : TextManager.GetItemString(select_gem.itemID); string prop_name = gem == null ? " " : TextManager.GetUIString(gem.propType); string prop_value = gem == null ? " " : gem.propValue.ToString(); string prop_value1 = compoundGem == null ? " " : compoundGem.propValue.ToString(); panel.next.gameObject.SetActive(gem != null && gem.level < 9); panel.compoundBtn.gameObject.SetActive(gem != null && gem.level < 9); panel.info.FindChild("gem_name").GetComponent <UILabel>().text = name; panel.info.FindChild("prop_name").GetComponent <UILabel>().text = prop_name; panel.next.FindChild("prop_name1").GetComponent <UILabel>().text = prop_name; panel.next.FindChild("prop_name2").GetComponent <UILabel>().text = prop_name; panel.info.FindChild("prop_value").GetComponent <UILabel>().text = prop_value; panel.next.FindChild("prop_value1").GetComponent <UILabel>().text = prop_value; panel.next.FindChild("prop_value2").GetComponent <UILabel>().text = prop_value1; panel.info.FindChild("descTxt3").gameObject.SetActive(compound_list.Count == 0); panel.info.FindChild("descTxt4").gameObject.SetActive(gem != null && gem.level == 9); }
//设置装备宝石信息 private void SetGemInfo() { m_holdInfo_list.Clear(); GameObject child_gem; int gem_state = -1; string[] gem_data_arr = gem_data_info.Split(';'); string[] need_hold_arr = cur_equip_info.needOpenHold.Split(';'); for (int i = 0; i < m_max_gem_num; i++) { child_gem = panel.gemInfo.GetChild(i).gameObject; gem_state = GameConvert.IntConvert(gem_data_arr[i]); string[] hold_need_data = need_hold_arr[i].Split(':'); HoldInfo hold_info = new HoldInfo(); hold_info.m_gem_id = gem_state; hold_info.m_index = i + 1; hold_info.m_info = gem_state > 0 ? GemItemConfig.GetGemItem(gem_state) : null; if (gem_state > 0) { hold_info.m_type = Hold_STATE.EQUIP; } else if (gem_state == 0) { hold_info.m_type = Hold_STATE.EMPTY; } else { int need_num = GameConvert.IntConvert(hold_need_data[1]); int has_num = ItemManager.GetBagItemCount(hold_need_data[0]); HoldInfo previous_info = null; if (i - 1 >= 0) { previous_info = m_holdInfo_list[i - 1]; } if (previous_info == null || previous_info.m_type == Hold_STATE.EQUIP || previous_info.m_type == Hold_STATE.EMPTY) { hold_info.m_type = has_num > need_num ? Hold_STATE.CAN_OPEN : Hold_STATE.MATERIAL_LOCK; } else { hold_info.m_type = Hold_STATE.NOT_OPEN_LOCK;//上一个孔没开启 } } SetGemItemInfo(child_gem, hold_info); m_holdInfo_list.Add(hold_info); } }
/// <summary> /// 是否已经安装 /// </summary> /// <param name="gem_id"></param> /// <returns></returns> private bool IsHasEquiped(int gem_id) { List <HoldInfo> list = EquipInsetMediator.equipInsetMediator.m_holdInfo_list; GemItem gem_info = GemItemConfig.GetGemItem(gem_id); for (int i = 0; i < list.Count; i++) { if (list[i].m_gem_id <= 0) { continue; } GemItem info = GemItemConfig.GetGemItem(list[i].m_gem_id); if (info.propType == gem_info.propType) { return(true); } } return(false); }
/// <summary> /// 点击 /// </summary> /// <param name="data"></param> /// <param name="go"></param> private void ClickGemItem(UIGridItem data) { Item gem = data.oData as Item; if (select_gem != null && gem.uuid == select_gem.uuid) { return; } else { select_gem = gem; } if (select_gem == null) { panel.chooseGrid.OldSelectedItem.Selected = false; } mCurGem = select_gem == null ? null : GemItemConfig.GetGemItem(int.Parse(select_gem.itemID)); panel.costGrid.AddCustomDataList(CostListGrid()); SetGem(); }