/// <summary> /// 添加物品 食材成熟后如果当前格子为空 则新开辟一个物品地址,不为空就直接添加个数即可 /// </summary> /// <param name="itemID"></param> public void AddItem(int itemID) { //根据ID找到与之对应的物品 如烧烤的是一块生肉 那么成品应是一块熟肉 Model_Item item = Ctrl_InventoryManager.Instance.GetItemById(GlobalParametr.GetCookingProduct(itemID)); if (Item == null) { Item = Ctrl_InventoryManager.Instance.NewItem(item.id); /* Item = new Model_Item * { * id = item.id, * itemName = item.itemName, * itemType = item.itemType, * equipmentType = item.equipmentType, * materialType = item.materialType, * consumption = item.consumption, * maxStack = item.maxStack, * currentNumber = item.currentNumber, * buyPriceByGold = item.buyPriceByGold, * buyPriceByDiamond = item.buyPriceByDiamond, * sellPriceByGold = item.sellPriceByGold, * sellPriceByDiamond = item.sellPriceByDiamond, * minLevel = item.minLevel, * sellable = item.sellable, * tradable = item.tradable, * destroyable = item.destroyable, * description = item.description, * sprite = item.sprite, * useDestroy = item.useDestroy, * useHealth = item.useHealth, * useMagic = item.useMagic, * useExperience = item.useExperience, * equipHealthBonus = item.equipHealthBonus, * equipManaBonus = item.equipManaBonus, * equipDamageBonus = item.equipDamageBonus, * equipDefenseBonus = item.equipDefenseBonus, * equipSpeedcBonus = item.equipSpeedcBonus, * modelPrefab = item.modelPrefab * };*/ } else { if (this.item.currentNumber < item.maxStack) { this.item.currentNumber += 1; UpdateAmount(); } } }
/// <summary> /// 添加物品 食材成熟后如果当前格子为空 则新开辟一个物品地址,不为空就直接添加个数即可 /// </summary> /// <param name="itemID"></param> public void AddItem(int itemID) { //根据ID找到与之对应的物品 如烧烤的是一块生肉 那么成品应是一块熟肉 Model_Item item = Ctrl_InventoryManager.Instance.GetItemById(GlobalParametr.GetCookingProduct(itemID)); if (Item == null) { Item = Ctrl_InventoryManager.Instance.NewItem(item.id); } else { if (this.item.currentNumber < item.maxStack) { this.item.currentNumber += 1; UpdateAmount(); } } }