closeup 黑屏转场效果

This commit is contained in:
cakipaul 2025-08-06 15:00:41 +08:00
parent c69e2283d6
commit fca8d83d1e
4 changed files with 12 additions and 4 deletions

View File

@ -493,8 +493,8 @@ func show_black_hand(play_sfx := true, queue_free_delay := 0.0) -> void:
var transition_scene = preload("uid://7dxvwqm53ugh")
func black_transition(half_duration := 0.7) -> void:
func black_transition(half_duration := 0.7, wait_time := 0.5) -> void:
var scene = transition_scene.instantiate()
scene.name = "Transition"
get_tree().current_scene.add_child(scene)
scene.run_effect(half_duration)
scene.run_effect(half_duration, wait_time)

View File

@ -5,12 +5,14 @@ func _ready() -> void:
layer = GlobalConfig.CANVAS_LAYER_EFFECT
func run_effect(half_duration := 0.7):
func run_effect(half_duration := 0.7, wait_time := 0.5, color := Color.BLACK):
if not is_node_ready():
await ready
var rect = $ColorRect as ColorRect
var tween = create_tween()
rect.color = color
rect.modulate.a = 0
tween.tween_property(rect, "modulate:a", 1.0, half_duration)
tween.tween_interval(wait_time)
tween.tween_property(rect, "modulate:a", 0.0, half_duration)
tween.tween_callback(queue_free)

View File

@ -11,6 +11,8 @@ signal exit(arg)
@export var on_display_hide_hud := false
@export var on_display_change_volumn := true
@export var on_display_changed_volumn_db := -7.0
# 转场效果 1s
@export var transition_effect := true
@export_tool_button("新建特写场景") var create_closeup_scene = _create_scene_with_script
# 在 exit 信号前,禁用 cancel
var _holding_cancel_before_exit := false
@ -42,6 +44,10 @@ func display() -> void:
SceneManager.lock_player(0, action_key)
# 展示时,禁用 sign_mark 的输入
sign_mark.pass_unhandled_input = true
# 转场效果
if transition_effect:
SceneManager.black_transition(0.5, 0.1)
await Util.wait(0.55)
current_child = packed_scene.instantiate()
add_child(current_child)
if current_child.has_signal("exit"):

View File

@ -218,7 +218,7 @@ range_item_cull_mask = 4
texture = ExtResource("8_mrltr")
[node name="Closeup戏台" parent="Ground/DeployLayer" index="7" instance=ExtResource("10_2yvhw")]
position = Vector2(305, -249)
position = Vector2(314, 30)
packed_scene = ExtResource("11_2yvhw")
on_display_hide_hud = true
first_interact_os_key = "c02_一楼戏台"