书架与信件游戏 sfx 调整
This commit is contained in:
parent
d3868215d7
commit
28223ed890
@ -106,12 +106,12 @@ func global_stop(duration := 1.5) -> void:
|
||||
func easing_kill(duration: float = 2.0) -> Tween:
|
||||
# stop with easing
|
||||
var tween = create_tween()
|
||||
tween.bind_node(self)
|
||||
if playing:
|
||||
tween.tween_property(self, "volume_linear", 0.01, duration)
|
||||
tween.tween_callback(stop)
|
||||
# set volume_db back to default
|
||||
tween.tween_callback(func(): volume_db = default_db)
|
||||
tween.tween_interval(0.001) # 防止 no step
|
||||
return tween
|
||||
|
||||
|
||||
@ -167,18 +167,13 @@ func _get(property: StringName) -> Variant:
|
||||
return null
|
||||
|
||||
|
||||
var resume_on_close_up_exit := false
|
||||
func change_volumn_db(changed_volumn_db: float, duration := 1.0) -> void:
|
||||
if changed_volumn_db != 0.0:
|
||||
var target_linear = db_to_linear(default_db + changed_volumn_db)
|
||||
var tween = create_tween()
|
||||
tween.tween_property(self, "volume_linear", target_linear, duration)
|
||||
|
||||
func on_toggle_close_up(display: bool) -> void:
|
||||
if not is_in_group(GlobalConfig.GROUP_GROUND_SFX):
|
||||
return
|
||||
if display:
|
||||
if stream and not stream_paused:
|
||||
resume_on_close_up_exit = true
|
||||
var tween = create_tween()
|
||||
tween.tween_property(self, "volume_linear", 0.01, 1.0)
|
||||
else:
|
||||
if resume_on_close_up_exit:
|
||||
var tween = create_tween()
|
||||
tween.tween_property(self, "volume_linear", default_linear, 1.0)
|
||||
|
||||
func reset_volumn_to_default(duration := 1.0) -> void:
|
||||
var tween = create_tween()
|
||||
tween.tween_property(self, "volume_linear", default_linear, duration)
|
@ -78,20 +78,17 @@ func easing_kill(duration: float = 2.0) -> Tween:
|
||||
tween.tween_callback(stop)
|
||||
# set volume_db back to default
|
||||
tween.tween_callback(func(): volume_db = default_db)
|
||||
tween.tween_interval(0.001) # 防止 no step
|
||||
return tween
|
||||
|
||||
|
||||
var resume_on_close_up_exit := false
|
||||
func change_volumn_db(changed_volumn_db: float, duration := 1.0) -> void:
|
||||
if changed_volumn_db != 0.0:
|
||||
var target_linear = db_to_linear(default_db + changed_volumn_db)
|
||||
var tween = create_tween()
|
||||
tween.tween_property(self, "volume_linear", target_linear, duration)
|
||||
|
||||
func on_toggle_close_up(display: bool) -> void:
|
||||
if not is_in_group(GlobalConfig.GROUP_GROUND_SFX2D):
|
||||
return
|
||||
if display:
|
||||
if stream and not stream_paused:
|
||||
resume_on_close_up_exit = true
|
||||
var tween = create_tween()
|
||||
tween.tween_property(self, "volume_linear", 0.01, 1.0)
|
||||
else:
|
||||
if resume_on_close_up_exit:
|
||||
var tween = create_tween()
|
||||
tween.tween_property(self, "volume_linear", default_linear, 1.0)
|
||||
|
||||
func reset_volumn_to_default(duration := 1.0) -> void:
|
||||
var tween = create_tween()
|
||||
tween.tween_property(self, "volume_linear", default_linear, duration)
|
@ -8,7 +8,8 @@ signal exit(arg)
|
||||
|
||||
@export var packed_scene: PackedScene
|
||||
@export var quit_closeup_on_cancel := true
|
||||
@export var pause_sfx_on_display := false
|
||||
@export var on_display_change_volumn := true
|
||||
@export var on_display_changed_volumn_db := -7.0
|
||||
@export_tool_button("新建特写场景") var create_closeup_scene = _create_scene_with_script
|
||||
|
||||
var current_child: Node
|
||||
@ -26,9 +27,9 @@ func display() -> void:
|
||||
if current_child:
|
||||
return
|
||||
if packed_scene:
|
||||
if pause_sfx_on_display:
|
||||
get_tree().call_group(GlobalConfig.GROUP_GROUND_SFX, "on_toggle_close_up" , true)
|
||||
get_tree().call_group(GlobalConfig.GROUP_GROUND_SFX2D, "on_toggle_close_up" , true)
|
||||
if on_display_change_volumn:
|
||||
get_tree().call_group(GlobalConfig.GROUP_GROUND_SFX, "change_volumn_db" , on_display_changed_volumn_db)
|
||||
get_tree().call_group(GlobalConfig.GROUP_GROUND_SFX2D, "change_volumn_db" , on_display_changed_volumn_db)
|
||||
SceneManager.lock_player(0, action_key)
|
||||
# 展示时,禁用 sign_mark 的输入
|
||||
sign_mark.pass_unhandled_input = true
|
||||
@ -42,9 +43,9 @@ func display() -> void:
|
||||
|
||||
func _exit(arg = null):
|
||||
if current_child:
|
||||
if pause_sfx_on_display:
|
||||
get_tree().call_group(GlobalConfig.GROUP_GROUND_SFX, "on_toggle_close_up" , false)
|
||||
get_tree().call_group(GlobalConfig.GROUP_GROUND_SFX2D, "on_toggle_close_up" , false)
|
||||
if on_display_change_volumn:
|
||||
get_tree().call_group(GlobalConfig.GROUP_GROUND_SFX, "reset_volumn_to_default")
|
||||
get_tree().call_group(GlobalConfig.GROUP_GROUND_SFX2D, "reset_volumn_to_default")
|
||||
SceneManager.unlock_player()
|
||||
remove_child(current_child)
|
||||
current_child.queue_free()
|
||||
|
@ -49,9 +49,14 @@ unique_name_in_owner = true
|
||||
position = Vector2(41, 88)
|
||||
reenter_lock = NodePath("../PlayerReenterLock")
|
||||
camera_marker = NodePath("../CameraFocusMarker")
|
||||
player_movement_rect = Rect2(20, -158, 524, 316)
|
||||
|
||||
[node name="CameraFocusMarker" parent="." node_paths=PackedStringArray("focusing_node") instance=ExtResource("4_mgk0a")]
|
||||
unique_name_in_owner = true
|
||||
limit_left = 0
|
||||
limit_top = -158
|
||||
limit_right = 564
|
||||
limit_bottom = 158
|
||||
focusing_node = NodePath("../MainPlayer")
|
||||
|
||||
[node name="ParallaxForeground" type="ParallaxBackground" parent="."]
|
||||
@ -81,6 +86,7 @@ height = 0.5
|
||||
|
||||
[node name="FootstepAudioPlayer" type="AudioStreamPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
volume_db = -5.0
|
||||
bus = &"game_sfx"
|
||||
script = ExtResource("5_7mb2q")
|
||||
metadata/_custom_type_script = "uid://dpnny2y808k71"
|
||||
|
@ -120,6 +120,7 @@ func play_shelf_game() -> void:
|
||||
if shelf_game_node.get_parent() != get_parent():
|
||||
get_parent().add_child(shelf_game_node)
|
||||
SceneManager.lock_player()
|
||||
_toggle_amb_sfx_volumn(true)
|
||||
|
||||
|
||||
func _on_shelf_game_exiting() -> void:
|
||||
@ -127,9 +128,11 @@ func _on_shelf_game_exiting() -> void:
|
||||
print("书架游戏 exiting")
|
||||
create_tween().tween_property(mask, "color:a", 0.0, 1.0).from(1.0)
|
||||
SceneManager.unlock_player()
|
||||
_toggle_amb_sfx_volumn(false)
|
||||
|
||||
|
||||
func _on_shelf_game_success() -> void:
|
||||
_toggle_amb_sfx_volumn(false)
|
||||
ArchiveManager.set_global_entry(&"c01_shelf_game_success", true)
|
||||
shelf_game_success = true
|
||||
_setup_weird_bookstore()
|
||||
@ -187,6 +190,7 @@ func play_envelope_game() -> void:
|
||||
if envelope_game_node.get_parent() != get_parent():
|
||||
get_parent().add_child.call_deferred(envelope_game_node)
|
||||
SceneManager.lock_player()
|
||||
_toggle_amb_sfx_volumn(true)
|
||||
|
||||
|
||||
func _on_envelope_game_exiting() -> void:
|
||||
@ -194,6 +198,7 @@ func _on_envelope_game_exiting() -> void:
|
||||
print("信封游戏 exiting")
|
||||
create_tween().tween_property(mask, "color:a", 0.0, 1.0).from(1.0)
|
||||
SceneManager.unlock_player()
|
||||
_toggle_amb_sfx_volumn(false)
|
||||
|
||||
|
||||
func _on_envelope_game_success() -> void:
|
||||
@ -203,6 +208,7 @@ func _on_envelope_game_success() -> void:
|
||||
envelope_game_success = true
|
||||
_check_portal()
|
||||
SceneManager.unlock_player()
|
||||
_toggle_amb_sfx_volumn(false)
|
||||
|
||||
|
||||
func pay_off_wage() -> void:
|
||||
@ -213,3 +219,10 @@ func pay_off_wage() -> void:
|
||||
|
||||
func _on_quit_inspect_coin() -> void:
|
||||
SceneManager.pop_os_with_str("c01_s08_获得袁大头后")
|
||||
|
||||
|
||||
func _toggle_amb_sfx_volumn(hold_down: bool) -> void:
|
||||
if hold_down:
|
||||
get_tree().call_group(GlobalConfig.GROUP_GROUND_SFX, "change_volumn_db", -7.0)
|
||||
else:
|
||||
get_tree().call_group(GlobalConfig.GROUP_GROUND_SFX, "reset_volumn_to_default")
|
||||
|
@ -44,7 +44,7 @@ script = ExtResource("2_0lque")
|
||||
[node name="环境音" type="AudioStreamPlayer" parent="Ground/AnimationPlayer" index="0"]
|
||||
process_mode = 1
|
||||
stream = ExtResource("3_0x288")
|
||||
volume_db = -8.0
|
||||
volume_db = 5.0
|
||||
autoplay = true
|
||||
bus = &"game_sfx"
|
||||
script = ExtResource("4_p6k3c")
|
||||
@ -56,7 +56,7 @@ metadata/_custom_type_script = "uid://rq6w1vuhuq1m"
|
||||
[node name="诡异环境音" type="AudioStreamPlayer" parent="Ground/AnimationPlayer" index="1"]
|
||||
process_mode = 1
|
||||
stream = ExtResource("5_eerhd")
|
||||
volume_db = -7.0
|
||||
volume_db = -4.0
|
||||
bus = &"game_sfx"
|
||||
script = ExtResource("4_p6k3c")
|
||||
mode = "场景背景音"
|
||||
@ -191,10 +191,7 @@ character = "小小蝶"
|
||||
player_movement_rect = Rect2(22, -158, 523, 316)
|
||||
|
||||
[node name="CameraFocusMarker" parent="Ground" index="6"]
|
||||
limit_left = 0
|
||||
limit_top = -158
|
||||
limit_right = 576
|
||||
limit_bottom = 158
|
||||
|
||||
[node name="FGSprite2D" parent="Ground/ParallaxForeground/FGParallaxLayer" index="0"]
|
||||
position = Vector2(-1, 22)
|
||||
|
@ -136,12 +136,6 @@ position = Vector2(447, 98)
|
||||
player_movement_rect = Rect2(66, -158, 429, 316)
|
||||
facing_direction = Vector2(-1, 0)
|
||||
|
||||
[node name="CameraFocusMarker" parent="Ground" index="6"]
|
||||
limit_left = 0
|
||||
limit_top = -158
|
||||
limit_right = 564
|
||||
limit_bottom = 158
|
||||
|
||||
[node name="FGSprite2D" parent="Ground/ParallaxForeground/FGParallaxLayer" index="0"]
|
||||
position = Vector2(45, -76)
|
||||
scale = Vector2(1.05, 1.05)
|
||||
|
@ -179,6 +179,7 @@ hook_method = "wood_puppet"
|
||||
position = Vector2(-108, -168)
|
||||
packed_scene = ExtResource("10_7mq0m")
|
||||
quit_closeup_on_cancel = false
|
||||
on_display_changed_volumn_db = -50.0
|
||||
action_key = 3
|
||||
first_interact_os_key = "c02_一楼戏台"
|
||||
|
||||
@ -343,10 +344,7 @@ player_movement_rect = Rect2(23, -158, 677, 316)
|
||||
current = true
|
||||
|
||||
[node name="CameraFocusMarker" parent="Ground" index="6"]
|
||||
limit_left = 0
|
||||
limit_top = -158
|
||||
limit_right = 716
|
||||
limit_bottom = 158
|
||||
|
||||
[node name="FGSprite2D" parent="Ground/ParallaxForeground/FGParallaxLayer" index="0"]
|
||||
position = Vector2(45, -9)
|
||||
|
@ -197,13 +197,11 @@ texture_scale = 0.15
|
||||
[node name="Closeup画" parent="Ground/DeployLayer" index="3" instance=ExtResource("10_a48k2")]
|
||||
position = Vector2(214, -19)
|
||||
packed_scene = ExtResource("11_mc126")
|
||||
pause_sfx_on_display = true
|
||||
enabled = false
|
||||
|
||||
[node name="Closeup讨厌他们" parent="Ground/DeployLayer" index="4" instance=ExtResource("10_a48k2")]
|
||||
position = Vector2(214, -19)
|
||||
packed_scene = ExtResource("16_nub1x")
|
||||
pause_sfx_on_display = true
|
||||
enabled = false
|
||||
|
||||
[node name="灯座Sprite2D" type="Sprite2D" parent="Ground/DeployLayer" index="5"]
|
||||
|
Loading…
Reference in New Issue
Block a user