This commit is contained in:
shurongsen 2024-12-20 12:13:03 +08:00
parent 020b8d6bba
commit fc0a8786bf
12 changed files with 69 additions and 21 deletions

BIN
.DS_Store vendored

Binary file not shown.

Binary file not shown.

View File

@ -17,7 +17,7 @@ func _ready() -> void:
func ReviseThrottle(value):
speedometer._value += value
speedometer._value = clampi(speedometer._value,0,30)
speedometer._value = clampi(speedometer._value,0,50)
throttle_position_label.onScale()
gear_texture_rect.onScale()
throttle_position_label.text = str(speedometer._value)

View File

@ -1,9 +1,10 @@
[gd_scene load_steps=15 format=3 uid="uid://ccp1epic52e7k"]
[gd_scene load_steps=16 format=3 uid="uid://ccp1epic52e7k"]
[ext_resource type="Script" path="res://Modules/SpeedGearAdjustment.gd" id="1_8ml6x"]
[ext_resource type="Texture2D" uid="uid://pomyaut6jtnm" path="res://yuan.png" id="2_5b01c"]
[ext_resource type="Script" path="res://code/speedometer.gd" id="3_xaims"]
[ext_resource type="Texture2D" uid="uid://bgi2o6nm16ycn" path="res://pad_hmi_ui/home/l3_12.png" id="4_d48gs"]
[ext_resource type="Texture2D" uid="uid://d1obqtkp5s7c3" path="res://pad_hmi_ui/home/banyuan.png" id="4_wrpt8"]
[ext_resource type="Texture2D" uid="uid://0car70lmas3a" path="res://pad_hmi_ui/home/speed_icon.png" id="5_qnams"]
[ext_resource type="Texture2D" uid="uid://bbl68xb2d0ne2" path="res://pad_hmi_ui/home/minus_btn.png" id="6_0j1yn"]
[ext_resource type="Script" path="res://common/base/base_control.gd" id="7_smylr"]
@ -92,7 +93,7 @@ void fragment() {
"
[sub_resource type="Gradient" id="Gradient_b6vfa"]
offsets = PackedFloat32Array(0, 0.258706, 0.457711, 1)
offsets = PackedFloat32Array(0, 0.258706, 0.512195, 1)
colors = PackedColorArray(0.968627, 0.686275, 0.945098, 1, 0.498039, 0.314018, 0.990752, 1, 0.443137, 0.270588, 0.996078, 1, 0.968627, 0.686275, 0.945098, 1)
[sub_resource type="GradientTexture1D" id="GradientTexture1D_ghtxh"]
@ -103,7 +104,7 @@ shader = SubResource("Shader_f57hx")
shader_parameter/value = 0.0
shader_parameter/segments = 1
shader_parameter/radius = 0.5
shader_parameter/hollow_radius = 0.465
shader_parameter/hollow_radius = 0.46
shader_parameter/margin = 0.0
shader_parameter/rotation = 0.167
shader_parameter/progress_rotation = -1.0
@ -117,6 +118,8 @@ _data = {
point_count = 30
[node name="MarginContainer2" type="MarginContainer"]
offset_right = 406.0
offset_bottom = 465.0
theme_override_constants/margin_top = 59
script = ExtResource("1_8ml6x")
@ -130,7 +133,16 @@ fill_mode = 4
radial_initial_angle = 180.0
texture_progress = ExtResource("2_5b01c")
script = ExtResource("3_xaims")
_max_value = 30.0
_max_value = 50.0
[node name="TextureRect" type="TextureRect" parent="Speedometer"]
layout_mode = 0
offset_left = 95.0
offset_top = 361.0
offset_right = 135.0
offset_bottom = 401.0
scale = Vector2(0.465, 0.465)
texture = ExtResource("4_wrpt8")
[node name="TextureRect2" type="TextureRect" parent="Speedometer"]
show_behind_parent = true
@ -143,10 +155,10 @@ texture = ExtResource("4_d48gs")
[node name="GearTextureRect" type="TextureRect" parent="Speedometer"]
layout_mode = 0
offset_left = 84.0
offset_top = 353.0
offset_right = 118.0
offset_bottom = 387.0
offset_left = 84.0023
offset_top = 352.991
offset_right = 118.002
offset_bottom = 386.991
pivot_offset = Vector2(17, 17)
texture = ExtResource("5_qnams")
script = ExtResource("7_smylr")
@ -223,7 +235,7 @@ text = "/"
[node name="Label3" type="Label" parent="VBoxContainer/HBoxContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 34
text = "30"
text = "50"
[node name="Label" type="Label" parent="VBoxContainer"]
layout_mode = 2

View File

@ -547,8 +547,8 @@ layout_mode = 2
focus_mode = 0
flat = true
script = ExtResource("10_jyc6b")
TextureNormal = ExtResource("11_g12mf")
TexturePressed = ExtResource("12_3rn0r")
TextureNormal = ExtResource("12_3rn0r")
TexturePressed = ExtResource("11_g12mf")
styleBox = SubResource("StyleBoxTexture_12j7c")
is_Scale = true
size_max = 1.2

View File

@ -4,6 +4,7 @@ extends BaseControl
@export var TexturePressed : Texture2D
#用来播放动画的tween
var animation_tween
@export var texture_rect: TextureRect
##闪烁时间间隔
@export var flicker_time:float=0.2
@ -12,18 +13,18 @@ func _ready() -> void:
self.button_down.connect(_on_button_down)
self.button_up.connect(_on_button_up)
self.on_click.connect(_on_click)
$TextureRect.texture=TextureNormal
texture_rect.texture=TextureNormal
self.flat=true
pass
func _on_button_down() -> void:
$TextureRect.texture=TexturePressed
texture_rect.texture=TexturePressed
pass # Replace with function body.
func _on_button_up() -> void:
$TextureRect.texture=TextureNormal
texture_rect.texture=TextureNormal
pass # Replace with function body.
var is_select:bool:
@ -50,7 +51,7 @@ var is_select:bool:
func set_texture(texture:Texture2D):
$TextureRect.texture=texture
texture_rect.texture=texture
func _on_click(node):
is_select=not is_select

View File

@ -9,8 +9,8 @@ func _ready() -> void:
func _physics_process(delta: float) -> void:
h_slider.value = clampi(h_slider.value,40,140)
if h_slider.value <= 40:
#h_slider.value = clampi(h_slider.value,40,140)
if h_slider.value <= 0:
texture_rect.texture = load("res://pad_hmi_ui/home/mute_icon.png")
else:
texture_rect.texture = load("res://pad_hmi_ui/home/sound_icon.png")

View File

@ -14,10 +14,12 @@ texture = ExtResource("1_q53pk")
texture = ExtResource("2_q2e4s")
texture_margin_left = 46.0
texture_margin_right = 42.0
expand_margin_top = 46.0
expand_margin_bottom = 52.0
expand_margin_top = 47.0
expand_margin_bottom = 53.0
[node name="VolumeSettings" type="MarginContainer"]
offset_right = 594.0
offset_bottom = 103.0
theme_override_constants/margin_left = 14
script = ExtResource("1_weo36")
@ -31,7 +33,6 @@ theme_override_icons/tick = ExtResource("1_q53pk")
theme_override_styles/slider = SubResource("StyleBoxTexture_rir4m")
theme_override_styles/grabber_area = SubResource("StyleBoxTexture_h6qwb")
theme_override_styles/grabber_area_highlight = SubResource("StyleBoxTexture_h6qwb")
max_value = 140.0
value = 100.0
[node name="TextureRect" type="TextureRect" parent="HSlider"]

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 472 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://d1obqtkp5s7c3"
path="res://.godot/imported/banyuan.png-fdd1df4c3de99ce4fee9340c3c88eace.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://pad_hmi_ui/home/banyuan.png"
dest_files=["res://.godot/imported/banyuan.png-fdd1df4c3de99ce4fee9340c3c88eace.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 966 B