/// <summary> /// 根据物品数量判断物品是否可以使用 /// </summary> public bool IsItemCanUse() { GenericItemInfo ItemInfo = new GenericItemInfo(); ItemInfo.EconomyId = templateid; ItemInfo.InventoryId = EB.Dot.String("inventory_id", BagItemData, null); ItemInfo.Num = EB.Dot.Integer("num", BagItemData, 0); ItemInfo.Price = 0; Hotfix_LT.Data.GeneralItemTemplate item = Hotfix_LT.Data.EconemyTemplateManager.Instance.GetItem(templateid) as Hotfix_LT.Data.GeneralItemTemplate; return((item == null) ? false : ItemInfo.Num >= item.NeedNum); }
public void OnUseButtonClick() { string itemType = EB.Dot.String("system", BagItemData, null); if (itemType.Equals("SelectBox")) { int num = EB.Dot.Integer("num", BagItemData, 0); string inventoryId = EB.Dot.String("inventory_id", BagItemData, string.Empty); List <Hotfix_LT.Data.SelectBox> selectBoxList = Hotfix_LT.Data.EconemyTemplateManager.Instance.GetSelectBoxListById(templateid); if (selectBoxList == null) { EB.Debug.LogError("ShowBagContent OnUseButtonClick is Error, selectBoxList is Null"); return; } Hashtable table = Johny.HashtablePool.Claim(); table["boxManNum"] = num; table["inventoryId"] = inventoryId; table["selectBoxList"] = selectBoxList; GlobalMenuManager.Instance.Open("LTSelectBoxUI", table); } else { GenericItemInfo ItemInfo = new GenericItemInfo(); ItemInfo.EconomyId = templateid; ItemInfo.InventoryId = EB.Dot.String("inventory_id", BagItemData, null); ItemInfo.Num = EB.Dot.Integer("num", BagItemData, 0); ItemInfo.Price = 0; if (ItemInfo.Num > 1) { GlobalMenuManager.Instance.Open("GenericUseView", ItemInfo); } else if (ItemInfo.Num == 1) { OnUse(); } else { EB.Debug.Log("the number of items is smaller than 1"); } } }
public override void SetMenuData(object param) { var itemInfo = param as GenericItemInfo; if (itemInfo != null) { curItemInfo = itemInfo; var inl = LTItemInfoTool.GetInfo(curItemInfo.EconomyId, LTShowItemType.TYPE_GAMINVENTORY); mIcon.spriteName = inl.icon; mFrame.spriteName = UIItemLvlDataLookup.LvlToStr(inl.quality); mFrameBG.spriteName = UIItemLvlDataLookup.GetItemFrameBGSprite(inl.quality); mFrameBG.color = UIItemLvlDataLookup.GetItemFrameBGColor(inl.quality); mName.text = inl.name; mTotalNum = curItemInfo.Num; mCurNum = mTotalNum; qualityLevel = int.Parse(inl.quality); Show(); var suitIcon = Hotfix_LT.Data.EconemyTemplateManager.Instance.GetEquipSuit(curItemInfo.EconomyId); if (!string.IsNullOrEmpty(suitIcon)) { mEquipSuitIcon.gameObject.SetActive(true); mEquipSuitIcon.spriteName = suitIcon; } else { mEquipSuitIcon.gameObject.SetActive(false); } var grade = Hotfix_LT.Data.EconemyTemplateManager.Instance.GetGoodsGradeNum(curItemInfo.EconomyId); mboxGradeNumLab.gameObject.CustomSetActive(grade != 0); if (grade != 0) { mboxGradeNumLab.text = string.Format("+{0}", grade); } } }