Merge branch 'main' of https://gitea.joylink.club/joylink/godot-psd-training into main
This commit is contained in:
commit
1de7964932
@ -26,7 +26,9 @@ func _input(event):
|
||||
var flag2 = test_enter()
|
||||
if flag2 and event.button_index == MOUSE_BUTTON_LEFT:
|
||||
# 处理点击事件
|
||||
$"..".allClickJJTCSignal.emit('JJTCLeftRotate')
|
||||
$"..".allClickJJTCSignal.emit('JJTCLeftRotate',$"..")
|
||||
if !$"..".allowHandle :
|
||||
return
|
||||
$"../JJTC_Right_Rotate".hide()
|
||||
self.hide()
|
||||
$"../JJTC_Key".hide()
|
||||
|
@ -27,7 +27,9 @@ func _input(event):
|
||||
if flag2 and event.button_index == MOUSE_BUTTON_LEFT:
|
||||
# 处理点击事件
|
||||
#self.modulate = Color(0, 1, 1, 1);$".."
|
||||
$"..".allClickJJTCSignal.emit('JJTCRightRotate')
|
||||
$"..".allClickJJTCSignal.emit('JJTCRightRotate',$"..")
|
||||
if !$"..".allowHandle :
|
||||
return
|
||||
$"../PanelContainer/VBoxContainer/MarginContainer/JJTC_Box".jjtc_state = $"../PanelContainer/VBoxContainer/MarginContainer/JJTC_Box".JJTC_STATE.OPEN
|
||||
$"../JJTC_Box_Voice".play()
|
||||
$"../JJTC_Key".hide()
|
||||
|
@ -1,9 +1,14 @@
|
||||
extends Window
|
||||
|
||||
##是否允许操作
|
||||
var allowHandle :bool = true
|
||||
|
||||
func _on_jjtc_click_jjtc_signal():
|
||||
allClickJJTCSignal.emit('JJTC',$".")
|
||||
if !allowHandle :
|
||||
return
|
||||
self.show()
|
||||
$"../stationKeys".onShowWindow(StationKeyWindow.WindowType.JJTC)
|
||||
$"..".allClickPlatformSignal.emit('JJTC')
|
||||
|
||||
|
||||
func _on_close_requested():
|
||||
@ -23,7 +28,9 @@ func shouJJTCKey():
|
||||
|
||||
func _on_jjtc_button_gui_input(event):
|
||||
if event.button_mask == MouseButtonMask.MOUSE_BUTTON_MASK_LEFT:
|
||||
allClickJJTCSignal.emit('JJTCButton')
|
||||
allClickJJTCSignal.emit('JJTCButton',$".")
|
||||
if !allowHandle :
|
||||
return
|
||||
|
||||
|
||||
func _on_jjtc_button_mouse_entered():
|
||||
|
@ -27,6 +27,9 @@ func _input(event):
|
||||
if flag2 and event.button_index == MOUSE_BUTTON_LEFT:
|
||||
# 处理点击事件
|
||||
#self.modulate = Color(0, 1, 1, 1);$".."
|
||||
$"..".allClickLCBSignal.emit($"..".title+"LeftRotate",$"..")
|
||||
if !$"..".allowHandle :
|
||||
return
|
||||
if $"..".knob_state == $"..".KNOB_STATE.AUTO:
|
||||
$"../LCBRotateAnimation".play("AutoToIsolate", -1, 10)
|
||||
$"..".change_knob_state($"..".KNOB_STATE.ISOLATE)
|
||||
@ -36,4 +39,3 @@ func _input(event):
|
||||
elif $"..".knob_state == $"..".KNOB_STATE.OPEN:
|
||||
$"../LCBRotateAnimation".play("OpenToClose", -1, 10)
|
||||
$"..".change_knob_state($"..".KNOB_STATE.CLOSE)
|
||||
$"..".allClickLCBSignal.emit($"..".title+"LeftRotate", $"..".knob_state)
|
||||
|
@ -27,6 +27,9 @@ func _input(event):
|
||||
if flag2 and event.button_index == MOUSE_BUTTON_LEFT:
|
||||
# 处理点击事件
|
||||
#self.modulate = Color(0, 1, 1, 1);$".."
|
||||
$"..".allClickLCBSignal.emit($"..".title+"RightRotate",$"..")
|
||||
if !$"..".allowHandle :
|
||||
return
|
||||
if $"..".knob_state == $"..".KNOB_STATE.AUTO:
|
||||
$"../LCBRotateAnimation".play("AutoToClose", -1, 10)
|
||||
$"..".change_knob_state($"..".KNOB_STATE.CLOSE)
|
||||
@ -36,4 +39,3 @@ func _input(event):
|
||||
elif $"..".knob_state == $"..".KNOB_STATE.CLOSE:
|
||||
$"../LCBRotateAnimation".play("CloseToOpen", -1, 10)
|
||||
$"..".change_knob_state($"..".KNOB_STATE.OPEN)
|
||||
$"..".allClickLCBSignal.emit($"..".title+"RightRotate", $"..".knob_state)
|
||||
|
@ -3,15 +3,20 @@ extends Window
|
||||
##lcb面板
|
||||
class_name LcbWindow
|
||||
|
||||
##是否允许操作
|
||||
var allowHandle :bool = true
|
||||
|
||||
var currenScreenDoor:ScreenDoor=null
|
||||
func _on_screen_door_click_lcb_signal(screenDoor: Variant) -> void:
|
||||
allClickLCBSignal.emit(self.title,$".")
|
||||
if !allowHandle :
|
||||
return
|
||||
var screenDoorName=String(screenDoor.name)
|
||||
self.title='LCB'+screenDoorName[screenDoorName.length() - 1]
|
||||
self.show()
|
||||
$"../stationKeys".onShowWindow(StationKeyWindow.WindowType.LCB,screenDoor.lcbKey.keyName)
|
||||
currenScreenDoor=screenDoor
|
||||
resetState(screenDoor.lcbKey)
|
||||
$"..".allClickPlatformSignal.emit(self.title,screenDoor)
|
||||
|
||||
|
||||
|
||||
@ -87,10 +92,12 @@ func _on_open_key_window_mouse_exited() -> void:
|
||||
##拔钥匙相关
|
||||
func _on_texture_rect_2_gui_input(event: InputEvent) -> void:
|
||||
if event.button_mask == MouseButtonMask.MOUSE_BUTTON_MASK_LEFT:
|
||||
allClickLCBSignal.emit('removeKeyOfWindow'+self.title,$".")
|
||||
if !allowHandle :
|
||||
return
|
||||
hideHandleKey()
|
||||
$"../stationKeys".showKeyAfterRemoveKey(currenScreenDoor.lcbKey.keyName)
|
||||
currenScreenDoor.lcbKey.keyName = ''
|
||||
allClickLCBSignal.emit('removeKeyOfWindow'+self.title)
|
||||
|
||||
|
||||
func _on_texture_rect_2_mouse_entered() -> void:
|
||||
|
@ -26,4 +26,6 @@ func _input(event):
|
||||
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
|
||||
var flag2 = test_enter()
|
||||
if flag2:
|
||||
if !$"../..".allowHandle :
|
||||
return
|
||||
$"../..".clickButtonSignal.emit(true,$"../..")
|
||||
|
@ -1,5 +1,8 @@
|
||||
extends VBoxContainer
|
||||
|
||||
##是否允许操作
|
||||
var allowHandle :bool = true
|
||||
|
||||
enum ButtonType{
|
||||
green,# 绿色按钮
|
||||
red,#红色按钮
|
||||
|
@ -18,6 +18,9 @@ func _input(event):
|
||||
# 如果鼠标在Sprite2D上点击,则处理事件
|
||||
var flag2 = test_enter()
|
||||
if flag2:
|
||||
$"../..".clickKeySwitchSignal.emit(open_light.visible,$"../..")
|
||||
if !$"../..".allowHandle :
|
||||
return
|
||||
if $"../Key".rotation+PI/6<0.001:
|
||||
$"../Key".rotation=PI/6
|
||||
$"../Keyhole".rotation=PI/6
|
||||
@ -25,4 +28,3 @@ func _input(event):
|
||||
$"../Key".rotation=-PI/6
|
||||
$"../Keyhole".rotation=-PI/6
|
||||
open_light.visible = !open_light.visible
|
||||
$"../..".clickKeySwitchSignal.emit(open_light.visible,$"../..")
|
||||
|
@ -6,10 +6,13 @@ extends VBoxContainer
|
||||
|
||||
@export var keyText:String
|
||||
|
||||
##是否允许操作
|
||||
var allowHandle :bool = true
|
||||
|
||||
|
||||
signal clickKeySwitchSignal(openLight:bool,keySwitch)
|
||||
|
||||
signal removeKey(keyName)
|
||||
signal removeKey(keySwitch)
|
||||
|
||||
func _ready() -> void:
|
||||
$Light/MarginContainer/Label.text=lightText
|
||||
@ -32,7 +35,9 @@ func hideHandleKey() -> void:
|
||||
##拔钥匙相关
|
||||
func _on_key_gui_input(event: InputEvent) -> void:
|
||||
if event.button_mask == MouseButtonMask.MOUSE_BUTTON_MASK_LEFT:
|
||||
removeKey.emit(self.name)
|
||||
removeKey.emit(self)
|
||||
if !allowHandle :
|
||||
return
|
||||
hideHandleKey()
|
||||
|
||||
|
||||
|
@ -1,14 +1,18 @@
|
||||
extends Window
|
||||
|
||||
##是否允许操作
|
||||
var allowHandle :bool = true
|
||||
|
||||
func _on_psl_click_signal() -> void:
|
||||
allClickPslSignal.emit('PSL',$".")
|
||||
if !allowHandle :
|
||||
return
|
||||
self.show()
|
||||
$"../stationKeys".onShowWindow(StationKeyWindow.WindowType.PSL)
|
||||
if !$"../stationKeys".hsjcKeyVisible() :
|
||||
hideInterlockReleaseSwitchHandleKey()
|
||||
if !$"../stationKeys".pslKeyVisible() :
|
||||
hidePSLAllowHandleKey()
|
||||
$"..".allClickPlatformSignal.emit('PSL')
|
||||
|
||||
|
||||
func _on_close_requested():
|
||||
@ -17,7 +21,7 @@ func _on_close_requested():
|
||||
|
||||
##点击按钮或钥匙
|
||||
func onHandleSignal(openLight: bool, keySwitch: Variant) -> void:
|
||||
$"..".allClickPlatformSignal.emit(keySwitch.name,keySwitch)
|
||||
allClickPslSignal.emit(keySwitch.name,keySwitch)
|
||||
|
||||
##显影psl相关钥匙操作
|
||||
func shouPSLAllowHandleKey():
|
||||
@ -35,14 +39,15 @@ func hideInterlockReleaseSwitchHandleKey():
|
||||
$MarginContainer/GridContainer/InterlockReleaseSwitch.hideHandleKey()
|
||||
|
||||
|
||||
func remove_key(keyName: Variant) -> void:
|
||||
func remove_key(keySwitch: Variant) -> void:
|
||||
var name = ''
|
||||
if keyName == 'PSLAllow' :
|
||||
if keySwitch.name == 'PSLAllow' :
|
||||
name = 'PSL_Key'
|
||||
allClickPslSignal.emit('removePSLKeyOfWindowPsl')
|
||||
elif keyName == 'InterlockReleaseSwitch' :
|
||||
allClickPslSignal.emit('removePSLKeyOfWindowPsl',keySwitch)
|
||||
elif keySwitch.name == 'InterlockReleaseSwitch' :
|
||||
name = 'HSJC_Key'
|
||||
allClickPslSignal.emit('removeHSJCKeyOfWindowPsl')
|
||||
allClickPslSignal.emit('removeHSJCKeyOfWindowPsl',keySwitch)
|
||||
if keySwitch.allowHandle :
|
||||
$"../stationKeys".showKeyAfterRemoveKey(name)
|
||||
|
||||
|
||||
|
@ -1,11 +1,17 @@
|
||||
extends Window
|
||||
|
||||
##是否允许操作
|
||||
var allowHandle :bool = true
|
||||
|
||||
var currenScreenDoor:ScreenDoor=null
|
||||
|
||||
@onready var isolation_strip: Button = $PanelContainer/MarginContainer/VBoxContainer/IsolationStrip/IsolationStrip
|
||||
|
||||
|
||||
func _on_screen_door_click_signal(screenDoor:ScreenDoor,mousePosition) -> void:
|
||||
allClickScreenDoorSignal.emit(screenDoor.name+'RightClick',$".")
|
||||
if !allowHandle :
|
||||
return
|
||||
position = Vector2(mousePosition.x-100,mousePosition.y)
|
||||
currenScreenDoor = screenDoor
|
||||
show()
|
||||
@ -13,16 +19,17 @@ func _on_screen_door_click_signal(screenDoor:ScreenDoor,mousePosition) -> void:
|
||||
isolation_strip.text = '撤下隔离带'
|
||||
else :
|
||||
isolation_strip.text = '放置隔离带'
|
||||
$"..".allClickPlatformSignal.emit(screenDoor.name+'RightClick',screenDoor)
|
||||
|
||||
func _on_close_requested() -> void:
|
||||
hide()
|
||||
|
||||
##粘胶带
|
||||
func _on_adhesive_tape_button_down() -> void:
|
||||
allClickScreenDoorSignal.emit('clickAdhesiveTapeOf'+currenScreenDoor.name,$".")
|
||||
if !allowHandle :
|
||||
return
|
||||
currenScreenDoor.adhesiveTape()
|
||||
hide()
|
||||
allClickScreenDoorSignal.emit('clickAdhesiveTapeOf'+currenScreenDoor.name)
|
||||
|
||||
func _on_adhesive_tape_mouse_entered() -> void:
|
||||
$PanelContainer/MarginContainer/VBoxContainer/MarginContainer/AdhesiveTape/AdhesiveTape.set_default_cursor_shape(Control.CursorShape.CURSOR_POINTING_HAND)
|
||||
@ -33,9 +40,11 @@ func _on_adhesive_tape_mouse_exited() -> void:
|
||||
|
||||
##隔离带
|
||||
func _on_isolation_strip_button_down() -> void:
|
||||
allClickScreenDoorSignal.emit('clickIsolationStripOf'+currenScreenDoor.name,$".")
|
||||
if !allowHandle :
|
||||
return
|
||||
currenScreenDoor.isSetIsolationStrip = !currenScreenDoor.isSetIsolationStrip
|
||||
hide()
|
||||
allClickScreenDoorSignal.emit('clickIsolationStripOf'+currenScreenDoor.name)
|
||||
|
||||
|
||||
func _on_isolation_strip_mouse_entered() -> void:
|
||||
|
@ -3,6 +3,9 @@ extends Window
|
||||
##钥匙面板
|
||||
class_name StationKeyWindow
|
||||
|
||||
##是否允许操作
|
||||
var allowHandle :bool = true
|
||||
|
||||
var current_focus: CanvasItem
|
||||
|
||||
## 打开的面板类型枚举
|
||||
@ -17,15 +20,20 @@ var current_together_window: WindowType
|
||||
var current_lcb_keyname: String=''
|
||||
|
||||
func _on_key_focus_entered(node):
|
||||
allClickStationKeysSignal.emit(node.name)
|
||||
if !allowHandle :
|
||||
return
|
||||
current_focus = node
|
||||
$"..".allClickPlatformSignal.emit(current_focus.name)
|
||||
|
||||
|
||||
|
||||
func _on_button_pressed():
|
||||
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')):
|
||||
print("请选择钥匙")
|
||||
else:
|
||||
$"..".allClickPlatformSignal.emit('confirmUseKey',current_focus.name)
|
||||
allClickStationKeysSignal.emit('confirmUseKey')
|
||||
if !allowHandle :
|
||||
return
|
||||
if current_focus.name.contains('LCB') :
|
||||
$"../LCB".shouHandleKey(current_focus.name)
|
||||
$"../LCB".grab_focus()
|
||||
@ -65,3 +73,6 @@ func onShowWindow(togetherWindow:WindowType,lcbKeyName = ''):
|
||||
current_together_window = togetherWindow
|
||||
current_lcb_keyname = lcbKeyName
|
||||
self.show()
|
||||
|
||||
##所有StationKeys点击操作汇总
|
||||
signal allClickStationKeysSignal(equipmentName:String)
|
||||
|
@ -46,6 +46,9 @@ func _on_close_click_area_mouse_exited():
|
||||
|
||||
func _on_close_click_area_gui_input(event):
|
||||
if event.button_mask == MouseButtonMask.MOUSE_BUTTON_MASK_LEFT && jjtc_state == JJTC_STATE.OPEN:
|
||||
$"../../../..".allClickJJTCSignal.emit('JJTCCloseBox',$"../../../..")
|
||||
if !$"../../../..".allowHandle :
|
||||
return
|
||||
jjtc_state = JJTC_STATE.CLOSE
|
||||
$"../../../../JJTC_Box_Voice".play()
|
||||
$"../../../../JJTC_Key".show()
|
||||
@ -53,7 +56,6 @@ func _on_close_click_area_gui_input(event):
|
||||
$"../../../../JJTC_Left_Rotate".show()
|
||||
$"../../../../Close_Click_Area".hide()
|
||||
$"../../../../JJTC_Button".hide()
|
||||
$"../../../..".allClickJJTCSignal.emit('JJTCCloseBox')
|
||||
|
||||
|
||||
func _on_station_keys_mouse_entered():
|
||||
|
@ -65,3 +65,7 @@ func _on_jjtc_all_click_jjtc_signal(equipmentName: String, equipmentInfo: Varian
|
||||
|
||||
func _on_screen_door_operate_all_click_screen_door_signal(equipmentName: String, equipmentInfo: Variant=null) -> void:
|
||||
allClickPlatformSignal.emit(equipmentName,equipmentInfo)
|
||||
|
||||
|
||||
func _on_station_keys_all_click_station_keys_signal(equipmentName: String) -> void:
|
||||
allClickPlatformSignal.emit(equipmentName,$stationKeys)
|
||||
|
@ -43,6 +43,7 @@ visible = false
|
||||
[connection signal="clickJJTCSignal" from="JJTC" to="jjtc" method="_on_jjtc_click_jjtc_signal"]
|
||||
[connection signal="allClickLCBSignal" from="LCB" to="." method="_on_lcb_all_click_lcb_signal"]
|
||||
[connection signal="close_requested" from="LCB" to="LCB" method="_on_close_requested"]
|
||||
[connection signal="allClickStationKeysSignal" from="stationKeys" to="." method="_on_station_keys_all_click_station_keys_signal"]
|
||||
[connection signal="allClickPslSignal" from="psl" to="." method="_on_psl_all_click_psl_signal"]
|
||||
[connection signal="allClickJJTCSignal" from="jjtc" to="." method="_on_jjtc_all_click_jjtc_signal"]
|
||||
[connection signal="close_requested" from="jjtc" to="jjtc" method="_on_close_requested"]
|
||||
|
Loading…
Reference in New Issue
Block a user