1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-28 06:51:54 +08:00

feat(物品系统): 新增饮料物品并优化物品显示逻辑

添加草莓气泡水物品资源及配置
调整阴阳球物品属性数值
优化物品显示逻辑,支持负数消耗显示为绿色
修改物品应用逻辑,允许负消耗直接扣除
This commit is contained in:
2026-04-12 15:43:13 +08:00
parent 5250adc50d
commit 4a7ba8aec6
6 changed files with 82 additions and 16 deletions
+22
View File
@@ -0,0 +1,22 @@
[gd_scene format=3 uid="uid://b8pcvegc6xne6"]
[ext_resource type="PackedScene" uid="uid://bykwevnv7keeh" path="res://components/Abstracts/FeedCardBase.tscn" id="1_3kowa"]
[ext_resource type="Texture2D" uid="uid://bdktxcifueq2w" path="res://resources/feeds/drink.png" id="2_htdnf"]
[node name="Drink" unique_id=450510980 instance=ExtResource("1_3kowa")]
avatarTexture = ExtResource("2_htdnf")
displayName = "草莓气泡水"
quality = 0
topic = 5
fields = Array[int]([26])
fieldValues = Array[float]([0.05])
costs = Array[int]([0, 1])
costCounts = Array[int]([400, 750])
[node name="avatar" parent="container/info" index="0"]
texture = ExtResource("2_htdnf")
[node name="name" parent="container/info" index="1"]
displayName = "草莓气泡水"
quality = 4
topic = 3
+2 -2
View File
@@ -9,9 +9,9 @@ displayName = "阴阳球"
quality = 4
topic = 7
fields = Array[int]([2, 0, 1])
fieldValues = Array[float]([-0.5, -50.0, -0.5])
fieldValues = Array[float]([-0.4, -60.0, -0.7])
costs = Array[int]([2, 4])
costCounts = Array[int]([-2, -1])
costCounts = Array[int]([-3, -1])
[node name="avatar" parent="container/info" index="0"]
texture = ExtResource("2_1ouu0")
Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

+40
View File
@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bdktxcifueq2w"
path="res://.godot/imported/drink.png-a864b5534bea1c011c5a5b481aeb0e08.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://resources/feeds/drink.png"
dest_files=["res://.godot/imported/drink.png-a864b5534bea1c011c5a5b481aeb0e08.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
+5 -1
View File
@@ -24,7 +24,11 @@ func _physics_process(_delta):
avatarTexture.texture = ItemStore.getTexture(type)
countLabel.text = str(count)
if enough:
countLabel.label_settings.font_color = Color.WHITE
if count < 0:
countLabel.label_settings.font_color = Color.GREEN
countLabel.text = "+%d" % abs(count)
else:
countLabel.label_settings.font_color = Color.WHITE
else:
countLabel.label_settings.font_color = Color.RED
+13 -13
View File
@@ -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)