xiandie/scene/ground/script/c02/花名册.gd
2025-08-12 22:17:03 +08:00

46 lines
1.4 KiB
GDScript

extends CanvasLayer
@onready var button = $TextureButton as TextureButton
var texture_dict_c02 = {
"0": preload("res://asset/art/scene/c02/s04_保卫科/花名册/花名册封皮.png"),
"1": preload("res://asset/art/scene/c02/s04_保卫科/花名册/翻开页.png"),
}
var texture_dict_c03 = {
"0": preload("res://asset/art/scene/c02/s04_保卫科/花名册/花名册封皮.png"),
"1": preload("res://asset/art/scene/c02/s04_保卫科/花名册/翻开页_第二章.png"),
}
var click_count = 0
func _ready() -> void:
$"Sfx翻页".play()
layer = GlobalConfig.CANVAS_LAYER_LITTLE_GAME
button.pressed.connect(_on_button_pressed)
func _on_button_pressed() -> void:
$"Sfx翻页".play()
click_count += 1
if click_count == 1:
if EventManager.get_chapter_stage() <= 2:
button.texture_normal = texture_dict_c02["1"]
$ContentInspector.visible = true
else:
button.texture_normal = texture_dict_c03["1"]
$ContentInspectorC03.visible = true
if not ArchiveManager.get_global_value("c03_prop_paper_tounge"):
var btn = $"Draggable舌头"
btn.show()
btn.picked.connect(_on_tounge_picked, CONNECT_ONE_SHOT)
button.set_anchors_preset(Control.PRESET_CENTER)
button.disabled = true
button.mouse_filter = Control.MOUSE_FILTER_IGNORE
func _on_tounge_picked(_node) -> void:
$"Draggable舌头".hide()
ArchiveManager.set_global_entry("c03_prop_paper_tounge", true)
SceneManager.enable_prop_item("prop_纸舌头")