Merge remote-tracking branch 'origin/demo'
This commit is contained in:
commit
e5fba190f9
@ -21,6 +21,7 @@ func _ready() -> void:
|
||||
if Engine.is_editor_hint():
|
||||
_reload_groups()
|
||||
|
||||
|
||||
func _create_and_add_new_player(index: int) -> void:
|
||||
var sfx_player = RandomAudioStreamPlayer.new()
|
||||
sfx_player.bus = "game_sfx"
|
||||
@ -45,7 +46,7 @@ func stop_stream(stream: AudioStream, duration := 1.0) -> void:
|
||||
sfx_players.remove_at(i)
|
||||
_create_and_add_new_player(i)
|
||||
var tween = create_tween()
|
||||
tween.tween_property(player, "volume_linear", 0.0, duration)
|
||||
tween.tween_property(player, "volume_linear", 0.01, duration)
|
||||
tween.tween_callback(player.queue_free)
|
||||
else:
|
||||
player.stop()
|
||||
@ -87,7 +88,7 @@ func stop_bgm_music(music_name: StringName, ease_duration := 3.0) -> void:
|
||||
audio_player.queue_free()
|
||||
else:
|
||||
var tween = create_tween()
|
||||
tween.tween_property(audio_player, "volume_linear", 0.0, ease_duration)
|
||||
tween.tween_property(audio_player, "volume_linear", 0.01, ease_duration)
|
||||
tween.tween_callback(audio_player.queue_free)
|
||||
bgm_dict.erase(music_name)
|
||||
else:
|
||||
|
@ -63,6 +63,11 @@ const DIALOG_IGNORE_INPUT = "ignore_input"
|
||||
# memory layer: 30
|
||||
const DIALOG_MEM_LAYER = "mem_layer"
|
||||
|
||||
# groups
|
||||
const GROUP_GROUND_SFX := "ground_sfx"
|
||||
const GROUP_GROUND_SFX2D := "ground_sfx2d"
|
||||
|
||||
|
||||
const CHARACTER_COLOR_MAP = {
|
||||
"default": Color.LIGHT_SEA_GREEN,
|
||||
"吕萍": Color.ORANGE,
|
||||
|
@ -12,6 +12,7 @@ const META_ORIGINAL_STREAM = &"original_stream"
|
||||
# TODO BGM 过程抑制场景音效;场景音效随玩家运动呼吸 (结合 Sfx2D)
|
||||
# 感应玩家移动:装饰音
|
||||
var default_db := 0.0
|
||||
var default_linear := 1.0
|
||||
|
||||
# 只有 场景背景音 生效
|
||||
var scene_loop := true
|
||||
@ -21,6 +22,7 @@ var scene_sense_player_mov := false
|
||||
func _ready() -> void:
|
||||
bus = &"game_sfx"
|
||||
default_db = volume_db
|
||||
default_linear = volume_linear
|
||||
if Engine.is_editor_hint():
|
||||
return
|
||||
# 记录原 stream
|
||||
@ -104,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.0, duration)
|
||||
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
|
||||
|
||||
|
||||
@ -164,3 +166,14 @@ func _get(property: StringName) -> Variant:
|
||||
return scene_sense_player_mov
|
||||
return null
|
||||
|
||||
|
||||
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 reset_volumn_to_default(duration := 1.0) -> void:
|
||||
var tween = create_tween()
|
||||
tween.tween_property(self, "volume_linear", default_linear, duration)
|
@ -18,6 +18,7 @@ class_name Sfx2D extends AudioStreamPlayer2D
|
||||
|
||||
var timer: Timer
|
||||
var default_db := 0.0
|
||||
var default_linear := 1.0
|
||||
|
||||
func _ready() -> void:
|
||||
bus = &"game_sfx"
|
||||
@ -25,6 +26,7 @@ func _ready() -> void:
|
||||
if Engine.is_editor_hint():
|
||||
return
|
||||
default_db = volume_db
|
||||
default_linear = volume_linear
|
||||
timer = Timer.new()
|
||||
timer.autostart = autoplay and loop and loop_round_time > 0.0 and not Engine.is_editor_hint()
|
||||
timer.one_shot = false
|
||||
@ -43,7 +45,6 @@ func _on_ground_transition_pre_paused():
|
||||
easing_kill(1.0)
|
||||
|
||||
|
||||
|
||||
func _on_timer_timeout() -> void:
|
||||
if not loop or loop_round_time <= 0.0:
|
||||
timer.stop()
|
||||
@ -73,8 +74,21 @@ func easing_kill(duration: float = 2.0) -> Tween:
|
||||
var tween = create_tween()
|
||||
tween.bind_node(self)
|
||||
if playing:
|
||||
tween.tween_property(self, "volume_linear", 0.0, duration)
|
||||
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
|
||||
|
||||
|
||||
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 reset_volumn_to_default(duration := 1.0) -> void:
|
||||
var tween = create_tween()
|
||||
tween.tween_property(self, "volume_linear", default_linear, duration)
|
@ -8,6 +8,8 @@ signal exit(arg)
|
||||
|
||||
@export var packed_scene: PackedScene
|
||||
@export var quit_closeup_on_cancel := true
|
||||
@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
|
||||
# 在 exit 信号前,禁用 cancel
|
||||
var _holding_cancel_before_exit := false
|
||||
@ -31,6 +33,9 @@ func display() -> void:
|
||||
if current_child:
|
||||
return
|
||||
if packed_scene:
|
||||
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
|
||||
@ -44,8 +49,10 @@ func display() -> void:
|
||||
|
||||
func _exit(arg = null):
|
||||
if current_child:
|
||||
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()
|
||||
if current_child:
|
||||
remove_child(current_child)
|
||||
current_child.queue_free()
|
||||
current_child = null
|
||||
|
@ -75,6 +75,7 @@ func _ready() -> void:
|
||||
return
|
||||
_setup_scene()
|
||||
_setup_runtime()
|
||||
_arrange_nodes_to_group(self)
|
||||
|
||||
|
||||
func _handle_restart() -> void:
|
||||
@ -101,6 +102,17 @@ func _setup_runtime() -> void:
|
||||
SceneManager.toggle_hud_display(display_hud)
|
||||
|
||||
|
||||
func _arrange_nodes_to_group(parent: Node) -> void:
|
||||
if not parent:
|
||||
return
|
||||
for c in parent.get_children():
|
||||
_arrange_nodes_to_group(c)
|
||||
if c is Sfx:
|
||||
c.add_to_group(GlobalConfig.GROUP_GROUND_SFX)
|
||||
elif c is Sfx2D:
|
||||
c.add_to_group(GlobalConfig.GROUP_GROUND_SFX2D)
|
||||
|
||||
|
||||
func _restart_from_main() -> void:
|
||||
# _enter_tree, wait for ready
|
||||
await ready
|
||||
|
@ -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)
|
||||
|
@ -89,7 +89,7 @@ func _on_ground_ready() -> void:
|
||||
$"../DeployLayer/portal_5".enabled = false
|
||||
|
||||
|
||||
if ArchiveManager.get_global_value(&"c02_show_grounded_coins") and EventManager.get_chapter_stage() < 3:
|
||||
if ArchiveManager.get_global_value(&"c02_show_grounded_coins") and EventManager.get_chapter_stage() <= 2:
|
||||
# 奠字 + 纸钱
|
||||
$"../DeployLayer/新背景_奠".visible = true
|
||||
|
||||
|
@ -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)
|
||||
|
@ -185,6 +185,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_一楼戏台"
|
||||
|
||||
@ -349,10 +350,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)
|
||||
|
@ -30,8 +30,8 @@ func _on_ground_ready() -> void:
|
||||
ambush_lookback = $"../DeployLayer/Ambush回看洞口"
|
||||
gaslight = $"../DeployLayer/灯座Sprite2D/煤油灯"
|
||||
boxcat_portal = $"../DeployLayer/portal_1"
|
||||
# 0默认 1拿了麻将 2偷听结束 3已爬出
|
||||
if data.hole_interacted_times >= 3:
|
||||
# 0默认 1偷听结束 2已爬出 (不再拿麻将)
|
||||
if data.hole_interacted_times >= 2:
|
||||
setup_rect_after_entered()
|
||||
else:
|
||||
color_mask.color.a = 1.0
|
||||
@ -88,8 +88,6 @@ func hole_interacted():
|
||||
print("hole_interacted_times=", times)
|
||||
|
||||
if times == 0:
|
||||
SceneManager.enable_prop_item("prop_麻将")
|
||||
elif times == 1:
|
||||
# 注意:每种情况结束后,都需要将 interacting 设置为 false
|
||||
interacting = true
|
||||
eavesdrop_start()
|
||||
|
@ -5,6 +5,7 @@
|
||||
[ext_resource type="Texture2D" uid="uid://v3sj36aijq5b" path="res://asset/art/scene/c03/s04_瞎子新卧室/bg_瞎子卧室.png" id="3_iares"]
|
||||
[ext_resource type="Script" uid="uid://cpejxlfni6n52" path="res://manager/audio_manager/vibe_sfx.gd" id="3_quq80"]
|
||||
[ext_resource type="Texture2D" uid="uid://v3sj36aijq5b" path="res://asset/art/scene/c02/s08_瞎子卧室/bg_瞎子卧室.png" id="3_iares"]
|
||||
[ext_resource type="AudioStream" uid="uid://b2mudqvq1dmng" path="res://asset/audio/sfx/环境音/白噪音/白噪声房间里1.ogg" id="3_nnqdd"]
|
||||
[ext_resource type="Script" uid="uid://rq6w1vuhuq1m" path="res://scene/entity/audio/sfx.gd" id="3_t3h08"]
|
||||
[ext_resource type="PackedScene" uid="uid://61pis75a8fdq" path="res://scene/entity/portal.tscn" id="4_1ws4i"]
|
||||
[ext_resource type="Texture2D" uid="uid://vqyhgyka3sfo" path="res://asset/art/scene/c03/s04_瞎子新卧室/瞎子卧室前景.png" id="4_gx8oy"]
|
||||
@ -13,7 +14,6 @@
|
||||
[ext_resource type="Texture2D" uid="uid://7ay1ttob8qwm" path="res://asset/art/scene/c03/s04_瞎子新卧室/e_床板.png" id="5_vjjde"]
|
||||
[ext_resource type="AudioStream" uid="uid://c26x8f18w6is0" path="res://asset/audio/sfx/旧版/c02/撞到柜子.mp3" id="6_nnqdd"]
|
||||
[ext_resource type="Texture2D" uid="uid://vqyhgyka3sfo" path="res://asset/art/scene/c02/s08_瞎子卧室/瞎子卧室前景.png" id="4_gx8oy"]
|
||||
[ext_resource type="AudioStream" uid="uid://o57tyriodr0c" path="res://asset/audio/sfx/环境音/白噪音/白噪声房间里2.ogg" id="4_quq80"]
|
||||
[ext_resource type="AudioStream" uid="uid://dk3e1w3n2snur" path="res://asset/audio/sfx/旧版/c02/纸人出现.ogg" id="5_0qeqe"]
|
||||
[ext_resource type="Texture2D" uid="uid://b5pwb4fm46sad" path="res://asset/art/scene/c02/s08_瞎子卧室/e_墙上纸张.png" id="5_f6mma"]
|
||||
[ext_resource type="Texture2D" uid="uid://7ay1ttob8qwm" path="res://asset/art/scene/c02/s08_瞎子卧室/e_床板.png" id="5_vjjde"]
|
||||
@ -120,7 +120,7 @@ script = ExtResource("2_m4uw8")
|
||||
|
||||
[node name="Sfx背景音" type="AudioStreamPlayer" parent="Ground/AnimationPlayer" index="0"]
|
||||
process_mode = 1
|
||||
stream = ExtResource("4_quq80")
|
||||
stream = ExtResource("3_nnqdd")
|
||||
volume_db = -5.0
|
||||
autoplay = true
|
||||
bus = &"game_sfx"
|
||||
|
Loading…
Reference in New Issue
Block a user