2025-01-02 02:25:42 +08:00
|
|
|
extends Panel
|
|
|
|
|
|
|
|
func _ready() -> void:
|
|
|
|
Websocket.connected_to_server.connect(connected_to_server)
|
|
|
|
Websocket.message_received.connect(message_received)
|
|
|
|
|
2025-01-13 14:39:58 +08:00
|
|
|
func _physics_process(delta: float) -> void:
|
|
|
|
var current_time = Time.get_datetime_dict_from_system()
|
|
|
|
%Time.text = str(current_time.hour)+":"+str(current_time.minute)
|
|
|
|
%Date.text = str(current_time.month)+"月"+str(current_time.day) + "日"
|
2025-01-02 02:25:42 +08:00
|
|
|
func connected_to_server():
|
2025-01-13 14:39:58 +08:00
|
|
|
vehicle_info()
|
2025-01-02 02:25:42 +08:00
|
|
|
pass
|
|
|
|
func message_received(data:Dictionary):
|
|
|
|
if data.is_empty():return
|
|
|
|
if !data.has("topic"):return
|
|
|
|
match data.topic:
|
2025-01-03 14:02:17 +08:00
|
|
|
"/hmi_input/app/cloud_control_platform/vehicle_info":
|
|
|
|
if (data.msg.seatbelt == 0):
|
|
|
|
%SeatBeltTexture.texture = preload("res://res/icon/icon_safebelt_yes.png")
|
2025-01-13 14:39:58 +08:00
|
|
|
%SeatBeltText.text = "已系好"
|
2025-01-13 17:53:01 +08:00
|
|
|
%AnimationPlayer.play("RESET")
|
2025-01-03 14:02:17 +08:00
|
|
|
pass
|
|
|
|
else:
|
|
|
|
%SeatBeltTexture.texture = preload("res://res/icon/icon_safebelt_no.png")
|
2025-01-13 14:39:58 +08:00
|
|
|
%SeatBeltText.text = "未系好"
|
2025-01-13 17:53:01 +08:00
|
|
|
%AnimationPlayer.play("1")
|
2025-01-03 14:02:17 +08:00
|
|
|
pass
|
|
|
|
%Speed.text = str(data.msg.spd)
|
2025-01-02 02:25:42 +08:00
|
|
|
pass
|
|
|
|
|
2025-01-03 14:02:17 +08:00
|
|
|
func vehicle_info():#所有车辆信息
|
|
|
|
var send_data = {
|
|
|
|
"op": "subscribe",
|
|
|
|
"topic": "/hmi_input/app/cloud_control_platform/vehicle_info",
|
|
|
|
"type": "pixmoving_hmi_msgs/msg/VehicleInfo"
|
|
|
|
}
|
|
|
|
Websocket.send_msg(str(send_data))
|