交互面板的对应节点的屏幕坐标(待微调)
This commit is contained in:
parent
a6159980e4
commit
8730ac792e
@ -108,9 +108,19 @@ func _on_platform_all_click_platform_signal(equipmentName: String,equipmentInfo=
|
|||||||
else :
|
else :
|
||||||
print('操作错误')
|
print('操作错误')
|
||||||
|
|
||||||
|
|
||||||
|
const NodeUtils = preload("res://util/NodeUtils.gd")
|
||||||
##所有交互操作平面坐标
|
##所有交互操作平面坐标
|
||||||
func allClickEquipmentPostion(equipmentName: String) -> Vector2:
|
func allClickEquipmentPostion(equipmentName: String) -> Vector2:
|
||||||
if equipmentName == 'LCB1' : ##LCB以及LCB面板
|
if equipmentName in ['LCB_Key1','LCB_Key2','LCB_Key3','LCB_Key4','JJTC_Key','PSL_Key','HSJC_Key','SDJS_Key','confirmUseKey'] : ##钥匙面板
|
||||||
|
var keysWindow = $platform.get_node('stationKeys')
|
||||||
|
var lcbWindowPos = keysWindow.position
|
||||||
|
if equipmentName == 'confirmUseKey':
|
||||||
|
var confirmUseKeyPos=NodeUtils.find_child_by_name(keysWindow,'Button').get_global_position()
|
||||||
|
return Vector2(lcbWindowPos.x+confirmUseKeyPos.x,lcbWindowPos.y+confirmUseKeyPos.y)
|
||||||
|
var LCB_KeyPos=NodeUtils.find_child_by_name(keysWindow,equipmentName).get_global_position()
|
||||||
|
return Vector2(lcbWindowPos.x+LCB_KeyPos.x,lcbWindowPos.y+LCB_KeyPos.y)
|
||||||
|
elif equipmentName == 'LCB1' : ##LCB以及LCB面板
|
||||||
return getScreenPosition($platform.get_node('screenDoor1').get_node('LCB').get_node('LCB_body'))
|
return getScreenPosition($platform.get_node('screenDoor1').get_node('LCB').get_node('LCB_body'))
|
||||||
elif equipmentName == 'LCB2' :
|
elif equipmentName == 'LCB2' :
|
||||||
return getScreenPosition($platform.get_node('screenDoor2').get_node('LCB').get_node('LCB_body'))
|
return getScreenPosition($platform.get_node('screenDoor2').get_node('LCB').get_node('LCB_body'))
|
||||||
@ -130,11 +140,43 @@ func allClickEquipmentPostion(equipmentName: String) -> Vector2:
|
|||||||
var lcbPos = $platform.get_node('LCB').position
|
var lcbPos = $platform.get_node('LCB').position
|
||||||
var removePos = $platform.get_node('LCB').get_node('TextureRect2').get_global_position()
|
var removePos = $platform.get_node('LCB').get_node('TextureRect2').get_global_position()
|
||||||
return Vector2(lcbPos.x+removePos.x,lcbPos.y+removePos.y)
|
return Vector2(lcbPos.x+removePos.x,lcbPos.y+removePos.y)
|
||||||
elif equipmentName == 'PSL' : ##PSL以及PSL面板
|
elif equipmentName == 'PSL' : ##PSL以及PSL面板
|
||||||
return getScreenPosition($platform.get_node('PSL').get_node('PSL_body'))
|
return getScreenPosition($platform.get_node('PSL').get_node('PSL_body'))
|
||||||
elif equipmentName == 'JJTC' : ##JJTC以及JJTC面板
|
elif equipmentName in ['PSLAllow','CloseDoorButton','OpenDoorButton','InterlockReleaseSwitch','LightTestButton','trainDepartsButton','interconnectedCloseButton','interconnectedOpenButton','removePSLKeyOfWindowPsl','removeHSJCKeyOfWindowPsl'] :
|
||||||
|
var pslWindow = $platform.get_node('psl')
|
||||||
|
var pslWindowPos = pslWindow.position
|
||||||
|
if equipmentName in ['PSLAllow','InterlockReleaseSwitch']:
|
||||||
|
var keySwitch=NodeUtils.find_child_by_name(pslWindow,equipmentName)
|
||||||
|
var rotatePos = NodeUtils.find_child_by_name(keySwitch,'Right_Rotate').get_global_position()
|
||||||
|
return Vector2(pslWindowPos.x+rotatePos.x,pslWindowPos.y+rotatePos.y)
|
||||||
|
elif equipmentName == 'removePSLKeyOfWindowPsl':
|
||||||
|
var PSLAllow=NodeUtils.find_child_by_name(pslWindow,'PSLAllow')
|
||||||
|
var removeKeyPos = NodeUtils.find_child_by_name(PSLAllow,'Keyhole').get_global_position()
|
||||||
|
return Vector2(pslWindowPos.x+removeKeyPos.x,pslWindowPos.y+removeKeyPos.y)
|
||||||
|
elif equipmentName == 'removeHSJCKeyOfWindowPsl':
|
||||||
|
var InterlockReleaseSwitch=NodeUtils.find_child_by_name(pslWindow,'InterlockReleaseSwitch')
|
||||||
|
var removeKeyPos = NodeUtils.find_child_by_name(InterlockReleaseSwitch,'Keyhole').get_global_position()
|
||||||
|
return Vector2(pslWindowPos.x+removeKeyPos.x,pslWindowPos.y+removeKeyPos.y)
|
||||||
|
var LCB_KeyPos=NodeUtils.find_child_by_name(pslWindow,equipmentName).get_global_position()
|
||||||
|
return Vector2(pslWindowPos.x+LCB_KeyPos.x,pslWindowPos.y+LCB_KeyPos.y)
|
||||||
|
elif equipmentName == 'JJTC' : ##JJTC以及JJTC面板
|
||||||
return getScreenPosition($platform.get_node('JJTC').get_node('JJTC_body'))
|
return getScreenPosition($platform.get_node('JJTC').get_node('JJTC_body'))
|
||||||
elif equipmentName == 'screenDoor1RightClick' : ##屏蔽门右键以及屏蔽门右键面板
|
elif equipmentName in ['JJTCLeftRotate','JJTCRightRotate','JJTCButton','JJTCCloseBox'] :
|
||||||
|
var jjtcWindow = $platform.get_node('jjtc')
|
||||||
|
var jjtcWindowPos = jjtcWindow.position
|
||||||
|
if equipmentName == 'JJTCLeftRotate':
|
||||||
|
var Close_Click_Area_pos=NodeUtils.find_child_by_name(jjtcWindow,'JJTC_Left_Rotate').get_global_position()
|
||||||
|
return Vector2(jjtcWindowPos.x+Close_Click_Area_pos.x,jjtcWindowPos.y+Close_Click_Area_pos.y)
|
||||||
|
elif equipmentName == 'JJTCRightRotate':
|
||||||
|
var Close_Click_Area_pos=NodeUtils.find_child_by_name(jjtcWindow,'JJTC_Right_Rotate').get_global_position()
|
||||||
|
return Vector2(jjtcWindowPos.x+Close_Click_Area_pos.x,jjtcWindowPos.y+Close_Click_Area_pos.y)
|
||||||
|
elif equipmentName == 'JJTCButton':
|
||||||
|
var Close_Click_Area_pos=NodeUtils.find_child_by_name(jjtcWindow,'JJTC_Button').get_global_position()
|
||||||
|
return Vector2(jjtcWindowPos.x+Close_Click_Area_pos.x,jjtcWindowPos.y+Close_Click_Area_pos.y)
|
||||||
|
else :
|
||||||
|
var Close_Click_Area_pos=NodeUtils.find_child_by_name(jjtcWindow,'Close_Click_Area').get_global_position()
|
||||||
|
return Vector2(jjtcWindowPos.x+Close_Click_Area_pos.x,jjtcWindowPos.y+Close_Click_Area_pos.y)
|
||||||
|
elif equipmentName == 'screenDoor1RightClick' : ##屏蔽门右键以及屏蔽门右键面板
|
||||||
return getScreenPosition($platform.get_node('screenDoor1').get_node('left'))
|
return getScreenPosition($platform.get_node('screenDoor1').get_node('left'))
|
||||||
elif equipmentName == 'screenDoor2RightClick' :
|
elif equipmentName == 'screenDoor2RightClick' :
|
||||||
return getScreenPosition($platform.get_node('screenDoor2').get_node('left'))
|
return getScreenPosition($platform.get_node('screenDoor2').get_node('left'))
|
||||||
@ -142,7 +184,16 @@ func allClickEquipmentPostion(equipmentName: String) -> Vector2:
|
|||||||
return getScreenPosition($platform.get_node('screenDoor3').get_node('left'))
|
return getScreenPosition($platform.get_node('screenDoor3').get_node('left'))
|
||||||
elif equipmentName == 'screenDoor4RightClick' :
|
elif equipmentName == 'screenDoor4RightClick' :
|
||||||
return getScreenPosition($platform.get_node('screenDoor4').get_node('left'))
|
return getScreenPosition($platform.get_node('screenDoor4').get_node('left'))
|
||||||
return getScreenPosition($platform.get_node('PSL').get_node('PSL_body'))
|
elif equipmentName in ['clickAdhesiveTapeOfscreenDoor1','clickAdhesiveTapeOfscreenDoor2','clickAdhesiveTapeOfscreenDoor3','clickAdhesiveTapeOfscreenDoor4'] :
|
||||||
|
var ScreenDoorOperateWindow = $platform.get_node('ScreenDoorOperate')
|
||||||
|
var ScreenDoorOperateWindowPos = ScreenDoorOperateWindow.position
|
||||||
|
var AdhesiveTapePos = NodeUtils.find_child_by_name(ScreenDoorOperateWindow,'AdhesiveTape').get_global_position()
|
||||||
|
return Vector2(ScreenDoorOperateWindowPos.x+AdhesiveTapePos.x,ScreenDoorOperateWindowPos.y+AdhesiveTapePos.y)
|
||||||
|
else:
|
||||||
|
var ScreenDoorOperateWindow = $platform.get_node('ScreenDoorOperate')
|
||||||
|
var ScreenDoorOperateWindowPos = ScreenDoorOperateWindow.position
|
||||||
|
var IsolationStripPos=NodeUtils.find_child_by_name(ScreenDoorOperateWindow,'IsolationStrip').get_global_position()
|
||||||
|
return Vector2(ScreenDoorOperateWindowPos.x+IsolationStripPos.x,ScreenDoorOperateWindowPos.y+IsolationStripPos.y)
|
||||||
|
|
||||||
func getScreenPosition(node):
|
func getScreenPosition(node):
|
||||||
var screenPostion = $Camera3D.unproject_position(node.global_transform.origin)
|
var screenPostion = $Camera3D.unproject_position(node.global_transform.origin)
|
||||||
@ -155,10 +206,10 @@ const allClickEquipmentInfo = {
|
|||||||
"LCB_Key2": "请选择LCB钥匙",
|
"LCB_Key2": "请选择LCB钥匙",
|
||||||
"LCB_Key3": "请选择LCB钥匙",
|
"LCB_Key3": "请选择LCB钥匙",
|
||||||
"LCB_Key4": "请选择LCB钥匙",
|
"LCB_Key4": "请选择LCB钥匙",
|
||||||
"JJTC_Key": "请选择钥匙JJTC",
|
"JJTC_Key": "请选择紧急停车钥匙",
|
||||||
"PSL_Key": "请选择钥匙PSL",
|
"PSL_Key": "请选择PSL钥匙",
|
||||||
"HSJC_Key": "请选择钥匙HSJC",
|
"HSJC_Key": "请选择互锁解除钥匙",
|
||||||
"SDJS_Key": "请选择钥匙SDJS",
|
"SDJS_Key": "请选择手动解锁钥匙",
|
||||||
"confirmUseKey": "请确认使用钥匙",
|
"confirmUseKey": "请确认使用钥匙",
|
||||||
"LCB1": "请点击打开屏蔽门1的LCB面板", ##LCB以及LCB面板
|
"LCB1": "请点击打开屏蔽门1的LCB面板", ##LCB以及LCB面板
|
||||||
"LCB2": "请点击打开屏蔽门2的LCB面板",
|
"LCB2": "请点击打开屏蔽门2的LCB面板",
|
||||||
@ -188,8 +239,8 @@ const allClickEquipmentInfo = {
|
|||||||
"removePSLKeyOfWindowPsl": "请移除PSK钥匙",
|
"removePSLKeyOfWindowPsl": "请移除PSK钥匙",
|
||||||
"removeHSJCKeyOfWindowPsl": "请移除互锁解除钥匙",
|
"removeHSJCKeyOfWindowPsl": "请移除互锁解除钥匙",
|
||||||
"JJTC": "请打开紧急停车面板", ##JJTC以及JJTC面板
|
"JJTC": "请打开紧急停车面板", ##JJTC以及JJTC面板
|
||||||
"JJTCLeftRotate": "请向右旋转打开紧急停车按钮盒",
|
"JJTCLeftRotate": "请向左旋转打开紧急停车按钮盒",
|
||||||
"JJTCRightRotate": "请向左旋转拔出紧急停车钥匙",
|
"JJTCRightRotate": "请向右旋转拔出紧急停车钥匙",
|
||||||
"JJTCButton": "请点击紧急停车按钮",
|
"JJTCButton": "请点击紧急停车按钮",
|
||||||
"JJTCCloseBox": "请点击盒子边框关闭紧急停车按钮盒",
|
"JJTCCloseBox": "请点击盒子边框关闭紧急停车按钮盒",
|
||||||
"screenDoor1RightClick": "请右键点击屏蔽门1", ##屏蔽门右键以及屏蔽门右键面板
|
"screenDoor1RightClick": "请右键点击屏蔽门1", ##屏蔽门右键以及屏蔽门右键面板
|
||||||
|
Loading…
Reference in New Issue
Block a user