mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-27 22:41:56 +08:00
feat(物品系统): 新增饮料物品并优化物品显示逻辑
添加草莓气泡水物品资源及配置 调整阴阳球物品属性数值 优化物品显示逻辑,支持负数消耗显示为绿色 修改物品应用逻辑,允许负消耗直接扣除
This commit is contained in:
+13
-13
@@ -41,10 +41,10 @@ func allHad(entity: EntityBase) -> bool:
|
||||
func apply(entity: EntityBase):
|
||||
var allHave = allHad(entity)
|
||||
if allHave:
|
||||
if !freeToBuy:
|
||||
for i in range(min(costs.size(), costCounts.size())):
|
||||
var item = costs[i]
|
||||
var count = countOf(i)
|
||||
for i in range(min(costs.size(), costCounts.size())):
|
||||
var item = costs[i]
|
||||
var count = countOf(i)
|
||||
if !freeToBuy || count < 0:
|
||||
entity.inventory[item] -= count
|
||||
for i in range(min(fields.size(), fieldValues.size())):
|
||||
var field = fields[i]
|
||||
@@ -107,12 +107,12 @@ func rebuildInfo():
|
||||
weaponsBox.add_child(weaponShow)
|
||||
for i in costsBox.get_children():
|
||||
i.queue_free()
|
||||
if !freeToBuy:
|
||||
for i in range(min(costs.size(), costCounts.size())):
|
||||
var cost = costs[i]
|
||||
var count = countOf(i)
|
||||
var costShow: ItemShow = ComponentManager.getUIComponent("ItemShow").instantiate()
|
||||
costShow.enough = is_instance_valid(UIState.player) and UIState.player.inventory[cost] >= count
|
||||
costShow.type = cost
|
||||
costShow.count = count
|
||||
costsBox.add_child(costShow)
|
||||
for i in range(min(costs.size(), costCounts.size())):
|
||||
var cost = costs[i]
|
||||
var count = countOf(i)
|
||||
var costShow: ItemShow = ComponentManager.getUIComponent("ItemShow").instantiate()
|
||||
costShow.enough = is_instance_valid(UIState.player) and UIState.player.inventory[cost] >= count
|
||||
costShow.type = cost
|
||||
costShow.count = count
|
||||
costShow.visible = !freeToBuy || count < 0
|
||||
costsBox.add_child(costShow)
|
||||
|
||||
Reference in New Issue
Block a user