godot-psd-training/UI/screenDoorOperate/screen_door_operate.gd

60 lines
1.9 KiB
GDScript3
Raw Normal View History

2024-04-30 16:02:08 +08:00
extends Window
##是否允许操作
var allowHandle :bool = true
2024-05-06 09:54:45 +08:00
var currenScreenDoor:ScreenDoor=null
@onready var isolation_strip: Button = $PanelContainer/MarginContainer/VBoxContainer/IsolationStrip/IsolationStrip
2024-04-30 16:02:08 +08:00
func _on_screen_door_click_signal(screenDoor:ScreenDoor,mousePosition) -> void:
allClickScreenDoorSignal.emit(screenDoor.name+'RightClick',$".")
if !allowHandle :
return
2024-04-30 16:02:08 +08:00
position = Vector2(mousePosition.x-100,mousePosition.y)
2024-05-06 09:54:45 +08:00
currenScreenDoor = screenDoor
2024-04-30 16:02:08 +08:00
show()
2024-05-06 09:54:45 +08:00
if screenDoor.isSetIsolationStrip :
isolation_strip.text = '撤下隔离带'
else :
isolation_strip.text = '放置隔离带'
2024-04-30 16:02:08 +08:00
func _on_close_requested() -> void:
hide()
##粘胶带
2024-05-06 09:54:45 +08:00
func _on_adhesive_tape_button_down() -> void:
allClickScreenDoorSignal.emit('clickAdhesiveTapeOf'+currenScreenDoor.name,$".")
if !allowHandle :
return
currenScreenDoor.adhesiveTape()
hide()
2024-04-30 16:02:08 +08:00
func _on_adhesive_tape_mouse_entered() -> void:
2024-05-06 09:54:45 +08:00
$PanelContainer/MarginContainer/VBoxContainer/MarginContainer/AdhesiveTape/AdhesiveTape.set_default_cursor_shape(Control.CursorShape.CURSOR_POINTING_HAND)
2024-04-30 16:02:08 +08:00
func _on_adhesive_tape_mouse_exited() -> void:
2024-05-06 09:54:45 +08:00
$PanelContainer/MarginContainer/VBoxContainer/MarginContainer/AdhesiveTape/AdhesiveTape.set_default_cursor_shape(Control.CursorShape.CURSOR_ARROW)
2024-04-30 16:02:08 +08:00
##隔离带
2024-05-06 09:54:45 +08:00
func _on_isolation_strip_button_down() -> void:
allClickScreenDoorSignal.emit('clickIsolationStripOf'+currenScreenDoor.name,$".")
if !allowHandle :
return
2024-05-06 09:54:45 +08:00
currenScreenDoor.isSetIsolationStrip = !currenScreenDoor.isSetIsolationStrip
hide()
2024-04-30 16:02:08 +08:00
func _on_isolation_strip_mouse_entered() -> void:
2024-05-06 09:54:45 +08:00
isolation_strip.set_default_cursor_shape(Control.CursorShape.CURSOR_POINTING_HAND)
2024-04-30 16:02:08 +08:00
func _on_isolation_strip_mouse_exited() -> void:
2024-05-06 09:54:45 +08:00
isolation_strip.set_default_cursor_shape(Control.CursorShape.CURSOR_ARROW)
2024-05-11 14:10:07 +08:00
##所有ScreenDoorOperate点击操作汇总
signal allClickScreenDoorSignal(equipmentName:String,equipmentInfo)