public void InitInfoAfterSel(GameItem selItem) { if (selItem != null && selItem.IsValid()) { m_ItemID = selItem.DataID; m_ItemGuid = selItem.Guid; m_NameLabel.text = selItem.GetName(); m_ItemSlot.InitInfo_Stuff(m_ItemID, ShowShenQiStuffTooltips); UpdateItemCountInfo(); } }
void BuyItemOpenConsignSale(bool bSuccess, object param) { if (bSuccess) { if (ConsignSaleLogic.Instance() != null && m_Equip != null && m_Equip.IsValid() != false) { ConsignSaleLogic.Instance().SearchForAskBuy(m_Equip.GetName()); } CloseWindow(); } }
public void SetVars(GameItem item) { //Set itemName.text to itemObject's name, and itemQuantity.text to "x" + itemObject's quantity refItem = item; itemName.text = item.GetName(); if (item.GetStackable()) { itemQuantity.text = "x" + item.quantity; } else { itemQuantity.text = ""; } }
void ShowChooseGemInfo(GameItem item) { if (item.IsValid()) { m_EquipGemNameLabel.text = item.GetName(); m_EquipGemAttrLable.text = ItemTool.GetGemAttr(item.DataID); m_EquipGemLvLabel.text = GetGemLevelString(item.GetMinLevelRequire()); Tab_GemMount line = TableManager.GetGemMountByID((m_CurGemSlot + 1), 0); if (line != null) { //m_EquipGemCoinNum.text = string.Format("消耗金币:{0}", line.ConsumeNum); m_EquipGemCoinNum.text = StrDictionary.GetClientDictionaryString("#{2836}", line.ConsumeNum); } } }
public IEnumerator PickUpItem(GameItem item) { Debug.Log("Picking up item"); agent.SetDestination(item.gameObject.transform.position); isPickingUp = true; while (Vector3.Distance(item.transform.position, transform.position) > pickupDist && isPickingUp) { yield return new WaitForSeconds(0.01f); } if (isPickingUp) { InventoryItem newItem = new InventoryItem(item.GetName()); inventory.Insert(0, newItem); Destroy(item.gameObject); } }
private int size = 0; //Number of objects in inventoryList *NOT ARRAY LENGTH* public void AddItem(GameItem item, int quantity = 1) { int index = inventoryList.FindIndex(x => x.GetName().Equals(item.GetName(), StringComparison.Ordinal)); // in short, looks for a GameItem in inventory with same name as item if (index >= 0) //If true, then will return if the item can be placed not at the end of the array { if (item.GetStackable()) { inventoryList[index].quantity += quantity; //size += quantity; //Debug.Log("Added " + quantity.ToString() + " " + item.GetName() + " to player inventory"); return; } else if (inventoryList[index].quantity == 0) //If the inventory contains 0 of a non-stackable item, replace it with the new item of the same name { item.invLoc = index; inventoryList[index] = item; inventoryList[index].quantity = 1; //size++; //Debug.Log("Added a " + item.GetName() + " to player inventory"); return; } else { inventoryList.Insert(inventoryList.Count, item); item.invLoc = inventoryList.Count - 1; //Debug.Log("Added a " + item.GetName() + " to player inventory"); //size++; } } else { inventoryList.Insert(inventoryList.Count, item); item.invLoc = inventoryList.Count - 1; if (item.GetStackable()) { inventoryList[inventoryList.Count - 1].quantity = quantity; size += quantity; //Debug.Log("Added " + quantity.ToString() + " " + item.GetName() + "(s) to player inventory"); } else { //Debug.Log("Added a " + item.GetName() + " to player inventory"); size++; } } }
private void OnEnable() { if (itemBuying == null) { Debug.Log("text null"); } if (purchasedItem == null) { Debug.Log("item null"); } itemBuying.text = "How many " + purchasedItem.GetName() + "s would you like to buy?"; quantityBuying = 0; quantityBuyingText.text = quantityBuying.ToString(); purchasePrice = 0; purchaseCost.text = "Cost: " + purchasePrice; }
public void SetVars(GameItem item) { //Set itemName.text to itemObject's name, and itemQuantity.text to "x" + itemObject's quantity refItem = item; itemName.text = item.GetName(); }
public void UpdateShenQiViewInfo() { ClearnInfo(); if (m_ShenQiItem == null) { return; } if (m_ShenQiItem.IsValid() == false) { return; } Tab_ShenQiInfo _ShenQiInfo = TableManager.GetShenQiInfoByID(m_ShenQiItem.DataID, 0); if (_ShenQiInfo == null) { return; } m_ShenQiSlot.InitInfo(ItemSlotLogic.SLOT_TYPE.TYPE_ITEM, m_ShenQiItem.DataID, ShowShenQiTipsInf); m_ShenQiNameLable.text = Utils.GetItemNameColor((int)m_ShenQiItem.GetQuality()) + m_ShenQiItem.GetName();//神器名字 //技能信息 int SkillInfIndex = (int)ShenQiDyData.SkillId; if (SkillInfIndex >= 0 && SkillInfIndex < m_ShenQiItem.DynamicData.Length) { Tab_SkillEx _skillEx = TableManager.GetSkillExByID(m_ShenQiItem.DynamicData[(int)ShenQiDyData.SkillId], 0); if (_skillEx != null) { Tab_SkillBase _SkillBase = TableManager.GetSkillBaseByID(_skillEx.BaseId, 0); if (_SkillBase != null) { m_ShenQiSkillNameLable.text = _SkillBase.Name; m_ShenQiSkillLevLable.text = _skillEx.Level.ToString() + "/" + _ShenQiInfo.MaxSkillLev.ToString(); m_ShenQiSkillDecLable.text = _skillEx.SkillDesc; Tab_ShenQiSkillInfo _ShenQiSkillInfo = TableManager.GetShenQiSkillInfoByID(_skillEx.SkillExID, 0); if (_ShenQiSkillInfo != null) { int nSuiPianNum = _ShenQiSkillInfo.NeedItemNum; int nSuiPianOwnNum = GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(_ShenQiSkillInfo.NeedItemId); if (nSuiPianNum <= nSuiPianOwnNum) { m_SheiQiSkillUpSuiPianLabel.text = "[32A100]" + nSuiPianNum; } else { m_SheiQiSkillUpSuiPianLabel.text = "[FF2222]" + nSuiPianNum; } if (_ShenQiSkillInfo.NextSkillId != -1) { m_ShowSkillInfoNextBt.SetActive(true); } } } } } //经验 元宝 经验 m_CoinNumLabel.text = Utils.ConvertLargeNumToString(GameManager.gameManager.PlayerDataPool.Money.GetMoney_Coin()); m_YBNumLable.text = GameManager.gameManager.PlayerDataPool.Money.GetMoney_YuanBao().ToString(); m_ExpNumLable.text = Utils.ConvertLargeNumToString(GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Exp); //属性条 for (int i = 0; i < (int)ShenQiInfo.MAXRANDATTRNUM; i++) { if (i + (int)ShenQiDyData.Attr1Info >= 0 && i + (int)ShenQiDyData.Attr1Info < m_ShenQiItem.DynamicData.Length) { int AttrRandData = m_ShenQiItem.DynamicData[i + (int)ShenQiDyData.Attr1Info]; if (AttrRandData > 0) { int AttrType = m_ShenQiItem.GetShenQiRandAttrType(AttrRandData); int AttrNum = m_ShenQiItem.GetShenQiRandAttrNum(AttrRandData); int AttrQuality = m_ShenQiItem.GetShenQiRandAttrQuality(AttrRandData); m_AttrTypeLable[i].text = Utils.GetItemNameColor(AttrQuality + 1) + Utils.GetAttrTypeString(AttrType); //if (1+_ShenQiInfo.ShenQiRefixPer>0 && _ShenQiInfo.ShenQiRefixPer>0) //{ // int nBaseAttr = (int) ((AttrNum*1.0f)/(1 + _ShenQiInfo.ShenQiRefixPer)); // int nFixAttr = (int) (AttrNum*_ShenQiInfo.ShenQiRefixPer); // m_AttrNumLable[i].text = Utils.GetItemNameColor(AttrQuality+1) + "+" + nBaseAttr.ToString() + "+" + nFixAttr.ToString(); //} //else { int nMaxNum = (int)(_ShenQiInfo.GetAttrMaxValuebyIndex(AttrType) * (1 + _ShenQiInfo.ShenQiRefixPer)); m_AttrNumLable[i].text = Utils.GetItemNameColor(AttrQuality + 1) + "+" + AttrNum + "[FF9933]" + StrDictionary.GetClientDictionaryString("#{5217}", nMaxNum); } m_AttrTypeLable[i].gameObject.SetActive(true); m_AttrNumLable[i].gameObject.SetActive(true); m_AttrToggle[i].gameObject.SetActive(true); } else { m_AttrTypeLable[i].gameObject.SetActive(false); m_AttrNumLable[i].gameObject.SetActive(false); m_AttrToggle[i].gameObject.SetActive(false); } } } m_CoinNeedLable.text = _ShenQiInfo.CoinCostMoney.ToString(); m_YBNeedLable.text = _ShenQiInfo.YBCostMoney.ToString(); m_ExpNeedLable.text = _ShenQiInfo.ExpCostNum.ToString(); m_ShenQiCombatValueLable.text = m_ShenQiItem.GetCombatValue_ForShenQi().ToString(); }