godot-psd-training/UI/ShortcutTool/shortcutTool.gd
2024-06-21 09:55:02 +08:00

67 lines
1.9 KiB
GDScript

extends Node2D
##是否允许操作
var allowHandle :bool = true
##所有ShortTool点击操作汇总
signal AllClickShortcutTool(equipmentName:String,equipmentInfo)
#电扶梯钥匙
func _on_escalator_key_pressed() -> void:
AllClickShortcutTool.emit('escalatorKey',self)
if !allowHandle :
return
#手提广播
func _on_handheld_radio_pressed() -> void:
AllClickShortcutTool.emit('handheldRadio',self)
if !allowHandle :
return
#围挡(扶梯处)
func _on_hoarding_pressed() -> void:
AllClickShortcutTool.emit('hoarding',self)
if !allowHandle :
return
#警戒线(进站闸机处)
func _on_picketline_pressed() -> void:
AllClickShortcutTool.emit('picketline',self)
if !allowHandle :
return
#铁马
func _on_metal_barrier_pressed() -> void:
AllClickShortcutTool.emit('metalBarrier',self)
if !allowHandle :
return
#警示牌
func _on_notice_signs_pressed() -> void:
AllClickShortcutTool.emit('noticeSigns',self)
if !allowHandle :
return
##点击快捷工具对应的实物触发
func clickShortcutToolEntity(shortcutToolName:String) -> void:
if shortcutToolName == 'escalatorKey':
$MarginContainer/HBoxContainer/escalatorKey.show()
$MarginContainer/HBoxContainer/escalatorKeyT.hide()
elif shortcutToolName == 'handheldRadio':
$MarginContainer/HBoxContainer/handheldRadio.show()
$MarginContainer/HBoxContainer/handheldRadioT.hide()
elif shortcutToolName == 'hoarding':
$MarginContainer/HBoxContainer/hoarding.show()
$MarginContainer/HBoxContainer/hoardingT.hide()
elif shortcutToolName == 'picketline':
$MarginContainer/HBoxContainer/picketline.show()
$MarginContainer/HBoxContainer/picketlineT.hide()
elif shortcutToolName == 'metalBarrier':
$MarginContainer/HBoxContainer/metalBarrier.show()
$MarginContainer/HBoxContainer/metalBarrierT.hide()
elif shortcutToolName == 'noticeSigns':
$MarginContainer/HBoxContainer/noticeSigns.show()
$MarginContainer/HBoxContainer/noticeSignsT.hide()