173 lines
7.3 KiB
GDScript
173 lines
7.3 KiB
GDScript
extends Node3D
|
|
|
|
class_name ShortcutToolModel2
|
|
|
|
##是否允许操作
|
|
var allowHandle :bool = true
|
|
|
|
##所有ShortTool点击操作汇总
|
|
signal AllClickShortcutToolModel2(equipmentName:String, equipmentInfo: Variant)
|
|
|
|
func allTimerStopAndShowRedStripe() -> void:
|
|
for child in [$picketlineModelAtB,$picketlineModelAtA,$picketlineModelAtGateB,$picketlineModelAtGateA]:
|
|
child.get_node('Timer').stop()
|
|
var redStripe = child.get_node('redStripe')
|
|
redStripe.position.y = 0
|
|
redStripe.visible = true
|
|
|
|
var picketlineModelAtBCountTime = 0
|
|
func _picketlineModelAtB_timer_timeout() -> void:
|
|
handleRedStripeVisible(picketlineModelAtBCountTime,$picketlineModelAtB/redStripe,1)
|
|
|
|
var picketlineModelAtACountTime = 0
|
|
func _picketlineModelAtA_timer_timeout() -> void:
|
|
handleRedStripeVisible(picketlineModelAtACountTime,$picketlineModelAtA/redStripe,2)
|
|
|
|
var picketlineModelAtGateBCountTime = 0
|
|
func _picketlineModelAtGateB_timer_timeout() -> void:
|
|
handleRedStripeVisible(picketlineModelAtGateBCountTime,$picketlineModelAtGateB/redStripe,3)
|
|
|
|
var picketlineModelAtGateACountTime = 0
|
|
func _picketlineModelAtGateA_timer_timeout() -> void:
|
|
handleRedStripeVisible(picketlineModelAtGateACountTime,$picketlineModelAtGateA/redStripe,4)
|
|
|
|
func handleRedStripeVisible(countTime:int, redStripe:Node3D,index:int) -> void:
|
|
countTime += 1
|
|
if countTime > 5 and countTime < 15 :
|
|
redStripe.visible = false
|
|
redStripe.position.y = -30
|
|
elif countTime >= 15 :
|
|
redStripe.position.y = 0
|
|
redStripe.visible = true
|
|
countTime = 0
|
|
match index :
|
|
1:
|
|
picketlineModelAtBCountTime = countTime
|
|
2:
|
|
picketlineModelAtACountTime = countTime
|
|
3:
|
|
picketlineModelAtGateBCountTime = countTime
|
|
4:
|
|
picketlineModelAtGateACountTime = countTime
|
|
|
|
|
|
|
|
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_hoarding_at_escalator_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:
|
|
AllClickShortcutToolModel2.emit('hoardingAtEscalatorUp',self)
|
|
if !allowHandle :
|
|
return
|
|
$hoardingAtEscalatorUp.visible = false
|
|
|
|
|
|
func _on_hoarding_at_escalator_down_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:
|
|
AllClickShortcutToolModel2.emit('hoardingAtEscalatorDown',self)
|
|
if !allowHandle :
|
|
return
|
|
$hoardingAtEscalatorDown.visible = false
|
|
|
|
|
|
func _on_picketline_model_at_b_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:
|
|
AllClickShortcutToolModel2.emit('picketlineModelAtB',self)
|
|
if !allowHandle :
|
|
return
|
|
$picketlineModelAtB.visible = false
|
|
|
|
|
|
func _on_picketline_model_at_a_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:
|
|
AllClickShortcutToolModel2.emit('picketlineModelAtA',self)
|
|
if !allowHandle :
|
|
return
|
|
$picketlineModelAtA.visible = false
|
|
|
|
|
|
func _on_picketline_model_at_gate_b_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:
|
|
AllClickShortcutToolModel2.emit('picketlineModelAtGateB',self)
|
|
if !allowHandle :
|
|
return
|
|
$picketlineModelAtGateB.visible = false
|
|
|
|
|
|
func _on_picketline_model_at_gate_a_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:
|
|
AllClickShortcutToolModel2.emit('picketlineModelAtGateA',self)
|
|
if !allowHandle :
|
|
return
|
|
$picketlineModelAtGateA.visible = false
|
|
|
|
|
|
func _on_notice_signs_model_at_a_entrance_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:
|
|
AllClickShortcutToolModel2.emit('noticeSignsModelAtAEntrance',self)
|
|
if !allowHandle :
|
|
return
|
|
$noticeSignsModelAtAEntrance.visible = false
|
|
|
|
|
|
func _on_notice_signs_model_at_b_entrance_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:
|
|
AllClickShortcutToolModel2.emit('noticeSignsModelAtBEntrance',self)
|
|
if !allowHandle :
|
|
return
|
|
$noticeSignsModelAtBEntrance.visible = false
|
|
|
|
|
|
func _on_notice_signs_model_at_c_entrance_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:
|
|
AllClickShortcutToolModel2.emit('noticeSignsModelAtCEntrance',self)
|
|
if !allowHandle :
|
|
return
|
|
$noticeSignsModelAtCEntrance.visible = false
|
|
|
|
|
|
func _on_notice_signs_model_at_d_entrance_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:
|
|
AllClickShortcutToolModel2.emit('noticeSignsModelAtDEntrance',self)
|
|
if !allowHandle :
|
|
return
|
|
$noticeSignsModelAtDEntrance.visible = false
|
|
|
|
|
|
func _on_metal_barrier_model_at_d_entrance_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:
|
|
AllClickShortcutToolModel2.emit('metalBarrierModelAtDEntrance',self)
|
|
if !allowHandle :
|
|
return
|
|
$metalBarrierModelAtDEntrance.visible = false
|
|
|
|
|
|
func _on_metal_barrier_model_at_station_hall_d_exit_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:
|
|
AllClickShortcutToolModel2.emit('metalBarrierModelAtStationHallDExit',self)
|
|
if !allowHandle :
|
|
return
|
|
$metalBarrierModelAtStationHallDExit.visible = false
|
|
|
|
|
|
func _on_metal_barrier_model_at_c_entrance_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:
|
|
AllClickShortcutToolModel2.emit('metalBarrierModelAtCEntrance',self)
|
|
if !allowHandle :
|
|
return
|
|
$metalBarrierModelAtCEntrance.visible = false
|
|
|
|
|
|
func _on_metal_barrier_model_at_c_passage_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:
|
|
AllClickShortcutToolModel2.emit('metalBarrierModelAtStationHallCExit',self)
|
|
if !allowHandle :
|
|
return
|
|
$metalBarrierModelAtStationHallCExit.visible = false
|