From fde9a7cc38ca023b7aad047753bf25c711b39837 Mon Sep 17 00:00:00 2001 From: TsubakiLoL <2789646812@qq.com> Date: Fri, 20 Dec 2024 13:11:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E9=A2=9C=E8=89=B2=EF=BC=8C?= =?UTF-8?q?=E4=B8=BAsetting=20tab=E5=9C=BA=E6=99=AF=E5=92=8Clanguage=20tab?= =?UTF-8?q?=20=E5=9C=BA=E6=99=AF=E6=B7=BB=E5=8A=A0=E5=AD=97=E4=BD=93?= =?UTF-8?q?=E9=A2=9C=E8=89=B2=E5=8F=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Robo-Bus-A31-HMI/Modules/language_tabs.gd | 16 +++- Robo-Bus-A31-HMI/Modules/language_tabs.tscn | 3 + Robo-Bus-A31-HMI/Modules/setting.tscn | 74 ++++++++++++++----- Robo-Bus-A31-HMI/Modules/settingButtonItem.gd | 1 + Robo-Bus-A31-HMI/Modules/setting_tabs.gd | 12 ++- Robo-Bus-A31-HMI/Modules/ws_connect_button.gd | 31 ++++++++ 6 files changed, 113 insertions(+), 24 deletions(-) create mode 100644 Robo-Bus-A31-HMI/Modules/ws_connect_button.gd diff --git a/Robo-Bus-A31-HMI/Modules/language_tabs.gd b/Robo-Bus-A31-HMI/Modules/language_tabs.gd index 73d9bd8..552eb99 100644 --- a/Robo-Bus-A31-HMI/Modules/language_tabs.gd +++ b/Robo-Bus-A31-HMI/Modules/language_tabs.gd @@ -1,6 +1,6 @@ extends MarginContainer - - +@export var normal_color:Color=Color("676767") +@export var select_color:Color=Color("FFFFFF") #移动背景 @onready var texture_rect: TextureRect = $Control/TextureRect #需要连接信号的节点数组 @@ -9,6 +9,12 @@ signal Onclick(State:int) var SelectNode = null: set(value): if value != SelectNode: + if SelectNode==null: + for i in nodearr: + i.get_node("Label").add_theme_color_override("font_color",normal_color) + else: + SelectNode.get_node("Label").add_theme_color_override("font_color",normal_color) + value.get_node("Label").add_theme_color_override("font_color",select_color) var tween = create_tween() tween.parallel().tween_property(texture_rect, "global_position", value.global_position, 0.2).set_ease(Tween.EASE_OUT) tween.parallel().tween_property(texture_rect,"size",value.size,0.2).set_ease(Tween.EASE_OUT) @@ -23,8 +29,10 @@ var OnClickIsCooling = false: func _ready() -> void: - await get_tree().create_timer(0.1).timeout - SelectNode = %Chinese + await get_tree().create_timer(0.3).timeout + for i in nodearr: + i.get_node("Label").add_theme_color_override("font_color",normal_color) + %Chinese.get_node("Label").add_theme_color_override("font_color",select_color) for node : BaseControl in nodearr: node.on_click.connect(func(_node): if !OnClickIsCooling: diff --git a/Robo-Bus-A31-HMI/Modules/language_tabs.tscn b/Robo-Bus-A31-HMI/Modules/language_tabs.tscn index 1f7b41e..1dee1d3 100644 --- a/Robo-Bus-A31-HMI/Modules/language_tabs.tscn +++ b/Robo-Bus-A31-HMI/Modules/language_tabs.tscn @@ -36,6 +36,7 @@ script = ExtResource("3_iu68l") [node name="Label" type="Label" parent="HBoxContainer/Chinese"] layout_mode = 2 +theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1) theme_override_font_sizes/font_size = 26 text = "中文" horizontal_alignment = 1 @@ -48,6 +49,7 @@ script = ExtResource("3_iu68l") [node name="Label" type="Label" parent="HBoxContainer/English"] layout_mode = 2 +theme_override_colors/font_color = Color(0.403922, 0.403922, 0.403922, 1) theme_override_font_sizes/font_size = 26 text = "English" horizontal_alignment = 1 @@ -60,6 +62,7 @@ script = ExtResource("3_iu68l") [node name="Label" type="Label" parent="HBoxContainer/Japanese"] layout_mode = 2 +theme_override_colors/font_color = Color(0.403922, 0.403922, 0.403922, 1) theme_override_font_sizes/font_size = 26 text = "日本語" horizontal_alignment = 1 diff --git a/Robo-Bus-A31-HMI/Modules/setting.tscn b/Robo-Bus-A31-HMI/Modules/setting.tscn index cac60de..b3bae0e 100644 --- a/Robo-Bus-A31-HMI/Modules/setting.tscn +++ b/Robo-Bus-A31-HMI/Modules/setting.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=38 format=3 uid="uid://33cgqbhyfl47"] +[gd_scene load_steps=39 format=3 uid="uid://33cgqbhyfl47"] [ext_resource type="Script" path="res://Modules/setting.gd" id="1_ehdr1"] [ext_resource type="Texture2D" uid="uid://c17iqjrj23ojq" path="res://pad_hmi_ui/setting/setting_bg_cut.png" id="1_x62x2"] @@ -32,6 +32,7 @@ [ext_resource type="Texture2D" uid="uid://c15ltf6sdq5m1" path="res://pad_hmi_ui/setting/cancel_btn.png" id="17_r1mfq"] [ext_resource type="Texture2D" uid="uid://o418ai5uhori" path="res://pad_hmi_ui/setting/confirm_btn.png" id="18_i0avx"] [ext_resource type="PackedScene" uid="uid://ctjlpah7am5se" path="res://Modules/update_progress.tscn" id="19_ra4y1"] +[ext_resource type="Script" path="res://Modules/ws_connect_button.gd" id="25_iw2sn"] [sub_resource type="StyleBoxTexture" id="StyleBoxTexture_bqmim"] texture = ExtResource("2_o74j2") @@ -44,7 +45,7 @@ texture = ExtResource("9_i06j1") [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_emjfk"] -[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_12j7c"] +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_djvj8"] texture = ExtResource("13_g54n4") [node name="Setting" type="MarginContainer"] @@ -102,13 +103,15 @@ theme_override_constants/h_separation = 150 theme_override_constants/v_separation = 143 columns = 3 -[node name="Record" type="Button" parent="HBoxContainer/margin/VBoxContainer/GridContainer"] +[node name="Record" type="Button" parent="HBoxContainer/margin/VBoxContainer/GridContainer" node_paths=PackedStringArray("texture_rect")] custom_minimum_size = Vector2(220, 220) layout_mode = 2 focus_mode = 0 +flat = true script = ExtResource("10_jyc6b") TextureNormal = ExtResource("3_t55mh") TexturePressed = ExtResource("3_r83c5") +texture_rect = NodePath("TextureRect") styleBox = SubResource("StyleBoxTexture_bqmim") [node name="TextureRect" type="TextureRect" parent="HBoxContainer/margin/VBoxContainer/GridContainer/Record"] @@ -127,24 +130,28 @@ stretch_mode = 5 metadata/_edit_use_anchors_ = true [node name="Label" type="Label" parent="HBoxContainer/margin/VBoxContainer/GridContainer/Record"] -layout_mode = 0 +layout_mode = 1 +anchors_preset = -1 anchor_left = 0.236364 anchor_top = 0.7 anchor_right = 0.777273 -anchor_bottom = 0.931818 +anchor_bottom = 0.854545 theme_override_colors/font_color = Color(0.403922, 0.403922, 0.403922, 1) theme_override_font_sizes/font_size = 24 text = "录制数据" horizontal_alignment = 1 +vertical_alignment = 1 metadata/_edit_use_anchors_ = true -[node name="Build" type="Button" parent="HBoxContainer/margin/VBoxContainer/GridContainer"] +[node name="Build" type="Button" parent="HBoxContainer/margin/VBoxContainer/GridContainer" node_paths=PackedStringArray("texture_rect")] custom_minimum_size = Vector2(220, 220) layout_mode = 2 focus_mode = 0 +flat = true script = ExtResource("10_jyc6b") TextureNormal = ExtResource("6_q5g71") TexturePressed = ExtResource("7_3wr4h") +texture_rect = NodePath("TextureRect") styleBox = SubResource("StyleBoxTexture_bqmim") [node name="TextureRect" type="TextureRect" parent="HBoxContainer/margin/VBoxContainer/GridContainer/Build"] @@ -167,21 +174,24 @@ layout_mode = 1 anchors_preset = -1 anchor_left = 0.172727 anchor_top = 0.7 -anchor_right = 0.827273 -anchor_bottom = 0.931818 +anchor_right = 0.827272 +anchor_bottom = 0.854545 theme_override_colors/font_color = Color(0.403922, 0.403922, 0.403922, 1) theme_override_font_sizes/font_size = 24 text = "构建高清地图" horizontal_alignment = 1 +vertical_alignment = 1 metadata/_edit_use_anchors_ = true -[node name="Export" type="Button" parent="HBoxContainer/margin/VBoxContainer/GridContainer"] +[node name="Export" type="Button" parent="HBoxContainer/margin/VBoxContainer/GridContainer" node_paths=PackedStringArray("texture_rect")] custom_minimum_size = Vector2(220, 220) layout_mode = 2 focus_mode = 0 +flat = true script = ExtResource("10_jyc6b") TextureNormal = ExtResource("8_0e4lg") TexturePressed = ExtResource("9_gdew3") +texture_rect = NodePath("TextureRect") styleBox = SubResource("StyleBoxTexture_bqmim") [node name="TextureRect" type="TextureRect" parent="HBoxContainer/margin/VBoxContainer/GridContainer/Export"] @@ -210,6 +220,7 @@ theme_override_colors/font_color = Color(0.403922, 0.403922, 0.403922, 1) theme_override_font_sizes/font_size = 24 text = "导出" horizontal_alignment = 1 +vertical_alignment = 1 metadata/_edit_use_anchors_ = true [node name="exportTabs" parent="HBoxContainer/margin/VBoxContainer/GridContainer/Export" instance=ExtResource("10_i6ov6")] @@ -226,13 +237,15 @@ item1 = ".bag" item2 = ".pcd" metadata/_edit_use_anchors_ = true -[node name="Download" type="Button" parent="HBoxContainer/margin/VBoxContainer/GridContainer"] +[node name="Download" type="Button" parent="HBoxContainer/margin/VBoxContainer/GridContainer" node_paths=PackedStringArray("texture_rect")] custom_minimum_size = Vector2(220, 220) layout_mode = 2 focus_mode = 0 +flat = true script = ExtResource("10_jyc6b") TextureNormal = ExtResource("11_px13j") TexturePressed = ExtResource("12_ljpgt") +texture_rect = NodePath("TextureRect") styleBox = SubResource("StyleBoxTexture_bqmim") [node name="TextureRect" type="TextureRect" parent="HBoxContainer/margin/VBoxContainer/GridContainer/Download"] @@ -256,20 +269,23 @@ anchors_preset = -1 anchor_left = 0.177273 anchor_top = 0.668182 anchor_right = 0.831818 -anchor_bottom = 0.9 +anchor_bottom = 0.822728 theme_override_colors/font_color = Color(0.403922, 0.403922, 0.403922, 1) theme_override_font_sizes/font_size = 24 text = "下载更新地图" horizontal_alignment = 1 +vertical_alignment = 1 metadata/_edit_use_anchors_ = true -[node name="Upload" type="Button" parent="HBoxContainer/margin/VBoxContainer/GridContainer"] +[node name="Upload" type="Button" parent="HBoxContainer/margin/VBoxContainer/GridContainer" node_paths=PackedStringArray("texture_rect")] custom_minimum_size = Vector2(220, 220) layout_mode = 2 focus_mode = 0 +flat = true script = ExtResource("10_jyc6b") TextureNormal = ExtResource("13_8lrx3") TexturePressed = ExtResource("15_f66s7") +texture_rect = NodePath("TextureRect") styleBox = SubResource("StyleBoxTexture_bqmim") [node name="TextureRect" type="TextureRect" parent="HBoxContainer/margin/VBoxContainer/GridContainer/Upload"] @@ -293,11 +309,12 @@ anchors_preset = -1 anchor_left = 0.218182 anchor_top = 0.740909 anchor_right = 0.759091 -anchor_bottom = 0.972727 +anchor_bottom = 0.895454 theme_override_colors/font_color = Color(0.403922, 0.403922, 0.403922, 1) theme_override_font_sizes/font_size = 24 text = "上传" horizontal_alignment = 1 +vertical_alignment = 1 metadata/_edit_use_anchors_ = true [node name="uploadTabs" parent="HBoxContainer/margin/VBoxContainer/GridContainer/Upload" instance=ExtResource("10_i6ov6")] @@ -344,12 +361,14 @@ layout_mode = 2 [node name="progressHead" type="Label" parent="HBoxContainer/margin/VBoxContainer/progressPanel/MarginContainer/VBoxContainer/HBoxContainer"] unique_name_in_owner = true layout_mode = 2 +theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1) theme_override_font_sizes/font_size = 33 text = "进度 - " [node name="progressLabel" type="Label" parent="HBoxContainer/margin/VBoxContainer/progressPanel/MarginContainer/VBoxContainer/HBoxContainer"] unique_name_in_owner = true layout_mode = 2 +theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1) theme_override_font_sizes/font_size = 33 text = "45%" @@ -393,6 +412,7 @@ unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 3 size_flags_vertical = 2 +theme_override_colors/font_color = Color(0.43134, 0.43134, 0.43134, 1) theme_override_constants/line_spacing = 15 theme_override_font_sizes/font_size = 27 text = "[INFO] [launch]: All log files can be found below @@ -426,6 +446,7 @@ theme_override_constants/separation = 19 unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 10 +theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1) theme_override_font_sizes/font_size = 34 text = "25℃" @@ -436,12 +457,14 @@ layout_mode = 2 [node name="Date" type="Label" parent="HBoxContainer/VBoxContainer/margin/VBoxContainer/HBoxContainer"] unique_name_in_owner = true layout_mode = 2 +theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1) theme_override_font_sizes/font_size = 34 text = "2024-04-27" [node name="Time" type="Label" parent="HBoxContainer/VBoxContainer/margin/VBoxContainer/HBoxContainer"] unique_name_in_owner = true layout_mode = 2 +theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1) theme_override_font_sizes/font_size = 34 text = "00:35:24" @@ -459,6 +482,7 @@ theme_override_constants/separation = 48 [node name="Label" type="Label" parent="HBoxContainer/VBoxContainer/margin/VBoxContainer/HBoxContainer2/VBoxContainer"] layout_mode = 2 +theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1) theme_override_font_sizes/font_size = 33 text = "显示模式" @@ -474,6 +498,7 @@ theme_override_constants/separation = 48 [node name="Label" type="Label" parent="HBoxContainer/VBoxContainer/margin/VBoxContainer/HBoxContainer2/VBoxContainer2"] layout_mode = 2 +theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1) theme_override_font_sizes/font_size = 33 text = "视图切换" @@ -499,6 +524,7 @@ theme_override_constants/separation = 40 [node name="Label" type="Label" parent="HBoxContainer/VBoxContainer/margin/VBoxContainer/HBoxContainer3/VBoxContainer"] layout_mode = 2 +theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1) theme_override_font_sizes/font_size = 32 text = "系统语言" @@ -519,6 +545,7 @@ theme_override_constants/separation = 40 [node name="Label" type="Label" parent="HBoxContainer/VBoxContainer/margin/VBoxContainer/HBoxContainer3/VBoxContainer2"] layout_mode = 2 +theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1) theme_override_font_sizes/font_size = 32 text = "连接服务器" @@ -535,23 +562,26 @@ theme_override_styles/panel = SubResource("StyleBoxTexture_jad8g") [node name="WebsocketAddressInput" type="LineEdit" parent="HBoxContainer/VBoxContainer/margin/VBoxContainer/HBoxContainer3/VBoxContainer2/HBoxContainer/WebsocketAddress"] unique_name_in_owner = true layout_mode = 2 +theme_override_colors/font_selected_color = Color(0.952941, 0.952941, 0.952941, 1) +theme_override_colors/font_uneditable_color = Color(0.952941, 0.952941, 0.952941, 1) +theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1) theme_override_font_sizes/font_size = 30 theme_override_styles/focus = SubResource("StyleBoxEmpty_emjfk") text = "ws://192.168.4.88:9091" alignment = 1 flat = true -[node name="WsConnectButton" type="Button" parent="HBoxContainer/VBoxContainer/margin/VBoxContainer/HBoxContainer3/VBoxContainer2/HBoxContainer"] +[node name="WsConnectButton" type="Button" parent="HBoxContainer/VBoxContainer/margin/VBoxContainer/HBoxContainer3/VBoxContainer2/HBoxContainer" node_paths=PackedStringArray("texture_rect")] custom_minimum_size = Vector2(100, 0) layout_mode = 2 focus_mode = 0 flat = true -script = ExtResource("10_jyc6b") -TextureNormal = ExtResource("12_3rn0r") -TexturePressed = ExtResource("11_g12mf") -styleBox = SubResource("StyleBoxTexture_12j7c") +script = ExtResource("25_iw2sn") +TextureNormal = ExtResource("11_g12mf") +TexturePressed = ExtResource("12_3rn0r") +texture_rect = NodePath("TextureRect") +styleBox = SubResource("StyleBoxTexture_djvj8") is_Scale = true -size_max = 1.2 [node name="TextureRect" type="TextureRect" parent="HBoxContainer/VBoxContainer/margin/VBoxContainer/HBoxContainer3/VBoxContainer2/HBoxContainer/WsConnectButton"] layout_mode = 1 @@ -587,6 +617,7 @@ theme_override_constants/separation = 0 [node name="Label" type="Label" parent="HBoxContainer/VBoxContainer/RightBottonPanel/VBoxContainer/HBoxContainer"] layout_mode = 2 +theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1) theme_override_font_sizes/font_size = 32 text = "VCU固件版本:" vertical_alignment = 1 @@ -595,6 +626,7 @@ vertical_alignment = 1 unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 3 +theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1) theme_override_font_sizes/font_size = 32 text = "1.1.1" horizontal_alignment = 2 @@ -606,6 +638,7 @@ layout_mode = 2 [node name="Label3" type="Label" parent="HBoxContainer/VBoxContainer/RightBottonPanel/VBoxContainer/HBoxContainer"] layout_mode = 2 +theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1) theme_override_font_sizes/font_size = 31 text = "自动驾驶版本:" horizontal_alignment = 1 @@ -615,6 +648,7 @@ vertical_alignment = 1 unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 3 +theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1) theme_override_font_sizes/font_size = 32 text = "1.1.1" horizontal_alignment = 2 @@ -630,6 +664,7 @@ layout_mode = 2 [node name="Label" type="Label" parent="HBoxContainer/VBoxContainer/RightBottonPanel/VBoxContainer/HBoxContainer2"] layout_mode = 2 +theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1) theme_override_font_sizes/font_size = 32 text = "OTA升级" vertical_alignment = 1 @@ -649,6 +684,7 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 +theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1) theme_override_font_sizes/font_size = 32 text = "检查更新" horizontal_alignment = 1 diff --git a/Robo-Bus-A31-HMI/Modules/settingButtonItem.gd b/Robo-Bus-A31-HMI/Modules/settingButtonItem.gd index aa2617b..560bba2 100644 --- a/Robo-Bus-A31-HMI/Modules/settingButtonItem.gd +++ b/Robo-Bus-A31-HMI/Modules/settingButtonItem.gd @@ -1,3 +1,4 @@ +@tool extends BaseControl @export var TextureNormal :Texture2D diff --git a/Robo-Bus-A31-HMI/Modules/setting_tabs.gd b/Robo-Bus-A31-HMI/Modules/setting_tabs.gd index 64bf6b8..83a5423 100644 --- a/Robo-Bus-A31-HMI/Modules/setting_tabs.gd +++ b/Robo-Bus-A31-HMI/Modules/setting_tabs.gd @@ -2,6 +2,8 @@ extends MarginContainer @export var item1:String="default1" @export var item2:String="default_2" +@export var normal_color:Color=Color("676767") +@export var select_color:Color=Color("FFFFFF") #移动背景 @onready var texture_rect: TextureRect = $Control/TextureRect #需要连接信号的节点数组 @@ -10,6 +12,12 @@ signal Onclick(State:int) var SelectNode = null: set(value): if value != SelectNode: + if SelectNode==null: + for i in nodearr: + i.get_node("item_name").add_theme_color_override("font_color",normal_color) + else: + SelectNode.get_node("item_name").add_theme_color_override("font_color",normal_color) + value.get_node("item_name").add_theme_color_override("font_color",select_color) var tween = create_tween() tween.parallel().tween_property(texture_rect, "global_position", value.global_position, 0.2).set_ease(Tween.EASE_OUT) tween.parallel().tween_property(texture_rect,"size",value.size,0.2).set_ease(Tween.EASE_OUT) @@ -27,7 +35,9 @@ func _ready() -> void: $HBoxContainer/Item1/item_name.text=item1 $HBoxContainer/Item2/item_name.text=item2 await get_tree().create_timer(0.1).timeout - SelectNode = %Item1 + for i in nodearr: + i.get_node("item_name").add_theme_color_override("font_color",normal_color) + %Item1.get_node("item_name").add_theme_color_override("font_color",select_color) for node : BaseControl in nodearr: node.on_click.connect(func(_node): if !OnClickIsCooling: diff --git a/Robo-Bus-A31-HMI/Modules/ws_connect_button.gd b/Robo-Bus-A31-HMI/Modules/ws_connect_button.gd new file mode 100644 index 0000000..cd4efed --- /dev/null +++ b/Robo-Bus-A31-HMI/Modules/ws_connect_button.gd @@ -0,0 +1,31 @@ +extends BaseControl + +@export var TextureNormal :Texture2D +@export var TexturePressed : Texture2D +#用来播放动画的tween +var animation_tween +@export var texture_rect: TextureRect + +func _ready() -> void: + super._ready() + self.button_down.connect(_on_button_down) + self.button_up.connect(_on_button_up) + texture_rect.texture=TextureNormal + self.flat=true + + pass + +func _on_button_down() -> void: + texture_rect.texture=TexturePressed + pass # Replace with function body. + + +func _on_button_up() -> void: + texture_rect.texture=TextureNormal + pass # Replace with function body. + + + + +func set_texture(texture:Texture2D): + texture_rect.texture=texture