add上传

This commit is contained in:
shurongsen 2024-12-18 22:29:21 +08:00
parent 5014b40625
commit 62a7f1c008
11 changed files with 4358 additions and 1457 deletions

BIN
.DS_Store vendored

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,43 @@
extends HBoxContainer
@onready var side_display_texture_rect: TextureRect = %sideDisplayTextureRect
@onready var _3d_texture_rect: TextureRect = %"3DTextureRect"
@onready var power_texture_rect: TextureRect = %PowerTextureRect
@onready var power_label: Label = %PowerLabel
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
side_display_texture_rect.texture = Global.EgoVehicle3D.SideDisplayGetTexture()
_3d_texture_rect.texture = Global.EgoVehicle3D.MainSubGetTexture()
Websocket.connected_to_server.connect(connected_to_server)
Websocket.message_received.connect(message_received)
pass # Replace with function body.
func connected_to_server():
update_bms_report()
pass
func message_received(data:Dictionary):
if data.is_empty():return
if !data.has("topic"):return
match data.topic:
"/pix_robobus/bms_report":#电量显示
power_label.text = str(data.msg.battery_soc) + "%"
if data.msg.battery_soc < 25:
power_texture_rect.texture = preload("res://pad_hmi_ui/home/battery_icon_red.png")
elif data.msg.battery_soc < 50:
power_texture_rect.texture = preload("res://pad_hmi_ui/home/battery_icon_yellow.png")
elif data.msg.battery_soc < 75:
power_texture_rect.texture = preload("res://pad_hmi_ui/home/battery_icon_green2.png")
else:
power_texture_rect.texture = preload("res://pad_hmi_ui/home/battery_icon_green.png")
pass
func update_bms_report():#电量显示
var send_data = {
"op": "subscribe",
"topic": "/pix_robobus/bms_report",
"type": "pix_robobus_driver_msgs/msg/BmsReport"
}
Websocket.send_msg(str(send_data))

View File

@ -1,6 +1,7 @@
[gd_scene load_steps=47 format=3 uid="uid://dx5owafvbqdec"]
[gd_scene load_steps=48 format=3 uid="uid://dx5owafvbqdec"]
[ext_resource type="Script" path="res://common/base/base_control.gd" id="1_gebae"]
[ext_resource type="Script" path="res://Modules/data_panel.gd" id="1_h1ywm"]
[ext_resource type="Texture2D" uid="uid://bhsjkyho6jr42" path="res://pad_hmi_ui/home/l2_1.png" id="2_oga35"]
[ext_resource type="Shader" path="res://common/shader/round.gdshader" id="3_6kou5"]
[ext_resource type="Texture2D" uid="uid://bigplutpkgp7o" path="res://pad_hmi_ui/home/Preview.png" id="4_fkt10"]
@ -107,8 +108,8 @@ expand_margin_top = 1.0
expand_margin_bottom = 1.0
[node name="DataPanel" type="HBoxContainer"]
visible = false
theme_override_constants/separation = 30
script = ExtResource("1_h1ywm")
[node name="MediumMenu" type="MarginContainer" parent="."]
layout_mode = 2
@ -153,7 +154,8 @@ is_Rotation = null
size_max = 0.3
is_OnClickScaleAwt = null
[node name="TextureRect" type="TextureRect" parent="MediumMenu/VBoxContainer/CarInfoDisplay/3DVehicle"]
[node name="3DTextureRect" type="TextureRect" parent="MediumMenu/VBoxContainer/CarInfoDisplay/3DVehicle"]
unique_name_in_owner = true
material = SubResource("ShaderMaterial_yeotr")
layout_mode = 2
texture = ExtResource("4_fkt10")
@ -430,10 +432,12 @@ theme_override_font_sizes/font_size = 23
text = "电量"
[node name="PowerTextureRect" type="TextureRect" parent="MediumMenu/VBoxContainer/CarInfoDisplay/VehicleInformation/VBoxContainer/InformationDisplay3/MarginContainer/Power"]
unique_name_in_owner = true
layout_mode = 2
texture = ExtResource("15_fxv8p")
[node name="PowerLabel" type="Label" parent="MediumMenu/VBoxContainer/CarInfoDisplay/VehicleInformation/VBoxContainer/InformationDisplay3/MarginContainer/Power"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 4
theme_override_font_sizes/font_size = 23
@ -520,6 +524,15 @@ size_flags_horizontal = 3
texture = ExtResource("22_co28d")
expand_mode = 1
[node name="sideDisplayTextureRect" type="TextureRect" parent="MediumMenu/VBoxContainer/HBoxContainer2/TextureRect2"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="RightMenu" type="MarginContainer" parent="."]
layout_mode = 2
size_flags_horizontal = 3

View File

@ -61,3 +61,14 @@ func OnClick3DVehicle(_node: Variant) -> void:
#main_3d_vehicle.self_modulate.a = 1
pass # Replace with function body.""
@onready var dic = {
"Home":%DataPanel,
"VehicleInformation":%Information,
"SetUp":%Setting
}
func _on_tabs_onclick(State: Variant) -> void:
for node in dic.values():
node.visible = false
dic[State].visible = true
pass # Replace with function body.

View File

@ -11,14 +11,15 @@ var language = {
}
}
var language_mode = ""
func pop_ups(type = "",text = ""):
var POP_UPS = preload("res://gui/pop_ups.tscn").instantiate()
scene_gui.add_child(POP_UPS)
POP_UPS.set_text(type,text)
return POP_UPS
#func pop_ups(type = "",text = ""):
#var POP_UPS = preload("res://gui/pop_ups.tscn").instantiate()
#scene_gui.add_child(POP_UPS)
#POP_UPS.set_text(type,text)
#return POP_UPS
var sub_viewport: SubViewport = null
var sub_viewport_2: SubViewport = null
var loading_state = false
var ndk_statu = float(0)
var EgoVehicle3D = null

File diff suppressed because one or more lines are too long

View File

@ -15,6 +15,11 @@ run/main_scene="res://control.tscn"
config/features=PackedStringArray("4.3", "Mobile")
config/icon="res://icon.svg"
[autoload]
Global="*res://common/global.gd"
Websocket="*res://common/websocket.gd"
[display]
window/size/viewport_width=2560

View File

@ -0,0 +1,13 @@
extends Node3D
@onready var view_camera: Camera3D = %ViewCamera
@onready var side_display_sub_viewport: SubViewport = $SideDisplaySubViewport
@onready var main_sub_viewport: SubViewport = $MainSubViewport
func _init() -> void:
Global.EgoVehicle3D = self
func SideDisplayGetTexture():
return side_display_sub_viewport.get_texture()
func MainSubGetTexture():
return main_sub_viewport.get_texture()

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,15 @@
[gd_resource type="Environment" load_steps=3 format=3 uid="uid://c5ksuke04sr07"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_rekia"]
sky_top_color = Color(1, 1, 1, 1)
sky_horizon_color = Color(1, 1, 1, 1)
ground_bottom_color = Color(1, 1, 1, 1)
ground_horizon_color = Color(1, 1, 1, 1)
[sub_resource type="Sky" id="Sky_q0c80"]
sky_material = SubResource("ProceduralSkyMaterial_rekia")
[resource]
background_mode = 2
background_energy_multiplier = 0.8
sky = SubResource("Sky_q0c80")