extends Control @export_enum("线索", "物品", "回忆") var current_type := "线索" @export var root: CanvasLayer @onready var bag_btn = $"Bag" as TextureButton @onready var note_btn = $"Note" as TextureButton @onready var memory_btn = $"Mem" as TextureButton @onready var sfx_open = $"SfxOpen" as Sfx @onready var sfx_close = $"SfxClose" as Sfx func _ready() -> void: sfx_open.play() match current_type: "线索": note_btn.disabled = true note_btn.mouse_default_cursor_shape = Control.CURSOR_ARROW note_btn.modulate = Color.WHITE_SMOKE note_btn.get_node("Label").set("theme_override_colors/font_color", Color.WHITE_SMOKE) "物品": bag_btn.disabled = true bag_btn.mouse_default_cursor_shape = Control.CURSOR_ARROW bag_btn.modulate = Color.WHITE_SMOKE bag_btn.get_node("Label").set("theme_override_colors/font_color", Color.WHITE_SMOKE) "回忆": memory_btn.disabled = true memory_btn.mouse_default_cursor_shape = Control.CURSOR_ARROW memory_btn.modulate = Color.WHITE_SMOKE memory_btn.get_node("Label").set("theme_override_colors/font_color", Color.WHITE_SMOKE) if current_type != "物品": bag_btn.pressed.connect(_on_tab_bag_pressed) bag_btn.mouse_entered.connect(_toggle_hover.bind(true, bag_btn)) bag_btn.mouse_exited.connect(_toggle_hover.bind(false, bag_btn)) if current_type != "线索": note_btn.pressed.connect(_on_tab_note_pressed) note_btn.mouse_entered.connect(_toggle_hover.bind(true, note_btn)) note_btn.mouse_exited.connect(_toggle_hover.bind(false, note_btn)) if current_type != "回忆": memory_btn.pressed.connect(_on_tab_memory_pressed) memory_btn.mouse_entered.connect(_toggle_hover.bind(true, memory_btn)) memory_btn.mouse_exited.connect(_toggle_hover.bind(false, memory_btn)) func _toggle_hover(hover: bool, btn: TextureButton) -> void: var label = btn.get_node("Label") var tween = create_tween() if hover: # tween y -> -10px tween.tween_property(btn, "position:y", -3.0, 0.2) # label font color tween.parallel().tween_property( label, "theme_override_colors/font_color", Color.DARK_GRAY, 0.2 ) else: # y -> 0 tween.tween_property(btn, "position:y", 0.0, 0.2) # label font color tween.parallel().tween_property(label, "theme_override_colors/font_color", Color.BLACK, 0.2) func _on_tab_note_pressed(): if GlobalConfig.DEBUG: print("Tab Note Pressed") SceneManager.show_note() root.quit() func _on_tab_bag_pressed(): if GlobalConfig.DEBUG: print("Tab Bag Pressed") SceneManager.show_bag() root.quit() func _on_tab_memory_pressed(): if GlobalConfig.DEBUG: print("Tab Mem Pressed") SceneManager.show_memory() root.quit() func _exit_tree() -> void: sfx_close.global_play() # func _unhandled_input(event: InputEvent) -> void: # if event.is_action_pressed("memory") and current_type != "回忆": # get_viewport().set_input_as_handled() # SceneManager.show_memory()