public void setPrepurchase(itemLeaf _itemLeaf) { tempList = new List <items>(); isFound = false; tempList.Add(_itemLeaf.FatherItem); if (_itemLeaf.getList().Count != 0) { fatherItemLeaf = _itemLeaf.getList(); for (int j = 0; j < fatherItemLeaf.Count; j++) { tempList.Add(fatherItemLeaf[j].FatherItem); if (fatherItemLeaf[j].getList().Count != 0) { childItemLeaf = fatherItemLeaf[j].getList(); for (int n = 0; n < childItemLeaf.Count; n++) { tempList.Add(childItemLeaf[n].FatherItem); } } } } childItemLeaf = null; for (int i = 0; i < tempList.Count; i++) { isFound = false; if (prepurchase.Count == 0) { prepurchase.Add(tempList[i]); continue; } for (int j = 0; j < prepurchase.Count; j++) { if (isFound) { continue; } if (prepurchase[j].Id == tempList[i].Id) { isFound = true; continue; } } if (!isFound) { prepurchase.Add(tempList[i]); } } if (itemDic.ContainsKey("推荐")) { itemDic["推荐"] = prepurchase; } else { itemDic.Add("推荐", prepurchase); } }
/// <summary> /// 点击事件 /// </summary> /// <param name="eventData"></param> public new void OnPointerDown(PointerEventData eventData) { Debug.Log("执行"); for (int i = 0; i < fatherItem.getList().Count; i++) { Debug.Log(fatherItem.getList()[i].FatherItem.Name); } isPointDown = true; fixstring(m_itemss); Debug.Log(m_itemss.Explain); //显示提示面板 ItemToolTipManager.instance.showTool(m_image.GetComponent <Image>(), own, this.fatherItem.FatherItem, this.fatherItem); }
/// <summary> /// 返回选中物品的金钱 /// </summary> /// <returns></returns> private string showGoldText() { m_playSlotQueue.Clear(); itemPrice = m_item.BuyPrice; Debug.Log(m_item.BuyPrice + "jslkfj" + m_item.Name); if (m_fatherItem.getList().Count != 0) { //根据物品树获取到子物品列表 m_fatherItemLeaf = m_fatherItem.getList(); for (int soltList = 0; soltList < PlayerSlotManager.instace.getList().Count; soltList++) { isFound = false; if (PlayerSlotManager.instace.getList()[soltList].GetComponent <playerSlot>().isNull == -1) { continue; } for (int i = 0; i < m_fatherItemLeaf.Count; i++) { if (isFound) { continue; } //Debug.Log(fatherItemLeaf.Count); if (m_fatherItemLeaf.Count == 0) { continue; } if (m_fatherItemLeaf[i].FatherItem.Id == PlayerSlotManager.instace.getList()[soltList].GetComponent <playerSlot>().item.Id) { Debug.Log(m_item.BuyPrice); isFound = true; m_playSlotQueue.Enqueue(PlayerSlotManager.instace.getList()[soltList]); itemPrice -= PlayerSlotManager.instace.getList()[soltList].GetComponent <playerSlot>().item.BuyPrice; m_fatherItemLeaf.Remove(m_fatherItemLeaf[i]); continue; } if (m_fatherItemLeaf[i].getList().Count != 0) { if (m_childItemLeaf == null) { m_childItemLeaf = m_fatherItemLeaf[i].getList(); } m_childItemLeaf = m_fatherItemLeaf[i].getList(); } else { continue; } Debug.Log(m_item.BuyPrice); //Debug.Log(fatherItem.getList()[i].FatherItem.Name); for (int j = 0; j < m_childItemLeaf.Count; j++) { if (isFound) { continue; } if (m_childItemLeaf.Count == 0) { continue; } if (m_childItemLeaf[j].FatherItem.Id == PlayerSlotManager.instace.getList()[soltList].GetComponent <playerSlot>().item.Id) { isFound = true; m_playSlotQueue.Enqueue(PlayerSlotManager.instace.getList()[soltList]); itemPrice -= PlayerSlotManager.instace.getList()[soltList].GetComponent <playerSlot>().item.BuyPrice; //childItemLeaf[j].getList().Remove(childItemLeaf[j]); m_childItemLeaf.Remove(m_childItemLeaf[j]); continue; } // Debug.Log(fatherItem.getList()[i].getList()[j].FatherItem.Name); } } } //清空子物品 m_childItemLeaf = null; } return(itemPrice.ToString()); }