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

60 lines
1.9 KiB
GDScript

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()
if screenDoor.isSetIsolationStrip :
isolation_strip.text = '撤下隔离带'
else :
isolation_strip.text = '放置隔离带'
func _on_close_requested() -> void:
hide()
##粘胶带
func _on_adhesive_tape_button_down() -> void:
allClickScreenDoorSignal.emit('clickAdhesiveTapeOf'+currenScreenDoor.name,$".")
if !allowHandle :
return
currenScreenDoor.adhesiveTape()
hide()
func _on_adhesive_tape_mouse_entered() -> void:
$PanelContainer/MarginContainer/VBoxContainer/MarginContainer/AdhesiveTape/AdhesiveTape.set_default_cursor_shape(Control.CursorShape.CURSOR_POINTING_HAND)
func _on_adhesive_tape_mouse_exited() -> void:
$PanelContainer/MarginContainer/VBoxContainer/MarginContainer/AdhesiveTape/AdhesiveTape.set_default_cursor_shape(Control.CursorShape.CURSOR_ARROW)
##隔离带
func _on_isolation_strip_button_down() -> void:
allClickScreenDoorSignal.emit('clickIsolationStripOf'+currenScreenDoor.name,$".")
if !allowHandle :
return
currenScreenDoor.isSetIsolationStrip = !currenScreenDoor.isSetIsolationStrip
hide()
func _on_isolation_strip_mouse_entered() -> void:
isolation_strip.set_default_cursor_shape(Control.CursorShape.CURSOR_POINTING_HAND)
func _on_isolation_strip_mouse_exited() -> void:
isolation_strip.set_default_cursor_shape(Control.CursorShape.CURSOR_ARROW)
##所有ScreenDoorOperate点击操作汇总
signal allClickScreenDoorSignal(equipmentName:String,equipmentInfo)