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

50 lines
1.1 KiB
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")
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-25 09:46:41 +08:00
$AudioStreamPlayer.play()
2024-04-17 15:26:37 +08:00
if(current_focus.name.contains('LCB')):
$"../LCB".shouHandleKey()
2024-04-23 17:20:15 +08:00
$"../LCB".grab_focus()
2024-04-22 15:32:19 +08:00
elif (current_focus.name.contains('PSL')):
$"../psl".shouPSLAllowHandleKey()
2024-04-23 17:20:15 +08:00
$"../psl".grab_focus()
2024-04-26 16:54:17 +08:00
elif (current_focus.name.contains('HSJC')):
$"../psl".shouInterlockReleaseSwitchHandleKey()
$"../psl".grab_focus()
2024-04-28 11:21:59 +08:00
elif (current_focus.name.contains('JJTC')):
$"../jjtc".shouJJTCKey()
$"../jjtc".grab_focus()
2024-04-12 11:06:25 +08:00
func _on_close_requested():
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():
2024-04-23 09:33:07 +08:00
make_node_visible($PanelContainer/VBoxContainer/GridContainer)
2024-04-19 17:48:20 +08:00
2024-04-23 09:33:07 +08:00
func make_node_visible(node: Node):
2024-04-19 17:48:20 +08:00
node.visible = true
node.modulate.a = 255
for child in node.get_children():
2024-04-23 09:33:07 +08:00
make_node_visible(child)
2024-04-12 11:06:25 +08:00