更改颜色,为setting tab场景和language tab 场景添加字体颜色变化

This commit is contained in:
TsubakiLoL 2024-12-20 13:11:20 +08:00
parent fc0a8786bf
commit fde9a7cc38
6 changed files with 113 additions and 24 deletions

View File

@ -1,6 +1,6 @@
extends MarginContainer extends MarginContainer
@export var normal_color:Color=Color("676767")
@export var select_color:Color=Color("FFFFFF")
#移动背景 #移动背景
@onready var texture_rect: TextureRect = $Control/TextureRect @onready var texture_rect: TextureRect = $Control/TextureRect
#需要连接信号的节点数组 #需要连接信号的节点数组
@ -9,6 +9,12 @@ signal Onclick(State:int)
var SelectNode = null: var SelectNode = null:
set(value): set(value):
if value != SelectNode: 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() 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, "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) 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: func _ready() -> void:
await get_tree().create_timer(0.1).timeout await get_tree().create_timer(0.3).timeout
SelectNode = %Chinese 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: for node : BaseControl in nodearr:
node.on_click.connect(func(_node): node.on_click.connect(func(_node):
if !OnClickIsCooling: if !OnClickIsCooling:

View File

@ -36,6 +36,7 @@ script = ExtResource("3_iu68l")
[node name="Label" type="Label" parent="HBoxContainer/Chinese"] [node name="Label" type="Label" parent="HBoxContainer/Chinese"]
layout_mode = 2 layout_mode = 2
theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1)
theme_override_font_sizes/font_size = 26 theme_override_font_sizes/font_size = 26
text = "中文" text = "中文"
horizontal_alignment = 1 horizontal_alignment = 1
@ -48,6 +49,7 @@ script = ExtResource("3_iu68l")
[node name="Label" type="Label" parent="HBoxContainer/English"] [node name="Label" type="Label" parent="HBoxContainer/English"]
layout_mode = 2 layout_mode = 2
theme_override_colors/font_color = Color(0.403922, 0.403922, 0.403922, 1)
theme_override_font_sizes/font_size = 26 theme_override_font_sizes/font_size = 26
text = "English" text = "English"
horizontal_alignment = 1 horizontal_alignment = 1
@ -60,6 +62,7 @@ script = ExtResource("3_iu68l")
[node name="Label" type="Label" parent="HBoxContainer/Japanese"] [node name="Label" type="Label" parent="HBoxContainer/Japanese"]
layout_mode = 2 layout_mode = 2
theme_override_colors/font_color = Color(0.403922, 0.403922, 0.403922, 1)
theme_override_font_sizes/font_size = 26 theme_override_font_sizes/font_size = 26
text = "日本語" text = "日本語"
horizontal_alignment = 1 horizontal_alignment = 1

View File

@ -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="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"] [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://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="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="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"] [sub_resource type="StyleBoxTexture" id="StyleBoxTexture_bqmim"]
texture = ExtResource("2_o74j2") texture = ExtResource("2_o74j2")
@ -44,7 +45,7 @@ texture = ExtResource("9_i06j1")
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_emjfk"] [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") texture = ExtResource("13_g54n4")
[node name="Setting" type="MarginContainer"] [node name="Setting" type="MarginContainer"]
@ -102,13 +103,15 @@ theme_override_constants/h_separation = 150
theme_override_constants/v_separation = 143 theme_override_constants/v_separation = 143
columns = 3 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) custom_minimum_size = Vector2(220, 220)
layout_mode = 2 layout_mode = 2
focus_mode = 0 focus_mode = 0
flat = true
script = ExtResource("10_jyc6b") script = ExtResource("10_jyc6b")
TextureNormal = ExtResource("3_t55mh") TextureNormal = ExtResource("3_t55mh")
TexturePressed = ExtResource("3_r83c5") TexturePressed = ExtResource("3_r83c5")
texture_rect = NodePath("TextureRect")
styleBox = SubResource("StyleBoxTexture_bqmim") styleBox = SubResource("StyleBoxTexture_bqmim")
[node name="TextureRect" type="TextureRect" parent="HBoxContainer/margin/VBoxContainer/GridContainer/Record"] [node name="TextureRect" type="TextureRect" parent="HBoxContainer/margin/VBoxContainer/GridContainer/Record"]
@ -127,24 +130,28 @@ stretch_mode = 5
metadata/_edit_use_anchors_ = true metadata/_edit_use_anchors_ = true
[node name="Label" type="Label" parent="HBoxContainer/margin/VBoxContainer/GridContainer/Record"] [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_left = 0.236364
anchor_top = 0.7 anchor_top = 0.7
anchor_right = 0.777273 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_colors/font_color = Color(0.403922, 0.403922, 0.403922, 1)
theme_override_font_sizes/font_size = 24 theme_override_font_sizes/font_size = 24
text = "录制数据" text = "录制数据"
horizontal_alignment = 1 horizontal_alignment = 1
vertical_alignment = 1
metadata/_edit_use_anchors_ = true 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) custom_minimum_size = Vector2(220, 220)
layout_mode = 2 layout_mode = 2
focus_mode = 0 focus_mode = 0
flat = true
script = ExtResource("10_jyc6b") script = ExtResource("10_jyc6b")
TextureNormal = ExtResource("6_q5g71") TextureNormal = ExtResource("6_q5g71")
TexturePressed = ExtResource("7_3wr4h") TexturePressed = ExtResource("7_3wr4h")
texture_rect = NodePath("TextureRect")
styleBox = SubResource("StyleBoxTexture_bqmim") styleBox = SubResource("StyleBoxTexture_bqmim")
[node name="TextureRect" type="TextureRect" parent="HBoxContainer/margin/VBoxContainer/GridContainer/Build"] [node name="TextureRect" type="TextureRect" parent="HBoxContainer/margin/VBoxContainer/GridContainer/Build"]
@ -167,21 +174,24 @@ layout_mode = 1
anchors_preset = -1 anchors_preset = -1
anchor_left = 0.172727 anchor_left = 0.172727
anchor_top = 0.7 anchor_top = 0.7
anchor_right = 0.827273 anchor_right = 0.827272
anchor_bottom = 0.931818 anchor_bottom = 0.854545
theme_override_colors/font_color = Color(0.403922, 0.403922, 0.403922, 1) theme_override_colors/font_color = Color(0.403922, 0.403922, 0.403922, 1)
theme_override_font_sizes/font_size = 24 theme_override_font_sizes/font_size = 24
text = "构建高清地图" text = "构建高清地图"
horizontal_alignment = 1 horizontal_alignment = 1
vertical_alignment = 1
metadata/_edit_use_anchors_ = true 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) custom_minimum_size = Vector2(220, 220)
layout_mode = 2 layout_mode = 2
focus_mode = 0 focus_mode = 0
flat = true
script = ExtResource("10_jyc6b") script = ExtResource("10_jyc6b")
TextureNormal = ExtResource("8_0e4lg") TextureNormal = ExtResource("8_0e4lg")
TexturePressed = ExtResource("9_gdew3") TexturePressed = ExtResource("9_gdew3")
texture_rect = NodePath("TextureRect")
styleBox = SubResource("StyleBoxTexture_bqmim") styleBox = SubResource("StyleBoxTexture_bqmim")
[node name="TextureRect" type="TextureRect" parent="HBoxContainer/margin/VBoxContainer/GridContainer/Export"] [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 theme_override_font_sizes/font_size = 24
text = "导出" text = "导出"
horizontal_alignment = 1 horizontal_alignment = 1
vertical_alignment = 1
metadata/_edit_use_anchors_ = true metadata/_edit_use_anchors_ = true
[node name="exportTabs" parent="HBoxContainer/margin/VBoxContainer/GridContainer/Export" instance=ExtResource("10_i6ov6")] [node name="exportTabs" parent="HBoxContainer/margin/VBoxContainer/GridContainer/Export" instance=ExtResource("10_i6ov6")]
@ -226,13 +237,15 @@ item1 = ".bag"
item2 = ".pcd" item2 = ".pcd"
metadata/_edit_use_anchors_ = true 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) custom_minimum_size = Vector2(220, 220)
layout_mode = 2 layout_mode = 2
focus_mode = 0 focus_mode = 0
flat = true
script = ExtResource("10_jyc6b") script = ExtResource("10_jyc6b")
TextureNormal = ExtResource("11_px13j") TextureNormal = ExtResource("11_px13j")
TexturePressed = ExtResource("12_ljpgt") TexturePressed = ExtResource("12_ljpgt")
texture_rect = NodePath("TextureRect")
styleBox = SubResource("StyleBoxTexture_bqmim") styleBox = SubResource("StyleBoxTexture_bqmim")
[node name="TextureRect" type="TextureRect" parent="HBoxContainer/margin/VBoxContainer/GridContainer/Download"] [node name="TextureRect" type="TextureRect" parent="HBoxContainer/margin/VBoxContainer/GridContainer/Download"]
@ -256,20 +269,23 @@ anchors_preset = -1
anchor_left = 0.177273 anchor_left = 0.177273
anchor_top = 0.668182 anchor_top = 0.668182
anchor_right = 0.831818 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_colors/font_color = Color(0.403922, 0.403922, 0.403922, 1)
theme_override_font_sizes/font_size = 24 theme_override_font_sizes/font_size = 24
text = "下载更新地图" text = "下载更新地图"
horizontal_alignment = 1 horizontal_alignment = 1
vertical_alignment = 1
metadata/_edit_use_anchors_ = true 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) custom_minimum_size = Vector2(220, 220)
layout_mode = 2 layout_mode = 2
focus_mode = 0 focus_mode = 0
flat = true
script = ExtResource("10_jyc6b") script = ExtResource("10_jyc6b")
TextureNormal = ExtResource("13_8lrx3") TextureNormal = ExtResource("13_8lrx3")
TexturePressed = ExtResource("15_f66s7") TexturePressed = ExtResource("15_f66s7")
texture_rect = NodePath("TextureRect")
styleBox = SubResource("StyleBoxTexture_bqmim") styleBox = SubResource("StyleBoxTexture_bqmim")
[node name="TextureRect" type="TextureRect" parent="HBoxContainer/margin/VBoxContainer/GridContainer/Upload"] [node name="TextureRect" type="TextureRect" parent="HBoxContainer/margin/VBoxContainer/GridContainer/Upload"]
@ -293,11 +309,12 @@ anchors_preset = -1
anchor_left = 0.218182 anchor_left = 0.218182
anchor_top = 0.740909 anchor_top = 0.740909
anchor_right = 0.759091 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_colors/font_color = Color(0.403922, 0.403922, 0.403922, 1)
theme_override_font_sizes/font_size = 24 theme_override_font_sizes/font_size = 24
text = "上传" text = "上传"
horizontal_alignment = 1 horizontal_alignment = 1
vertical_alignment = 1
metadata/_edit_use_anchors_ = true metadata/_edit_use_anchors_ = true
[node name="uploadTabs" parent="HBoxContainer/margin/VBoxContainer/GridContainer/Upload" instance=ExtResource("10_i6ov6")] [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"] [node name="progressHead" type="Label" parent="HBoxContainer/margin/VBoxContainer/progressPanel/MarginContainer/VBoxContainer/HBoxContainer"]
unique_name_in_owner = true unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1)
theme_override_font_sizes/font_size = 33 theme_override_font_sizes/font_size = 33
text = "进度 - " text = "进度 - "
[node name="progressLabel" type="Label" parent="HBoxContainer/margin/VBoxContainer/progressPanel/MarginContainer/VBoxContainer/HBoxContainer"] [node name="progressLabel" type="Label" parent="HBoxContainer/margin/VBoxContainer/progressPanel/MarginContainer/VBoxContainer/HBoxContainer"]
unique_name_in_owner = true unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1)
theme_override_font_sizes/font_size = 33 theme_override_font_sizes/font_size = 33
text = "45%" text = "45%"
@ -393,6 +412,7 @@ unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 2 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_constants/line_spacing = 15
theme_override_font_sizes/font_size = 27 theme_override_font_sizes/font_size = 27
text = "[INFO] [launch]: All log files can be found below text = "[INFO] [launch]: All log files can be found below
@ -426,6 +446,7 @@ theme_override_constants/separation = 19
unique_name_in_owner = true unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 10 size_flags_horizontal = 10
theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1)
theme_override_font_sizes/font_size = 34 theme_override_font_sizes/font_size = 34
text = "25℃" text = "25℃"
@ -436,12 +457,14 @@ layout_mode = 2
[node name="Date" type="Label" parent="HBoxContainer/VBoxContainer/margin/VBoxContainer/HBoxContainer"] [node name="Date" type="Label" parent="HBoxContainer/VBoxContainer/margin/VBoxContainer/HBoxContainer"]
unique_name_in_owner = true unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1)
theme_override_font_sizes/font_size = 34 theme_override_font_sizes/font_size = 34
text = "2024-04-27" text = "2024-04-27"
[node name="Time" type="Label" parent="HBoxContainer/VBoxContainer/margin/VBoxContainer/HBoxContainer"] [node name="Time" type="Label" parent="HBoxContainer/VBoxContainer/margin/VBoxContainer/HBoxContainer"]
unique_name_in_owner = true unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1)
theme_override_font_sizes/font_size = 34 theme_override_font_sizes/font_size = 34
text = "00:35:24" 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"] [node name="Label" type="Label" parent="HBoxContainer/VBoxContainer/margin/VBoxContainer/HBoxContainer2/VBoxContainer"]
layout_mode = 2 layout_mode = 2
theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1)
theme_override_font_sizes/font_size = 33 theme_override_font_sizes/font_size = 33
text = "显示模式" text = "显示模式"
@ -474,6 +498,7 @@ theme_override_constants/separation = 48
[node name="Label" type="Label" parent="HBoxContainer/VBoxContainer/margin/VBoxContainer/HBoxContainer2/VBoxContainer2"] [node name="Label" type="Label" parent="HBoxContainer/VBoxContainer/margin/VBoxContainer/HBoxContainer2/VBoxContainer2"]
layout_mode = 2 layout_mode = 2
theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1)
theme_override_font_sizes/font_size = 33 theme_override_font_sizes/font_size = 33
text = "视图切换" text = "视图切换"
@ -499,6 +524,7 @@ theme_override_constants/separation = 40
[node name="Label" type="Label" parent="HBoxContainer/VBoxContainer/margin/VBoxContainer/HBoxContainer3/VBoxContainer"] [node name="Label" type="Label" parent="HBoxContainer/VBoxContainer/margin/VBoxContainer/HBoxContainer3/VBoxContainer"]
layout_mode = 2 layout_mode = 2
theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1)
theme_override_font_sizes/font_size = 32 theme_override_font_sizes/font_size = 32
text = "系统语言" text = "系统语言"
@ -519,6 +545,7 @@ theme_override_constants/separation = 40
[node name="Label" type="Label" parent="HBoxContainer/VBoxContainer/margin/VBoxContainer/HBoxContainer3/VBoxContainer2"] [node name="Label" type="Label" parent="HBoxContainer/VBoxContainer/margin/VBoxContainer/HBoxContainer3/VBoxContainer2"]
layout_mode = 2 layout_mode = 2
theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1)
theme_override_font_sizes/font_size = 32 theme_override_font_sizes/font_size = 32
text = "连接服务器" 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"] [node name="WebsocketAddressInput" type="LineEdit" parent="HBoxContainer/VBoxContainer/margin/VBoxContainer/HBoxContainer3/VBoxContainer2/HBoxContainer/WebsocketAddress"]
unique_name_in_owner = true unique_name_in_owner = true
layout_mode = 2 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_font_sizes/font_size = 30
theme_override_styles/focus = SubResource("StyleBoxEmpty_emjfk") theme_override_styles/focus = SubResource("StyleBoxEmpty_emjfk")
text = "ws://192.168.4.88:9091" text = "ws://192.168.4.88:9091"
alignment = 1 alignment = 1
flat = true 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) custom_minimum_size = Vector2(100, 0)
layout_mode = 2 layout_mode = 2
focus_mode = 0 focus_mode = 0
flat = true flat = true
script = ExtResource("10_jyc6b") script = ExtResource("25_iw2sn")
TextureNormal = ExtResource("12_3rn0r") TextureNormal = ExtResource("11_g12mf")
TexturePressed = ExtResource("11_g12mf") TexturePressed = ExtResource("12_3rn0r")
styleBox = SubResource("StyleBoxTexture_12j7c") texture_rect = NodePath("TextureRect")
styleBox = SubResource("StyleBoxTexture_djvj8")
is_Scale = true is_Scale = true
size_max = 1.2
[node name="TextureRect" type="TextureRect" parent="HBoxContainer/VBoxContainer/margin/VBoxContainer/HBoxContainer3/VBoxContainer2/HBoxContainer/WsConnectButton"] [node name="TextureRect" type="TextureRect" parent="HBoxContainer/VBoxContainer/margin/VBoxContainer/HBoxContainer3/VBoxContainer2/HBoxContainer/WsConnectButton"]
layout_mode = 1 layout_mode = 1
@ -587,6 +617,7 @@ theme_override_constants/separation = 0
[node name="Label" type="Label" parent="HBoxContainer/VBoxContainer/RightBottonPanel/VBoxContainer/HBoxContainer"] [node name="Label" type="Label" parent="HBoxContainer/VBoxContainer/RightBottonPanel/VBoxContainer/HBoxContainer"]
layout_mode = 2 layout_mode = 2
theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1)
theme_override_font_sizes/font_size = 32 theme_override_font_sizes/font_size = 32
text = "VCU固件版本" text = "VCU固件版本"
vertical_alignment = 1 vertical_alignment = 1
@ -595,6 +626,7 @@ vertical_alignment = 1
unique_name_in_owner = true unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1)
theme_override_font_sizes/font_size = 32 theme_override_font_sizes/font_size = 32
text = "1.1.1" text = "1.1.1"
horizontal_alignment = 2 horizontal_alignment = 2
@ -606,6 +638,7 @@ layout_mode = 2
[node name="Label3" type="Label" parent="HBoxContainer/VBoxContainer/RightBottonPanel/VBoxContainer/HBoxContainer"] [node name="Label3" type="Label" parent="HBoxContainer/VBoxContainer/RightBottonPanel/VBoxContainer/HBoxContainer"]
layout_mode = 2 layout_mode = 2
theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1)
theme_override_font_sizes/font_size = 31 theme_override_font_sizes/font_size = 31
text = "自动驾驶版本:" text = "自动驾驶版本:"
horizontal_alignment = 1 horizontal_alignment = 1
@ -615,6 +648,7 @@ vertical_alignment = 1
unique_name_in_owner = true unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1)
theme_override_font_sizes/font_size = 32 theme_override_font_sizes/font_size = 32
text = "1.1.1" text = "1.1.1"
horizontal_alignment = 2 horizontal_alignment = 2
@ -630,6 +664,7 @@ layout_mode = 2
[node name="Label" type="Label" parent="HBoxContainer/VBoxContainer/RightBottonPanel/VBoxContainer/HBoxContainer2"] [node name="Label" type="Label" parent="HBoxContainer/VBoxContainer/RightBottonPanel/VBoxContainer/HBoxContainer2"]
layout_mode = 2 layout_mode = 2
theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1)
theme_override_font_sizes/font_size = 32 theme_override_font_sizes/font_size = 32
text = "OTA升级" text = "OTA升级"
vertical_alignment = 1 vertical_alignment = 1
@ -649,6 +684,7 @@ anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1)
theme_override_font_sizes/font_size = 32 theme_override_font_sizes/font_size = 32
text = "检查更新" text = "检查更新"
horizontal_alignment = 1 horizontal_alignment = 1

View File

@ -1,3 +1,4 @@
@tool
extends BaseControl extends BaseControl
@export var TextureNormal :Texture2D @export var TextureNormal :Texture2D

View File

@ -2,6 +2,8 @@ extends MarginContainer
@export var item1:String="default1" @export var item1:String="default1"
@export var item2:String="default_2" @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 @onready var texture_rect: TextureRect = $Control/TextureRect
#需要连接信号的节点数组 #需要连接信号的节点数组
@ -10,6 +12,12 @@ signal Onclick(State:int)
var SelectNode = null: var SelectNode = null:
set(value): set(value):
if value != SelectNode: 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() 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, "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) 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/Item1/item_name.text=item1
$HBoxContainer/Item2/item_name.text=item2 $HBoxContainer/Item2/item_name.text=item2
await get_tree().create_timer(0.1).timeout 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: for node : BaseControl in nodearr:
node.on_click.connect(func(_node): node.on_click.connect(func(_node):
if !OnClickIsCooling: if !OnClickIsCooling:

View File

@ -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