2025-07-09 15:04:08 +00:00
|
|
|
extends CanvasLayer
|
|
|
|
|
|
|
|
@onready var bg = $BG as TextureRect
|
2025-07-16 21:44:00 +00:00
|
|
|
@onready var braid = %"HoverBraid" as CanvasItem
|
|
|
|
|
2025-07-09 15:04:08 +00:00
|
|
|
|
2025-07-15 04:56:11 +00:00
|
|
|
signal exit(success: bool)
|
|
|
|
|
2025-07-09 15:04:08 +00:00
|
|
|
|
|
|
|
func _ready() -> void:
|
|
|
|
layer = GlobalConfig.CANVAS_LAYER_LITTLE_GAME
|
2025-07-15 04:56:11 +00:00
|
|
|
# 两张纸钱点击事件
|
|
|
|
%"Draggable纸钱1".picked.connect(_on_paper_coin_picked, CONNECT_ONE_SHOT)
|
|
|
|
%"Draggable纸钱2".picked.connect(_on_paper_coin_picked, CONNECT_ONE_SHOT)
|
2025-07-16 21:44:00 +00:00
|
|
|
braid.interacted.connect(_on_braid_interacted, CONNECT_ONE_SHOT)
|
2025-07-15 04:56:11 +00:00
|
|
|
_check_if_notify_to_use_prop()
|
|
|
|
# 如果用过剪刀,则直接展示后脑勺
|
2025-07-16 21:44:00 +00:00
|
|
|
# 0:初始化 1:已剪下 2:演出结束
|
|
|
|
var stage = EventManager.get_stage("c03_s03_laizi_braid")
|
|
|
|
if stage == 1:
|
|
|
|
_braid_cutting_show()
|
|
|
|
elif stage > 1:
|
2025-07-15 04:56:11 +00:00
|
|
|
$"头".hide()
|
2025-07-16 21:44:00 +00:00
|
|
|
$"后脑勺".hide()
|
2025-07-15 04:56:11 +00:00
|
|
|
$"头受伤".hide()
|
|
|
|
|
2025-07-16 21:44:00 +00:00
|
|
|
|
2025-07-15 04:56:11 +00:00
|
|
|
func _on_paper_coin_picked(_node = null) -> void:
|
|
|
|
if GlobalFunctor.c03_get_paper_coin():
|
|
|
|
await SceneManager.get_inspector().quit_and_hidden
|
|
|
|
_check_if_notify_to_use_prop()
|
|
|
|
|
|
|
|
|
|
|
|
func _check_if_notify_to_use_prop() -> void:
|
2025-07-15 11:44:55 +00:00
|
|
|
if EventManager.get_stage("c03_s03_papercoin1") > 0 and EventManager.get_stage("c03_s03_papercoin2") > 0:
|
|
|
|
if EventManager.get_stage("c03_s03_laizi_braid") > 0:
|
2025-07-15 04:56:11 +00:00
|
|
|
return
|
|
|
|
elif SceneManager.has_prop("prop_剪刀"):
|
|
|
|
SceneManager.pop_center_notification("ui_center_notify_use_prop")
|
|
|
|
else:
|
|
|
|
SceneManager.pop_center_notification("ui_center_notify_lack_of_prop")
|
|
|
|
|
2025-07-09 15:04:08 +00:00
|
|
|
|
|
|
|
func _unhandled_input(event: InputEvent) -> void:
|
|
|
|
if event.is_action_pressed("interact"):
|
|
|
|
get_viewport().set_input_as_handled()
|
2025-07-15 04:56:11 +00:00
|
|
|
_try_interact()
|
|
|
|
|
|
|
|
var using_scissors = false
|
|
|
|
|
|
|
|
# 尝试使用剪刀进行互动
|
|
|
|
func _try_interact() -> void:
|
|
|
|
# 纸钱还没拿完
|
2025-07-15 11:44:55 +00:00
|
|
|
if EventManager.get_stage("c03_s03_papercoin1") == 0 or EventManager.get_stage("c03_s03_papercoin2") == 0:
|
2025-07-15 04:56:11 +00:00
|
|
|
return
|
|
|
|
if SceneManager.get_current_prop() != "prop_剪刀":
|
|
|
|
SceneManager.get_prop_hud().on_toggle_invalid_prop()
|
|
|
|
return
|
|
|
|
if using_scissors:
|
|
|
|
return
|
|
|
|
using_scissors = true
|
2025-07-16 21:44:00 +00:00
|
|
|
var closeup = get_parent() as Closeup2D
|
|
|
|
# 禁用 cancel to quit
|
|
|
|
closeup.hold_cancel_before_exit()
|
|
|
|
await Util.wait(0.5)
|
|
|
|
# 飞针
|
|
|
|
$AnimationPlayer.play("cutting_overhead")
|
|
|
|
# 抖动
|
|
|
|
Util.shake_layer(self, 0.3)
|
2025-07-15 04:56:11 +00:00
|
|
|
# TODO
|
|
|
|
SceneManager.pop_debug_dialog_info("音效", "使用剪刀(惊悚)")
|
|
|
|
$"头".hide()
|
2025-07-16 21:44:00 +00:00
|
|
|
await Util.wait(5.0)
|
|
|
|
$"后脑勺".show()
|
2025-07-15 04:56:11 +00:00
|
|
|
$"头受伤".hide()
|
2025-07-16 21:44:00 +00:00
|
|
|
# TODO
|
|
|
|
SceneManager.pop_debug_dialog_info("音效", "纸人突然转头(咔嚓)")
|
|
|
|
|
|
|
|
|
|
|
|
# 剪下辫子
|
|
|
|
func _on_braid_interacted() -> void:
|
|
|
|
# 剪刀变为重要物品
|
2025-07-15 04:56:11 +00:00
|
|
|
SceneManager.disable_prop_item("prop_剪刀")
|
2025-07-16 21:44:00 +00:00
|
|
|
SceneManager.enable_important_item("prop_剪刀", false)
|
|
|
|
_braid_cutting_show()
|
|
|
|
|
|
|
|
|
|
|
|
# 播放演出
|
|
|
|
func _braid_cutting_show() -> void:
|
|
|
|
$"头".hide()
|
|
|
|
$"头受伤".hide()
|
|
|
|
$"后脑勺".hide()
|
|
|
|
# SceneManager.enable_prop_item("prop_剪下的辫子")
|
|
|
|
await Util.wait(2.0)
|
|
|
|
$AnimationPlayer.play("light_and_canvas_flipping")
|
|
|
|
await Util.wait(1.5)
|
|
|
|
DialogueManager.show_dialogue_balloon(GlobalConfig.DIALOG_C03, "c03_s03_理发店演出1")
|
|
|
|
await DialogueManager.dialogue_ended
|
|
|
|
# 退出,播放剪辫子演出
|
|
|
|
exit.emit(true)
|