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

36 lines
700 B
GDScript3
Raw Normal View History

2024-04-12 11:06:25 +08:00
extends Window
var current_focus: CanvasItem
2024-04-17 15:26:37 +08:00
const NodeUtils = preload("res://util/NodeUtils.gd")
2024-04-12 11:06:25 +08:00
func _on_key_focus_entered(node):
current_focus = node
print("node : ", current_focus.name, " focus")
2024-04-17 15:26:37 +08:00
2024-04-12 11:06:25 +08:00
func _on_button_pressed():
if current_focus == null:
print("请选择钥匙")
else:
print("使用钥匙:", current_focus.name)
current_focus.hide_key()
2024-04-17 15:26:37 +08:00
if(current_focus.name.contains('LCB')):
$"../LCB".shouHandleKey()
2024-04-12 11:06:25 +08:00
func _on_close_requested():
print("close req")
self.hide()
func _on_show_button_pressed():
2024-04-16 09:46:51 +08:00
print('on_show_button_pressed');
2024-04-12 11:06:25 +08:00
self.show()
2024-04-17 15:26:37 +08:00
2024-04-12 11:06:25 +08:00
2024-04-17 15:26:37 +08:00
func shouAllKeys():
NodeUtils.make_node_and_descendants_visible($PanelContainer/VBoxContainer/GridContainer)
2024-04-12 11:06:25 +08:00