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() $AudioStreamPlayer.play() if(current_focus.name.contains('LCB')): $"../LCB".shouHandleKey() $"../LCB".grab_focus() elif (current_focus.name.contains('PSL')): $"../psl".shouPSLAllowHandleKey() $"../psl".grab_focus() elif (current_focus.name.contains('HSJC')): $"../psl".shouInterlockReleaseSwitchHandleKey() $"../psl".grab_focus() func _on_close_requested(): self.hide() func _on_show_button_pressed(): print('on_show_button_pressed'); self.show() func shouAllKeys(): make_node_visible($PanelContainer/VBoxContainer/GridContainer) func make_node_visible(node: Node): node.visible = true node.modulate.a = 255 for child in node.get_children(): make_node_visible(child)