2024-04-12 11:06:25 +08:00
|
|
|
extends Window
|
|
|
|
|
|
|
|
var current_focus: CanvasItem
|
|
|
|
|
2024-04-28 15:51:51 +08:00
|
|
|
## 打开的面板类型枚举
|
|
|
|
enum WindowType{
|
|
|
|
LCB,
|
|
|
|
PSL,
|
|
|
|
JJTC,
|
|
|
|
}
|
|
|
|
|
|
|
|
var current_together_window: WindowType
|
|
|
|
|
|
|
|
var current_lcb_keyname: String=''
|
|
|
|
|
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():
|
2024-04-28 15:51:51 +08:00
|
|
|
if current_focus == null or (current_together_window==WindowType.LCB and (!current_focus.name.contains('LCB') or current_lcb_keyname)) or (current_together_window==WindowType.PSL and (!current_focus.name.contains('PSL') and !current_focus.name.contains('HSJC') )) or (current_together_window==WindowType.JJTC and !current_focus.name.contains('JJTC')):
|
2024-04-12 11:06:25 +08:00
|
|
|
print("请选择钥匙")
|
|
|
|
else:
|
|
|
|
print("使用钥匙:", current_focus.name)
|
2024-04-28 15:51:51 +08:00
|
|
|
if current_focus.name.contains('LCB') :
|
|
|
|
$"../LCB".shouHandleKey(current_focus.name)
|
2024-04-23 17:20:15 +08:00
|
|
|
$"../LCB".grab_focus()
|
2024-04-28 15:51:51 +08:00
|
|
|
current_lcb_keyname = current_focus.name
|
|
|
|
elif current_focus.name.contains('PSL'):
|
2024-04-22 15:32:19 +08:00
|
|
|
$"../psl".shouPSLAllowHandleKey()
|
2024-04-23 17:20:15 +08:00
|
|
|
$"../psl".grab_focus()
|
2024-04-28 15:51:51 +08:00
|
|
|
elif current_focus.name.contains('HSJC'):
|
2024-04-26 16:54:17 +08:00
|
|
|
$"../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-28 15:51:51 +08:00
|
|
|
current_focus.hide_key()
|
|
|
|
$AudioStreamPlayer.play()
|
|
|
|
|
|
|
|
func showKeyAfterRemoveKey(keyName):
|
|
|
|
$PanelContainer/VBoxContainer/GridContainer.find_child(keyName).show_key()
|
|
|
|
current_lcb_keyname = ''
|
2024-04-12 11:06:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
func _on_close_requested():
|
|
|
|
self.hide()
|
|
|
|
|
|
|
|
|
2024-04-28 15:51:51 +08:00
|
|
|
func onShowWindow(togetherWindow:WindowType,lcbKeyName = ''):
|
|
|
|
current_together_window = togetherWindow
|
|
|
|
current_lcb_keyname = lcbKeyName
|
2024-04-12 11:06:25 +08:00
|
|
|
self.show()
|