1,测试多种方式实现车站钥匙交互;2,添加三维场景及按钮测试通过按钮打开钥匙交互窗口

This commit is contained in:
soul-walker 2024-04-10 11:47:13 +08:00
commit b94ebf3420
33 changed files with 995 additions and 0 deletions

2
.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
# Godot 4+ specific ignores
.godot/
target/
dist/

BIN
Assets/FeiHuaSongTi-2.ttf Normal file

Binary file not shown.

View File

@ -0,0 +1,33 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://bkbpyidjguavf"
path="res://.godot/imported/FeiHuaSongTi-2.ttf-7249022ef8c1b3b8e5297415039f75d2.fontdata"
[deps]
source_file="res://Assets/FeiHuaSongTi-2.ttf"
dest_files=["res://.godot/imported/FeiHuaSongTi-2.ttf-7249022ef8c1b3b8e5297415039f75d2.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=1
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

BIN
Assets/LCB钥匙.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c3dplk5y1607u"
path="res://.godot/imported/LCB钥匙.png-9a0b8dd0d914e7c33c51a8a09ab46110.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/LCB钥匙.png"
dest_files=["res://.godot/imported/LCB钥匙.png-9a0b8dd0d914e7c33c51a8a09ab46110.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

BIN
Assets/PSL钥匙.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bo00i4cjotiha"
path="res://.godot/imported/PSL钥匙.png-d3252c10291876cca496a7f14f20ef6d.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/PSL钥匙.png"
dest_files=["res://.godot/imported/PSL钥匙.png-d3252c10291876cca496a7f14f20ef6d.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.

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://t2bidn6kf7rd"
path="res://.godot/imported/手动解锁钥匙.png-c668594920f324d336cafd40bf6718db.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/手动解锁钥匙.png"
dest_files=["res://.godot/imported/手动解锁钥匙.png-c668594920f324d336cafd40bf6718db.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.

After

Width:  |  Height:  |  Size: 6.1 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://chqfr27o61tfd"
path="res://.godot/imported/紧急停车钥匙.png-e6b97eb0adfba7fbc4c1e4a00ec04880.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/紧急停车钥匙.png"
dest_files=["res://.godot/imported/紧急停车钥匙.png-e6b97eb0adfba7fbc4c1e4a00ec04880.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

83
UI/panel_container.tscn Normal file
View File

@ -0,0 +1,83 @@
[gd_scene load_steps=10 format=3 uid="uid://b7k8341jwy22f"]
[ext_resource type="PackedScene" uid="uid://bsr40ogx2e2ir" path="res://UI/station_keys/jjtc_key_control.tscn" id="1_taymr"]
[ext_resource type="Theme" uid="uid://bycedcl2nwwlu" path="res://ui_theme.tres" id="1_vlsle"]
[ext_resource type="PackedScene" uid="uid://dkqnt73pyqgwj" path="res://UI/station_keys/lcb1_key_control.tscn" id="2_a6b1q"]
[ext_resource type="PackedScene" uid="uid://63r8gueubu2q" path="res://UI/station_keys/lcb2_key_control.tscn" id="3_8astu"]
[ext_resource type="PackedScene" uid="uid://biwdpy5pifxgi" path="res://UI/station_keys/lcb_key_control.tscn" id="4_dahi7"]
[ext_resource type="PackedScene" uid="uid://dnmfwdvba6td3" path="res://UI/station_keys/psl_key_control.tscn" id="5_n4mmv"]
[ext_resource type="PackedScene" uid="uid://cjjs2fsw6i8ye" path="res://UI/station_keys/sdjs_key_control.tscn" id="6_7pwvh"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_eooev"]
bg_color = Color(0, 0, 0, 0.235294)
border_width_left = 2
border_width_top = 2
border_width_right = 2
border_width_bottom = 2
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_nu4ha"]
bg_color = Color(0, 0, 0, 0.352941)
[node name="PanelContainer" type="PanelContainer"]
offset_right = 368.0
offset_bottom = 232.0
theme_override_styles/panel = SubResource("StyleBoxFlat_eooev")
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 2
[node name="PanelContainer" type="PanelContainer" parent="VBoxContainer"]
layout_mode = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_nu4ha")
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/PanelContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="VBoxContainer/PanelContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 3.0
text = "标题"
horizontal_alignment = 1
[node name="Button" type="Button" parent="VBoxContainer/PanelContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 8
focus_mode = 0
theme = ExtResource("1_vlsle")
text = "X"
[node name="GridContainer" type="GridContainer" parent="VBoxContainer"]
layout_mode = 2
columns = 4
[node name="JJTC_Key" parent="VBoxContainer/GridContainer" instance=ExtResource("1_taymr")]
layout_mode = 2
[node name="LCB1_Key" parent="VBoxContainer/GridContainer" instance=ExtResource("2_a6b1q")]
layout_mode = 2
[node name="LCB2_Key" parent="VBoxContainer/GridContainer" instance=ExtResource("3_8astu")]
layout_mode = 2
[node name="LCB3_Key" parent="VBoxContainer/GridContainer" instance=ExtResource("4_dahi7")]
layout_mode = 2
[node name="PSL_Key" parent="VBoxContainer/GridContainer" instance=ExtResource("5_n4mmv")]
layout_mode = 2
[node name="SDJS_Key" parent="VBoxContainer/GridContainer" instance=ExtResource("6_7pwvh")]
layout_mode = 2
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer"]
layout_mode = 2
theme_override_constants/margin_top = 30
theme_override_constants/margin_bottom = 0
[node name="Button" type="Button" parent="VBoxContainer/MarginContainer"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
focus_mode = 0
theme_override_font_sizes/font_size = 24
text = "确认"

50
UI/sta3ABD.tmp Normal file
View File

@ -0,0 +1,50 @@
[gd_scene load_steps=6 format=3 uid="uid://ddtqwspx8ivry"]
[ext_resource type="Script" path="res://UI/station_keys.gd" id="1_ovslt"]
[ext_resource type="PackedScene" uid="uid://b76vohiqtooks" path="res://UI/em_key.tscn" id="4_0l66e"]
[ext_resource type="PackedScene" uid="uid://bvuns248nsafw" path="res://UI/sdjs_key.tscn" id="5_lp0t8"]
[ext_resource type="PackedScene" uid="uid://brof6p4eyjx4r" path="res://UI/psl_key.tscn" id="5_mtxat"]
[ext_resource type="PackedScene" uid="uid://bo27xj60duv1n" path="res://UI/lcb_key.tscn" id="6_h4yyj"]
[node name="StationKeys" type="Node"]
script = ExtResource("1_ovslt")
[node name="PopupPanel" type="Window" parent="."]
snap_2d_transforms_to_pixel = true
title = "请选择钥匙"
position = Vector2i(27, 100)
size = Vector2i(600, 400)
mouse_passthrough_polygon = PackedVector2Array(0, 0, 400, 0, 400, 400, 0, 400)
unresizable = true
transparent = true
extend_to_title = true
keep_title_visible = true
[node name="SDJS_Key" parent="PopupPanel" instance=ExtResource("5_lp0t8")]
position = Vector2(80, 72)
[node name="PSL_Key" parent="PopupPanel" instance=ExtResource("5_mtxat")]
position = Vector2(217, 72)
[node name="EM_Key" parent="PopupPanel" instance=ExtResource("4_0l66e")]
position = Vector2(336, 72)
[node name="LCB_Key" parent="PopupPanel" instance=ExtResource("6_h4yyj")]
position = Vector2(464, 72)
[node name="LCB_Key2" parent="PopupPanel" instance=ExtResource("6_h4yyj")]
position = Vector2(80, 248)
[node name="LCB_Key3" parent="PopupPanel" instance=ExtResource("6_h4yyj")]
position = Vector2(215, 248)
[node name="LCB_Key4" parent="PopupPanel" instance=ExtResource("6_h4yyj")]
position = Vector2(336, 248)
[connection signal="focus_changed" from="PopupPanel/SDJS_Key" to="." method="_on_key_focus_changed"]
[connection signal="focus_changed" from="PopupPanel/PSL_Key" to="." method="_on_key_focus_changed"]
[connection signal="focus_changed" from="PopupPanel/EM_Key" to="." method="_on_key_focus_changed"]
[connection signal="focus_changed" from="PopupPanel/LCB_Key" to="." method="_on_key_focus_changed"]
[connection signal="focus_changed" from="PopupPanel/LCB_Key2" to="." method="_on_key_focus_changed"]
[connection signal="focus_changed" from="PopupPanel/LCB_Key3" to="." method="_on_key_focus_changed"]
[connection signal="focus_changed" from="PopupPanel/LCB_Key4" to="." method="_on_key_focus_changed"]

50
UI/staD9F.tmp Normal file
View File

@ -0,0 +1,50 @@
[gd_scene load_steps=6 format=3 uid="uid://ddtqwspx8ivry"]
[ext_resource type="Script" path="res://UI/station_keys.gd" id="1_ovslt"]
[ext_resource type="PackedScene" uid="uid://b76vohiqtooks" path="res://UI/em_key.tscn" id="4_0l66e"]
[ext_resource type="PackedScene" uid="uid://bvuns248nsafw" path="res://UI/sdjs_key.tscn" id="5_lp0t8"]
[ext_resource type="PackedScene" uid="uid://brof6p4eyjx4r" path="res://UI/psl_key.tscn" id="5_mtxat"]
[ext_resource type="PackedScene" uid="uid://bo27xj60duv1n" path="res://UI/lcb_key.tscn" id="6_h4yyj"]
[node name="StationKeys" type="Node"]
script = ExtResource("1_ovslt")
[node name="PopupPanel" type="Window" parent="."]
disable_3d = true
handle_input_locally = false
gui_snap_controls_to_pixels = false
title = "请选择钥匙"
position = Vector2i(0, 33)
size = Vector2i(600, 400)
unresizable = true
transparent = true
extend_to_title = true
[node name="SDJS_Key" parent="PopupPanel" instance=ExtResource("5_lp0t8")]
position = Vector2(80, 72)
[node name="PSL_Key" parent="PopupPanel" instance=ExtResource("5_mtxat")]
position = Vector2(217, 72)
[node name="EM_Key" parent="PopupPanel" instance=ExtResource("4_0l66e")]
position = Vector2(336, 72)
[node name="LCB_Key" parent="PopupPanel" instance=ExtResource("6_h4yyj")]
position = Vector2(464, 72)
[node name="LCB_Key2" parent="PopupPanel" instance=ExtResource("6_h4yyj")]
position = Vector2(80, 248)
[node name="LCB_Key3" parent="PopupPanel" instance=ExtResource("6_h4yyj")]
position = Vector2(215, 248)
[node name="LCB_Key4" parent="PopupPanel" instance=ExtResource("6_h4yyj")]
position = Vector2(336, 248)
[connection signal="focus_changed" from="PopupPanel/SDJS_Key" to="." method="_on_key_focus_changed"]
[connection signal="focus_changed" from="PopupPanel/PSL_Key" to="." method="_on_key_focus_changed"]
[connection signal="focus_changed" from="PopupPanel/EM_Key" to="." method="_on_key_focus_changed"]
[connection signal="focus_changed" from="PopupPanel/LCB_Key" to="." method="_on_key_focus_changed"]
[connection signal="focus_changed" from="PopupPanel/LCB_Key2" to="." method="_on_key_focus_changed"]
[connection signal="focus_changed" from="PopupPanel/LCB_Key3" to="." method="_on_key_focus_changed"]
[connection signal="focus_changed" from="PopupPanel/LCB_Key4" to="." method="_on_key_focus_changed"]

47
UI/stand.tscn Normal file
View File

@ -0,0 +1,47 @@
[gd_scene load_steps=6 format=3 uid="uid://d1lavjoj2lsgo"]
[ext_resource type="PackedScene" uid="uid://d167och8l6jms" path="res://UI/station_keys/station_keys_window.tscn" id="1_2e5v0"]
[ext_resource type="PackedScene" uid="uid://b7k8341jwy22f" path="res://UI/panel_container.tscn" id="1_jhtk0"]
[sub_resource type="BoxShape3D" id="BoxShape3D_qpl3n"]
size = Vector3(60, 2, 60)
[sub_resource type="BoxMesh" id="BoxMesh_n702p"]
size = Vector3(60, 2, 60)
[sub_resource type="CapsuleMesh" id="CapsuleMesh_tlxkr"]
[node name="Node3D" type="Node3D"]
[node name="Ground" type="StaticBody3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0)
[node name="CollisionShape3D" type="CollisionShape3D" parent="Ground"]
shape = SubResource("BoxShape3D_qpl3n")
[node name="MeshInstance3D" type="MeshInstance3D" parent="Ground"]
mesh = SubResource("BoxMesh_n702p")
[node name="Camera3D" type="Camera3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.5, 0.866025, 0, -0.866025, 0.5, 0, 9, 11)
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 15, 0)
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
transform = Transform3D(1.6, 0, 0, 0, 2.24, 0, 0, 0, 1.6, -11, 1, -2)
mesh = SubResource("CapsuleMesh_tlxkr")
[node name="PSL_Button" type="Button" parent="."]
offset_left = 144.0
offset_top = 132.0
offset_right = 180.0
offset_bottom = 163.0
text = "PSL"
[node name="PanelContainer" parent="." instance=ExtResource("1_jhtk0")]
visible = false
[node name="Window" parent="." instance=ExtResource("1_2e5v0")]
[connection signal="pressed" from="PSL_Button" to="Window" method="_on_show_button_pressed"]

View File

@ -0,0 +1,37 @@
[gd_scene load_steps=5 format=3 uid="uid://bsr40ogx2e2ir"]
[ext_resource type="Texture2D" uid="uid://chqfr27o61tfd" path="res://Assets/紧急停车钥匙.png" id="1_qplpj"]
[ext_resource type="Script" path="res://UI/station_keys/outlined_key.gd" id="2_sjhee"]
[ext_resource type="Shader" path="res://shaders/outline.gdshader" id="3_fy1lu"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_0dtby"]
shader = ExtResource("3_fy1lu")
shader_parameter/color = Color(0, 1, 1, 1)
shader_parameter/width = 3.0
shader_parameter/pattern = 1
shader_parameter/inside = false
shader_parameter/add_margins = true
shader_parameter/number_of_images = Vector2(1, 1)
[node name="JJTC_Key" type="VBoxContainer"]
offset_right = 128.0
offset_bottom = 155.0
focus_mode = 1
script = ExtResource("2_sjhee")
outline_material = SubResource("ShaderMaterial_0dtby")
[node name="Key" type="TextureRect" parent="."]
unique_name_in_owner = true
layout_mode = 2
focus_mode = 2
texture = ExtResource("1_qplpj")
[node name="Label" type="Label" parent="."]
layout_mode = 2
size_flags_horizontal = 4
text = "紧急停车钥匙"
[connection signal="focus_entered" from="Key" to="." method="_on_focus_entered"]
[connection signal="focus_exited" from="Key" to="." method="_on_focus_exited"]
[connection signal="mouse_entered" from="Key" to="." method="_on_area_2d_mouse_entered"]
[connection signal="mouse_exited" from="Key" to="." method="_on_area_2d_mouse_exited"]

View File

@ -0,0 +1,37 @@
[gd_scene load_steps=5 format=3 uid="uid://dkqnt73pyqgwj"]
[ext_resource type="Script" path="res://UI/station_keys/outlined_key.gd" id="1_5bwgk"]
[ext_resource type="Shader" path="res://shaders/outline.gdshader" id="2_bgq1b"]
[ext_resource type="Texture2D" uid="uid://c3dplk5y1607u" path="res://Assets/LCB钥匙.png" id="3_5sgan"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_0dtby"]
shader = ExtResource("2_bgq1b")
shader_parameter/color = Color(0, 1, 1, 1)
shader_parameter/width = 3.0
shader_parameter/pattern = 1
shader_parameter/inside = false
shader_parameter/add_margins = true
shader_parameter/number_of_images = Vector2(1, 1)
[node name="LCB_Key" type="VBoxContainer"]
offset_right = 128.0
offset_bottom = 155.0
focus_mode = 1
script = ExtResource("1_5bwgk")
outline_material = SubResource("ShaderMaterial_0dtby")
[node name="Key" type="TextureRect" parent="."]
unique_name_in_owner = true
layout_mode = 2
focus_mode = 2
texture = ExtResource("3_5sgan")
[node name="Label" type="Label" parent="."]
layout_mode = 2
size_flags_horizontal = 4
text = "LCB钥匙"
[connection signal="focus_entered" from="Key" to="." method="_on_focus_entered"]
[connection signal="focus_exited" from="Key" to="." method="_on_focus_exited"]
[connection signal="mouse_entered" from="Key" to="." method="_on_area_2d_mouse_entered"]
[connection signal="mouse_exited" from="Key" to="." method="_on_area_2d_mouse_exited"]

View File

@ -0,0 +1,37 @@
[gd_scene load_steps=5 format=3 uid="uid://63r8gueubu2q"]
[ext_resource type="Script" path="res://UI/station_keys/outlined_key.gd" id="1_f23n4"]
[ext_resource type="Shader" path="res://shaders/outline.gdshader" id="2_op1qj"]
[ext_resource type="Texture2D" uid="uid://c3dplk5y1607u" path="res://Assets/LCB钥匙.png" id="3_2ad7b"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_0dtby"]
shader = ExtResource("2_op1qj")
shader_parameter/color = Color(0, 1, 1, 1)
shader_parameter/width = 3.0
shader_parameter/pattern = 1
shader_parameter/inside = false
shader_parameter/add_margins = true
shader_parameter/number_of_images = Vector2(1, 1)
[node name="LCB_Key" type="VBoxContainer"]
offset_right = 128.0
offset_bottom = 155.0
focus_mode = 1
script = ExtResource("1_f23n4")
outline_material = SubResource("ShaderMaterial_0dtby")
[node name="Key" type="TextureRect" parent="."]
unique_name_in_owner = true
layout_mode = 2
focus_mode = 2
texture = ExtResource("3_2ad7b")
[node name="Label" type="Label" parent="."]
layout_mode = 2
size_flags_horizontal = 4
text = "LCB钥匙"
[connection signal="focus_entered" from="Key" to="." method="_on_focus_entered"]
[connection signal="focus_exited" from="Key" to="." method="_on_focus_exited"]
[connection signal="mouse_entered" from="Key" to="." method="_on_area_2d_mouse_entered"]
[connection signal="mouse_exited" from="Key" to="." method="_on_area_2d_mouse_exited"]

View File

@ -0,0 +1,37 @@
[gd_scene load_steps=5 format=3 uid="uid://biwdpy5pifxgi"]
[ext_resource type="Script" path="res://UI/station_keys/outlined_key.gd" id="1_f23gc"]
[ext_resource type="Shader" path="res://shaders/outline.gdshader" id="2_uecg5"]
[ext_resource type="Texture2D" uid="uid://c3dplk5y1607u" path="res://Assets/LCB钥匙.png" id="3_dqlco"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_0dtby"]
shader = ExtResource("2_uecg5")
shader_parameter/color = Color(0, 1, 1, 1)
shader_parameter/width = 3.0
shader_parameter/pattern = 1
shader_parameter/inside = false
shader_parameter/add_margins = true
shader_parameter/number_of_images = Vector2(1, 1)
[node name="LCB_Key" type="VBoxContainer"]
offset_right = 128.0
offset_bottom = 155.0
focus_mode = 1
script = ExtResource("1_f23gc")
outline_material = SubResource("ShaderMaterial_0dtby")
[node name="Key" type="TextureRect" parent="."]
unique_name_in_owner = true
layout_mode = 2
focus_mode = 2
texture = ExtResource("3_dqlco")
[node name="Label" type="Label" parent="."]
layout_mode = 2
size_flags_horizontal = 4
text = "LCB钥匙"
[connection signal="focus_entered" from="Key" to="." method="_on_focus_entered"]
[connection signal="focus_exited" from="Key" to="." method="_on_focus_exited"]
[connection signal="mouse_entered" from="Key" to="." method="_on_area_2d_mouse_entered"]
[connection signal="mouse_exited" from="Key" to="." method="_on_area_2d_mouse_exited"]

View File

@ -0,0 +1,42 @@
extends VBoxContainer
## 外轮廓线凸显shader材质
@export var outline_material: ShaderMaterial
## 鼠标进入范围外轮廓线颜色
static var ENTERED_COLOR = Vector4(0, 1.0, 1.0, 0.5)
## 聚焦时外轮廓线颜色
static var FOCUS_COLOR = Vector4(0, 1.0, 1.0, 1)
signal on_focus
var focus: bool = false
## 鼠标进入检测范围
func _on_area_2d_mouse_entered():
if not focus:
outline_material.set_shader_parameter("color", ENTERED_COLOR)
%Key.material = outline_material
## 鼠标离开检测范围
func _on_area_2d_mouse_exited():
if not focus:
%Key.material = null
func _on_focus_entered():
focus = true
on_focus.emit(self)
outline_material.set_shader_parameter("color", FOCUS_COLOR)
%Key.material = outline_material
func _on_focus_exited():
focus = false
%Key.material = null
func hide_key():
%Key.modulate.a = 0
func show_key():
%Key.modulate.a = 255

View File

@ -0,0 +1,37 @@
[gd_scene load_steps=5 format=3 uid="uid://dnmfwdvba6td3"]
[ext_resource type="Texture2D" uid="uid://bo00i4cjotiha" path="res://Assets/PSL钥匙.png" id="1_mk67g"]
[ext_resource type="Script" path="res://UI/station_keys/outlined_key.gd" id="2_04vl8"]
[ext_resource type="Shader" path="res://shaders/outline.gdshader" id="3_cglet"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_0dtby"]
shader = ExtResource("3_cglet")
shader_parameter/color = Color(0, 1, 1, 1)
shader_parameter/width = 3.0
shader_parameter/pattern = 1
shader_parameter/inside = false
shader_parameter/add_margins = true
shader_parameter/number_of_images = Vector2(1, 1)
[node name="PSL_Key" type="VBoxContainer"]
offset_right = 128.0
offset_bottom = 155.0
focus_mode = 1
script = ExtResource("2_04vl8")
outline_material = SubResource("ShaderMaterial_0dtby")
[node name="Key" type="TextureRect" parent="."]
unique_name_in_owner = true
layout_mode = 2
focus_mode = 2
texture = ExtResource("1_mk67g")
[node name="Label" type="Label" parent="."]
layout_mode = 2
size_flags_horizontal = 4
text = "PSL钥匙"
[connection signal="focus_entered" from="Key" to="." method="_on_focus_entered"]
[connection signal="focus_exited" from="Key" to="." method="_on_focus_exited"]
[connection signal="mouse_entered" from="Key" to="." method="_on_area_2d_mouse_entered"]
[connection signal="mouse_exited" from="Key" to="." method="_on_area_2d_mouse_exited"]

View File

@ -0,0 +1,37 @@
[gd_scene load_steps=5 format=3 uid="uid://cjjs2fsw6i8ye"]
[ext_resource type="Texture2D" uid="uid://t2bidn6kf7rd" path="res://Assets/手动解锁钥匙.png" id="1_q15ly"]
[ext_resource type="Script" path="res://UI/station_keys/outlined_key.gd" id="2_hf0aq"]
[ext_resource type="Shader" path="res://shaders/outline.gdshader" id="3_dxun7"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_0dtby"]
shader = ExtResource("3_dxun7")
shader_parameter/color = Color(0, 1, 1, 1)
shader_parameter/width = 3.0
shader_parameter/pattern = 1
shader_parameter/inside = false
shader_parameter/add_margins = true
shader_parameter/number_of_images = Vector2(1, 1)
[node name="SDJS_Key" type="VBoxContainer"]
offset_right = 128.0
offset_bottom = 155.0
focus_mode = 1
script = ExtResource("2_hf0aq")
outline_material = SubResource("ShaderMaterial_0dtby")
[node name="Key" type="TextureRect" parent="."]
unique_name_in_owner = true
layout_mode = 2
focus_mode = 2
texture = ExtResource("1_q15ly")
[node name="Label" type="Label" parent="."]
layout_mode = 2
size_flags_horizontal = 4
text = "手动解锁钥匙"
[connection signal="focus_entered" from="Key" to="." method="_on_focus_entered"]
[connection signal="focus_exited" from="Key" to="." method="_on_focus_exited"]
[connection signal="mouse_entered" from="Key" to="." method="_on_area_2d_mouse_entered"]
[connection signal="mouse_exited" from="Key" to="." method="_on_area_2d_mouse_exited"]

View File

@ -0,0 +1,25 @@
extends Window
var current_focus: CanvasItem
func _on_key_focus_entered(node):
current_focus = node
print("node : ", current_focus.name, " focus")
func _on_button_pressed():
if current_focus == null:
print("请选择钥匙")
else:
print("使用钥匙:", current_focus.name)
current_focus.hide_key()
func _on_close_requested():
print("close req")
self.hide()
func _on_show_button_pressed():
self.show()

View File

@ -0,0 +1,83 @@
[gd_scene load_steps=11 format=3 uid="uid://d167och8l6jms"]
[ext_resource type="Theme" uid="uid://bycedcl2nwwlu" path="res://ui_theme.tres" id="1_gct42"]
[ext_resource type="PackedScene" uid="uid://dnmfwdvba6td3" path="res://UI/station_keys/psl_key_control.tscn" id="1_pwbsc"]
[ext_resource type="PackedScene" uid="uid://cjjs2fsw6i8ye" path="res://UI/station_keys/sdjs_key_control.tscn" id="1_wmags"]
[ext_resource type="Script" path="res://UI/station_keys/station_keys_window.gd" id="1_x7tnv"]
[ext_resource type="PackedScene" uid="uid://bsr40ogx2e2ir" path="res://UI/station_keys/jjtc_key_control.tscn" id="2_cndsv"]
[ext_resource type="PackedScene" uid="uid://dkqnt73pyqgwj" path="res://UI/station_keys/lcb1_key_control.tscn" id="2_h8ap0"]
[ext_resource type="FontFile" uid="uid://bkbpyidjguavf" path="res://Assets/FeiHuaSongTi-2.ttf" id="2_mlqh2"]
[ext_resource type="PackedScene" uid="uid://biwdpy5pifxgi" path="res://UI/station_keys/lcb_key_control.tscn" id="2_xelwb"]
[ext_resource type="PackedScene" uid="uid://63r8gueubu2q" path="res://UI/station_keys/lcb2_key_control.tscn" id="3_0e67u"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_1w22c"]
[node name="Window" type="Window"]
title = "请选择钥匙"
position = Vector2i(10, 36)
size = Vector2i(532, 426)
wrap_controls = true
unresizable = true
transparent = true
theme = ExtResource("1_gct42")
theme_override_fonts/title_font = ExtResource("2_mlqh2")
script = ExtResource("1_x7tnv")
[node name="PanelContainer" type="PanelContainer" parent="."]
offset_left = 4.0
offset_top = 4.0
offset_right = 528.0
offset_bottom = 404.0
theme_override_styles/panel = SubResource("StyleBoxEmpty_1w22c")
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer"]
layout_mode = 2
[node name="GridContainer" type="GridContainer" parent="PanelContainer/VBoxContainer"]
layout_mode = 2
columns = 4
[node name="JJTC_Key" parent="PanelContainer/VBoxContainer/GridContainer" instance=ExtResource("2_cndsv")]
layout_mode = 2
tooltip_text = "紧急停车钥匙"
[node name="LCB1_Key" parent="PanelContainer/VBoxContainer/GridContainer" instance=ExtResource("2_h8ap0")]
layout_mode = 2
[node name="LCB2_Key" parent="PanelContainer/VBoxContainer/GridContainer" instance=ExtResource("3_0e67u")]
layout_mode = 2
[node name="LCB2_Key2" parent="PanelContainer/VBoxContainer/GridContainer" instance=ExtResource("3_0e67u")]
layout_mode = 2
[node name="LCB3_Key" parent="PanelContainer/VBoxContainer/GridContainer" instance=ExtResource("2_xelwb")]
layout_mode = 2
[node name="PSL_Key" parent="PanelContainer/VBoxContainer/GridContainer" instance=ExtResource("1_pwbsc")]
layout_mode = 2
[node name="SDJS_Key" parent="PanelContainer/VBoxContainer/GridContainer" instance=ExtResource("1_wmags")]
layout_mode = 2
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer/VBoxContainer"]
layout_mode = 2
theme_override_constants/margin_top = 30
theme_override_constants/margin_bottom = 0
[node name="Button" type="Button" parent="PanelContainer/VBoxContainer/MarginContainer"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
focus_mode = 0
theme_override_font_sizes/font_size = 24
text = "确认"
[connection signal="close_requested" from="." to="." method="_on_close_requested"]
[connection signal="on_focus" from="PanelContainer/VBoxContainer/GridContainer/JJTC_Key" to="." method="_on_key_focus_entered"]
[connection signal="on_focus" from="PanelContainer/VBoxContainer/GridContainer/LCB1_Key" to="." method="_on_key_focus_entered"]
[connection signal="on_focus" from="PanelContainer/VBoxContainer/GridContainer/LCB2_Key" to="." method="_on_key_focus_entered"]
[connection signal="on_focus" from="PanelContainer/VBoxContainer/GridContainer/LCB2_Key2" to="." method="_on_key_focus_entered"]
[connection signal="on_focus" from="PanelContainer/VBoxContainer/GridContainer/LCB3_Key" to="." method="_on_key_focus_entered"]
[connection signal="on_focus" from="PanelContainer/VBoxContainer/GridContainer/PSL_Key" to="." method="_on_key_focus_entered"]
[connection signal="on_focus" from="PanelContainer/VBoxContainer/GridContainer/SDJS_Key" to="." method="_on_key_focus_entered"]
[connection signal="pressed" from="PanelContainer/VBoxContainer/MarginContainer/Button" to="." method="_on_button_pressed"]

1
UI/transparent_window.gd Normal file
View File

@ -0,0 +1 @@
extends Window

View File

@ -0,0 +1,21 @@
[gd_scene load_steps=6 format=3 uid="uid://bhtvin66eei32"]
[ext_resource type="Script" path="res://UI/transparent_window.gd" id="1_bfvn2"]
[ext_resource type="PackedScene" uid="uid://bsr40ogx2e2ir" path="res://UI/station_keys/jjtc_key_control.tscn" id="1_l6iqj"]
[ext_resource type="PackedScene" uid="uid://dkqnt73pyqgwj" path="res://UI/station_keys/lcb1_key_control.tscn" id="2_5nk4v"]
[ext_resource type="PackedScene" uid="uid://63r8gueubu2q" path="res://UI/station_keys/lcb2_key_control.tscn" id="3_lpt01"]
[ext_resource type="PackedScene" uid="uid://biwdpy5pifxgi" path="res://UI/station_keys/lcb_key_control.tscn" id="4_ud6su"]
[node name="Window" type="Window"]
transparent_bg = true
position = Vector2i(10, 36)
transparent = true
script = ExtResource("1_bfvn2")
[node name="JJTC_Key" parent="." instance=ExtResource("1_l6iqj")]
[node name="LCB_Key" parent="." instance=ExtResource("2_5nk4v")]
[node name="LCB_Key2" parent="." instance=ExtResource("3_lpt01")]
[node name="LCB_Key3" parent="." instance=ExtResource("4_ud6su")]

37
export_presets.cfg Normal file
View File

@ -0,0 +1,37 @@
[preset.0]
name="station_keys"
platform="Web"
runnable=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="target/godot_station_keys.html"
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false
[preset.0.options]
custom_template/debug=""
custom_template/release=""
variant/extensions_support=false
vram_texture_compression/for_desktop=true
vram_texture_compression/for_mobile=false
html/export_icon=true
html/custom_html_shell=""
html/head_include=""
html/canvas_resize_policy=2
html/focus_canvas_on_start=true
html/experimental_virtual_keyboard=false
progressive_web_app/enabled=false
progressive_web_app/offline_page=""
progressive_web_app/display=1
progressive_web_app/orientation=0
progressive_web_app/icon_144x144=""
progressive_web_app/icon_180x180=""
progressive_web_app/icon_512x512=""
progressive_web_app/background_color=Color(0, 0, 0, 1)

1
icon.svg Normal file
View File

@ -0,0 +1 @@
<svg height="128" width="128" xmlns="http://www.w3.org/2000/svg"><rect x="2" y="2" width="124" height="124" rx="14" fill="#363d52" stroke="#212532" stroke-width="4"/><g transform="scale(.101) translate(122 122)"><g fill="#fff"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 813 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H447l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c3 34 55 34 58 0v-86c-3-34-55-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></g></svg>

After

Width:  |  Height:  |  Size: 950 B

37
icon.svg.import Normal file
View File

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://covd665fe5fb1"
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.svg"
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.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
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

28
project.godot Normal file
View File

@ -0,0 +1,28 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=5
[application]
config/name="godot_experiments"
run/main_scene="res://UI/stand.tscn"
config/features=PackedStringArray("4.2", "GL Compatibility")
config/icon="res://icon.svg"
[display]
window/size/viewport_width=1920
window/size/viewport_height=1080
window/size/initial_position_type=0
window/stretch/mode="canvas_items"
[rendering]
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"

73
shaders/outline.gdshader Normal file
View File

@ -0,0 +1,73 @@
shader_type canvas_item;
uniform vec4 color : source_color = vec4(1.0);
uniform float width : hint_range(0, 10) = 1.0;
uniform int pattern : hint_range(0, 2) = 0; // diamond, circle, square
uniform bool inside = false;
uniform bool add_margins = true; // only useful when inside is false
uniform vec2 number_of_images = vec2(1.0); // number of horizontal and vertical images in the sprite sheet
varying flat vec4 modulate;
void vertex() {
modulate = COLOR;
if (add_margins) {
if ((UV.x <= 0.0 || UV.x >= 1.0) && (UV.y <= 0.0 || UV.y >= 1.0)) {
VERTEX += (UV * 2.0 - 1.0) * width;
} else {
VERTEX += sign(VERTEX) * width; // replace sign(VERTEX) by (sign(VERTEX) * 2.0 - 1.0) if your AnimatedSprite2D isn't Centered
}
}
}
bool hasContraryNeighbour(vec2 uv, vec2 texture_pixel_size, vec2 image_top_left, vec2 image_bottom_right, sampler2D texture) {
for (float i = -ceil(width); i <= ceil(width); i++) {
float x = abs(i) > width ? width * sign(i) : i;
float offset;
if (pattern == 0) {
offset = width - abs(x);
} else if (pattern == 1) {
offset = floor(sqrt(pow(width + 0.5, 2) - x * x));
} else if (pattern == 2) {
offset = width;
}
for (float j = -ceil(offset); j <= ceil(offset); j++) {
float y = abs(j) > offset ? offset * sign(j) : j;
vec2 xy = uv + texture_pixel_size * vec2(x, y);
if ((xy != clamp(xy, image_top_left, image_bottom_right) || texture(texture, xy).a <= 0.0) == inside) {
return true;
}
}
}
return false;
}
void fragment() {
vec2 uv = UV;
vec2 image_top_left = floor(uv * number_of_images) / number_of_images;
vec2 image_bottom_right = image_top_left + vec2(1.0) / number_of_images;
if (add_margins) {
vec2 texture_pixel_size = vec2(1.0) / (vec2(1.0) / TEXTURE_PIXEL_SIZE + vec2(width * 2.0) * number_of_images);
uv = (uv - texture_pixel_size * width - image_top_left) * TEXTURE_PIXEL_SIZE / texture_pixel_size + image_top_left;
if (uv != clamp(uv, image_top_left, image_bottom_right)) {
COLOR.a = 0.0;
} else {
COLOR = texture(TEXTURE, uv) * modulate;
}
} else {
COLOR = texture(TEXTURE, uv) * modulate;
}
if ((COLOR.a > 0.0) == inside && hasContraryNeighbour(uv, TEXTURE_PIXEL_SIZE, image_top_left, image_bottom_right, TEXTURE)) {
COLOR.rgb = inside ? mix(COLOR.rgb, color.rgb * modulate.rgb, color.a * modulate.a) : color.rgb * modulate.rgb;
COLOR.a += (1.0 - COLOR.a) * color.a * modulate.a;
}
}

19
ui_theme.tres Normal file
View File

@ -0,0 +1,19 @@
[gd_resource type="Theme" load_steps=3 format=3 uid="uid://bycedcl2nwwlu"]
[ext_resource type="FontFile" uid="uid://bkbpyidjguavf" path="res://Assets/FeiHuaSongTi-2.ttf" id="1_8lpqa"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_spmjw"]
[resource]
Button/fonts/font = ExtResource("1_8lpqa")
Label/colors/font_color = Color(1, 1, 1, 1)
Label/colors/font_outline_color = Color(1, 1, 1, 1)
Label/colors/font_shadow_color = Color(0, 0, 0, 0)
Label/constants/line_spacing = 3
Label/constants/outline_size = 0
Label/constants/shadow_offset_x = 1
Label/constants/shadow_offset_y = 1
Label/constants/shadow_outline_size = 1
Label/font_sizes/font_size = 20
Label/fonts/font = ExtResource("1_8lpqa")
Label/styles/normal = SubResource("StyleBoxEmpty_spmjw")