mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-06-29 23:12:28 +08:00
feat(音效): 添加物品收集音效并改进数值显示
为物品收集添加音效播放功能
在EntityBase.gd中调用playSound("collect")
添加Collect.wav音效文件及导入配置
改进数值显示格式:
- 在MathTool.gd中添加signBeforeStr方法
- 修改FieldShow.gd使用新方法显示带符号的数值
- 调整FieldShow.tscn的UI布局
同时修复MakeFeed.gd中feed显示问题
This commit is contained in:
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"godotTools.editorPath.godot4": "d:\\Program Files\\Godot\\godot43.exe"
|
||||||
|
}
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
[gd_scene load_steps=17 format=3 uid="uid://cvogxi7mktumf"]
|
[gd_scene load_steps=18 format=3 uid="uid://cvogxi7mktumf"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scripts/Statemachine/EntityBase.gd" id="1_mvol6"]
|
[ext_resource type="Script" path="res://scripts/Statemachine/EntityBase.gd" id="1_mvol6"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dwwpkn4q07ja2" path="res://icon.svg" id="2_7lpu0"]
|
[ext_resource type="Texture2D" uid="uid://dwwpkn4q07ja2" path="res://icon.svg" id="2_7lpu0"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://cn876dtp1ypqx" path="res://resources/sounds/effect/Collect.wav" id="2_qt0aq"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dcjqjqere8ets" path="res://components/UI/EntityStateBar.tscn" id="2_uje1g"]
|
[ext_resource type="PackedScene" uid="uid://dcjqjqere8ets" path="res://components/UI/EntityStateBar.tscn" id="2_uje1g"]
|
||||||
|
|
||||||
[sub_resource type="SpriteFrames" id="SpriteFrames_wcqpm"]
|
[sub_resource type="SpriteFrames" id="SpriteFrames_wcqpm"]
|
||||||
@@ -184,6 +185,9 @@ unique_name_in_owner = true
|
|||||||
|
|
||||||
[node name="hurt" type="AudioStreamPlayer2D" parent="sounds"]
|
[node name="hurt" type="AudioStreamPlayer2D" parent="sounds"]
|
||||||
|
|
||||||
|
[node name="collect" type="AudioStreamPlayer2D" parent="sounds"]
|
||||||
|
stream = ExtResource("2_qt0aq")
|
||||||
|
|
||||||
[node name="attack0" type="AudioStreamPlayer2D" parent="sounds"]
|
[node name="attack0" type="AudioStreamPlayer2D" parent="sounds"]
|
||||||
|
|
||||||
[node name="texture" type="AnimatedSprite2D" parent="."]
|
[node name="texture" type="AnimatedSprite2D" parent="."]
|
||||||
|
|||||||
@@ -4,17 +4,31 @@
|
|||||||
[ext_resource type="Theme" uid="uid://b6nox1qqh50ub" path="res://themes/smallText.tres" id="2_x62bb"]
|
[ext_resource type="Theme" uid="uid://b6nox1qqh50ub" path="res://themes/smallText.tres" id="2_x62bb"]
|
||||||
|
|
||||||
[node name="FieldShow" type="HBoxContainer"]
|
[node name="FieldShow" type="HBoxContainer"]
|
||||||
|
offset_right = 144.0
|
||||||
|
offset_bottom = 18.0
|
||||||
script = ExtResource("1_gwocj")
|
script = ExtResource("1_gwocj")
|
||||||
|
metadata/_edit_horizontal_guides_ = [18.0]
|
||||||
|
|
||||||
[node name="name" type="Label" parent="."]
|
[node name="name" type="Label" parent="."]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 11
|
||||||
theme = ExtResource("2_x62bb")
|
theme = ExtResource("2_x62bb")
|
||||||
text = "最大生命值"
|
text = "生命上限"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="sep" type="ColorRect" parent="."]
|
||||||
|
custom_minimum_size = Vector2(20, 1)
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 4
|
||||||
|
size_flags_stretch_ratio = 16.0
|
||||||
|
|
||||||
[node name="value" type="Label" parent="."]
|
[node name="value" type="Label" parent="."]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 10
|
size_flags_horizontal = 10
|
||||||
|
size_flags_vertical = 8
|
||||||
theme = ExtResource("2_x62bb")
|
theme = ExtResource("2_x62bb")
|
||||||
text = "0"
|
text = "+0"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ script = ExtResource("1_v2djl")
|
|||||||
|
|
||||||
[node name="texture" type="Sprite2D" parent="."]
|
[node name="texture" type="Sprite2D" parent="."]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
scale = Vector2(0.25, 0.25)
|
scale = Vector2(0.5, 0.5)
|
||||||
texture = ExtResource("2_4hl42")
|
texture = ExtResource("2_4hl42")
|
||||||
|
|
||||||
[node name="hitbox" type="CollisionShape2D" parent="."]
|
[node name="hitbox" type="CollisionShape2D" parent="."]
|
||||||
|
|||||||
Binary file not shown.
@@ -0,0 +1,24 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="wav"
|
||||||
|
type="AudioStreamWAV"
|
||||||
|
uid="uid://cn876dtp1ypqx"
|
||||||
|
path="res://.godot/imported/Collect.wav-4d772a4eda4ec839db8d846e0f5a9531.sample"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://resources/sounds/effect/Collect.wav"
|
||||||
|
dest_files=["res://.godot/imported/Collect.wav-4d772a4eda4ec839db8d846e0f5a9531.sample"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
force/8_bit=false
|
||||||
|
force/mono=false
|
||||||
|
force/max_rate=false
|
||||||
|
force/max_rate_hz=44100
|
||||||
|
edit/trim=false
|
||||||
|
edit/normalize=false
|
||||||
|
edit/loop_mode=0
|
||||||
|
edit/loop_begin=0
|
||||||
|
edit/loop_end=-1
|
||||||
|
compress/mode=0
|
||||||
@@ -60,5 +60,6 @@ func regenerateCards():
|
|||||||
feeds.shuffle()
|
feeds.shuffle()
|
||||||
for i in range(UIState.player.fields[FieldStore.Entity.FEED_COUNT_SHOW]):
|
for i in range(UIState.player.fields[FieldStore.Entity.FEED_COUNT_SHOW]):
|
||||||
var feed = feeds[i] as Feed
|
var feed = feeds[i] as Feed
|
||||||
|
feed.show()
|
||||||
avaliableFeeds.remove_child(feed)
|
avaliableFeeds.remove_child(feed)
|
||||||
feedCards.add_child(feed)
|
feedCards.add_child(feed)
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ func _ready():
|
|||||||
func(body):
|
func(body):
|
||||||
if body is ItemDropped:
|
if body is ItemDropped:
|
||||||
inventory[body.item] += body.stackCount
|
inventory[body.item] += body.stackCount
|
||||||
|
playSound("collect")
|
||||||
body.queue_free()
|
body.queue_free()
|
||||||
)
|
)
|
||||||
energyChanged.connect(
|
energyChanged.connect(
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ func _ready():
|
|||||||
var formattedValue: String
|
var formattedValue: String
|
||||||
var dataType = FieldStore.entityMapType[field]
|
var dataType = FieldStore.entityMapType[field]
|
||||||
if dataType == FieldStore.DataType.VALUE:
|
if dataType == FieldStore.DataType.VALUE:
|
||||||
formattedValue = str(value)
|
formattedValue = MathTool.signBeforeStr(value)
|
||||||
elif dataType == FieldStore.DataType.ANGLE:
|
elif dataType == FieldStore.DataType.ANGLE:
|
||||||
formattedValue = str(value) + "°"
|
formattedValue = MathTool.signBeforeStr(value) + "°"
|
||||||
elif dataType == FieldStore.DataType.PERCENT:
|
elif dataType == FieldStore.DataType.PERCENT:
|
||||||
formattedValue = "%.1f" % (value * 100) + "%"
|
formattedValue = MathTool.signBeforeStr(float("%.1f" % (value * 100))) + "%"
|
||||||
valueLabel.text = formattedValue
|
valueLabel.text = formattedValue
|
||||||
|
|||||||
@@ -9,3 +9,5 @@ static func randv2_range(offset: float):
|
|||||||
)
|
)
|
||||||
static func randc_from(array: Array):
|
static func randc_from(array: Array):
|
||||||
return array[randi() % array.size()]
|
return array[randi() % array.size()]
|
||||||
|
static func signBeforeStr(value: float):
|
||||||
|
return ("+" if value > 0 else "-" if value < 0 else "") + str(abs(value))
|
||||||
Reference in New Issue
Block a user