godot-psd-training/UI/station_keys/station_keys_window.gd

44 lines
861 B
GDScript3
Raw Normal View History

2024-04-12 11:06:25 +08:00
extends Window
var current_focus: CanvasItem
func _on_key_focus_entered(node):
current_focus = node
print("node : ", current_focus.name, " focus")
func _on_button_pressed():
if current_focus == null:
print("请选择钥匙")
else:
print("使用钥匙:", current_focus.name)
current_focus.hide_key()
2024-04-12 15:01:34 +08:00
var screenDoor4=find_child_by_name($"../platform",'screenDoor4')
screenDoor4.closeScreenDoor()
2024-04-12 11:06:25 +08:00
func _on_close_requested():
print("close req")
self.hide()
func _on_show_button_pressed():
self.show()
func _on_psl_button_pressed() -> void:
self.show()
func find_child_by_name(parent_node, target_name):
if parent_node.name == target_name:
return parent_node
for child in parent_node.get_children():
var found_node = find_child_by_name(child, target_name)
if found_node != null:
return found_node
return null