godot-psd-training/sceen/platform/shortcutTool/shortcutToolModel.gd

67 lines
2.6 KiB
GDScript3
Raw Normal View History

extends Node3D
##是否允许操作
var allowHandle :bool = true
##所有ShortTool点击操作汇总
signal AllClickShortcutToolModel(equipmentName:String, equipmentInfo: Variant)
func _on_mouse_entered() -> void:
Input.set_default_cursor_shape(Input.CursorShape.CURSOR_POINTING_HAND)
func _on_mouse_exited() -> void:
Input.set_default_cursor_shape(Input.CursorShape.CURSOR_ARROW)
func _on_handheld_radio_area_3d_input_event(camera: Node, event: InputEvent, position: Vector3, normal: Vector3, shape_idx: int) -> void:
if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
AllClickShortcutToolModel.emit('handheldRadioModel',self)
if !allowHandle :
return
$handheldRadioModel.visible = false
func _on_escalator_key_area_3d_input_event(camera: Node, event: InputEvent, position: Vector3, normal: Vector3, shape_idx: int) -> void:
if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
AllClickShortcutToolModel.emit('escalatorKeyModel',self)
if !allowHandle :
return
$escalatorKeyModel.visible = false
func _on_metal_barrier_area_3d_input_event(camera: Node, event: InputEvent, position: Vector3, normal: Vector3, shape_idx: int) -> void:
if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
AllClickShortcutToolModel.emit('metalBarrierModel',self)
if !allowHandle :
return
$metalBarrierModel.visible = false
$metalBarrier2.visible = false
$metalBarrier3.visible = false
func _on_notice_signs_area_3d_input_event(camera: Node, event: InputEvent, position: Vector3, normal: Vector3, shape_idx: int) -> void:
if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
AllClickShortcutToolModel.emit('noticeSignsModel',self)
if !allowHandle :
return
$noticeSignsModel.visible = false
func _on_picketline_area_3d_input_event(camera: Node, event: InputEvent, position: Vector3, normal: Vector3, shape_idx: int) -> void:
if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
AllClickShortcutToolModel.emit('picketlineModel',self)
if !allowHandle :
return
$picketlineModel.visible = false
func _on_hoarding_area_3d_input_event(camera: Node, event: InputEvent, position: Vector3, normal: Vector3, shape_idx: int) -> void:
if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
AllClickShortcutToolModel.emit('hoardingModel',self)
if !allowHandle :
return
$hoardingModel.visible = false