实现站台线路站点信息场景
This commit is contained in:
parent
09da919c38
commit
2db5b78818
@ -3,23 +3,22 @@
|
|||||||
[ext_resource type="Script" path="res://experiments/psd_panel.gd" id="1_wg3fd"]
|
[ext_resource type="Script" path="res://experiments/psd_panel.gd" id="1_wg3fd"]
|
||||||
[ext_resource type="PackedScene" uid="uid://c5vvgu50akjwl" path="res://experiments/psd_panel_ui.tscn" id="2_rtht1"]
|
[ext_resource type="PackedScene" uid="uid://c5vvgu50akjwl" path="res://experiments/psd_panel_ui.tscn" id="2_rtht1"]
|
||||||
|
|
||||||
[sub_resource type="ViewportTexture" id="ViewportTexture_c5roc"]
|
[sub_resource type="ViewportTexture" id="ViewportTexture_c7xnk"]
|
||||||
viewport_path = NodePath("LabelTexture")
|
viewport_path = NodePath("LabelTexture")
|
||||||
|
|
||||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_pbh8q"]
|
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_pbh8q"]
|
||||||
albedo_texture = SubResource("ViewportTexture_c5roc")
|
albedo_texture = SubResource("ViewportTexture_c7xnk")
|
||||||
uv1_scale = Vector3(4, 1, 1)
|
uv1_scale = Vector3(4, 1, 1)
|
||||||
|
|
||||||
[sub_resource type="PlaneMesh" id="PlaneMesh_mfy0l"]
|
[sub_resource type="PlaneMesh" id="PlaneMesh_mfy0l"]
|
||||||
resource_local_to_scene = true
|
resource_local_to_scene = true
|
||||||
size = Vector2(45.948, 2)
|
size = Vector2(131.533, 2)
|
||||||
orientation = 2
|
orientation = 2
|
||||||
|
|
||||||
[node name="PSD_Panel" type="Node3D"]
|
[node name="PSD_Panel" type="Node3D"]
|
||||||
script = ExtResource("1_wg3fd")
|
script = ExtResource("1_wg3fd")
|
||||||
repeat_times = 4.0
|
repeat_times = 4.0
|
||||||
panel_width = 131.533
|
panel_width = 131.533
|
||||||
station_names = null
|
|
||||||
|
|
||||||
[node name="LabelTexture" type="SubViewport" parent="."]
|
[node name="LabelTexture" type="SubViewport" parent="."]
|
||||||
canvas_item_default_texture_repeat = 1
|
canvas_item_default_texture_repeat = 1
|
||||||
|
39
experiments/tes2180.tmp
Normal file
39
experiments/tes2180.tmp
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
[gd_scene load_steps=7 format=3 uid="uid://4ygkabji3g16"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bmiexmyoh0ehv" path="res://experiments/platform1.tscn" id="1_cq2ki"]
|
||||||
|
[ext_resource type="Script" path="res://experiments/test_3d.gd" id="1_uqsdo"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://crpmwcp85khdr" path="res://experiments/screen_door_t1.tscn" id="2_rvfj7"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://b5c3atssvhkwy" path="res://experiments/lcb.tscn" id="3_htmjl"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c63e3ugq35q5g" path="res://experiments/psd_panel.tscn" id="4_wjde3"]
|
||||||
|
|
||||||
|
[sub_resource type="Environment" id="Environment_mybsf"]
|
||||||
|
ambient_light_color = Color(0.831373, 0.290196, 0.556863, 1)
|
||||||
|
ambient_light_energy = 6.23
|
||||||
|
|
||||||
|
[node name="Node3D" type="Node3D"]
|
||||||
|
script = ExtResource("1_uqsdo")
|
||||||
|
|
||||||
|
[node name="platform" parent="." instance=ExtResource("1_cq2ki")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.16258, 0)
|
||||||
|
|
||||||
|
[node name="LCB" parent="." instance=ExtResource("3_htmjl")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.58244, 2.40247, -7.38809)
|
||||||
|
|
||||||
|
[node name="PSD_Panel" parent="." instance=ExtResource("4_wjde3")]
|
||||||
|
transform = Transform3D(0.381944, 0, 0, 0, 0.381944, 0, 0, 0, 0.381944, 4.13301, 1.83159, -7.03252)
|
||||||
|
|
||||||
|
[node name="screenDoor" parent="." instance=ExtResource("2_rvfj7")]
|
||||||
|
|
||||||
|
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||||
|
environment = SubResource("Environment_mybsf")
|
||||||
|
|
||||||
|
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
||||||
|
transform = Transform3D(0.775947, 2.3125e-07, -0.630798, 0.387003, 0.789684, 0.476054, 0.498131, -0.613514, 0.612753, -0.369306, 2.06538, 1.72595)
|
||||||
|
light_energy = 4.962
|
||||||
|
|
||||||
|
[node name="Camera3D" type="Camera3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 0.92041, 0.390956, 0, -0.390956, 0.92041, 4.25592, 2.82422, -2.07876)
|
||||||
|
projection = 1
|
||||||
|
current = true
|
||||||
|
fov = 23.7
|
||||||
|
size = 4.56913
|
39
experiments/tesDB48.tmp
Normal file
39
experiments/tesDB48.tmp
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
[gd_scene load_steps=7 format=3 uid="uid://4ygkabji3g16"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bmiexmyoh0ehv" path="res://experiments/platform1.tscn" id="1_cq2ki"]
|
||||||
|
[ext_resource type="Script" path="res://experiments/test_3d.gd" id="1_uqsdo"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://crpmwcp85khdr" path="res://experiments/screen_door_t1.tscn" id="2_rvfj7"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://b5c3atssvhkwy" path="res://experiments/lcb.tscn" id="3_htmjl"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c63e3ugq35q5g" path="res://experiments/psd_panel.tscn" id="4_wjde3"]
|
||||||
|
|
||||||
|
[sub_resource type="Environment" id="Environment_mybsf"]
|
||||||
|
ambient_light_color = Color(0.831373, 0.290196, 0.556863, 1)
|
||||||
|
ambient_light_energy = 6.23
|
||||||
|
|
||||||
|
[node name="Node3D" type="Node3D"]
|
||||||
|
script = ExtResource("1_uqsdo")
|
||||||
|
|
||||||
|
[node name="platform" parent="." instance=ExtResource("1_cq2ki")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.16258, 0)
|
||||||
|
|
||||||
|
[node name="LCB" parent="." instance=ExtResource("3_htmjl")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.58244, 2.40247, -7.38809)
|
||||||
|
|
||||||
|
[node name="PSD_Panel" parent="." instance=ExtResource("4_wjde3")]
|
||||||
|
transform = Transform3D(0.381944, 0, 0, 0, 0.381944, 0, 0, 0, 0.381944, 4.13301, 1.83159, -7.03252)
|
||||||
|
|
||||||
|
[node name="screenDoor" parent="." instance=ExtResource("2_rvfj7")]
|
||||||
|
|
||||||
|
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||||
|
environment = SubResource("Environment_mybsf")
|
||||||
|
|
||||||
|
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
||||||
|
transform = Transform3D(0.775947, 2.3125e-07, -0.630798, 0.387003, 0.789684, 0.476054, 0.498131, -0.613514, 0.612753, -0.369306, 2.06538, 1.72595)
|
||||||
|
light_energy = 4.962
|
||||||
|
|
||||||
|
[node name="Camera3D" type="Camera3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 0.92041, 0.390956, 0, -0.390956, 0.92041, 4.25592, 2.82422, -2.07876)
|
||||||
|
projection = 1
|
||||||
|
current = true
|
||||||
|
fov = 23.7
|
||||||
|
size = 4.56913
|
39
experiments/tesF8A3.tmp
Normal file
39
experiments/tesF8A3.tmp
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
[gd_scene load_steps=7 format=3 uid="uid://4ygkabji3g16"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bmiexmyoh0ehv" path="res://experiments/platform1.tscn" id="1_cq2ki"]
|
||||||
|
[ext_resource type="Script" path="res://experiments/test_3d.gd" id="1_uqsdo"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://crpmwcp85khdr" path="res://experiments/screen_door_t1.tscn" id="2_rvfj7"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://b5c3atssvhkwy" path="res://experiments/lcb.tscn" id="3_htmjl"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c63e3ugq35q5g" path="res://experiments/psd_panel.tscn" id="4_wjde3"]
|
||||||
|
|
||||||
|
[sub_resource type="Environment" id="Environment_mybsf"]
|
||||||
|
ambient_light_color = Color(0.831373, 0.290196, 0.556863, 1)
|
||||||
|
ambient_light_energy = 6.23
|
||||||
|
|
||||||
|
[node name="Node3D" type="Node3D"]
|
||||||
|
script = ExtResource("1_uqsdo")
|
||||||
|
|
||||||
|
[node name="platform" parent="." instance=ExtResource("1_cq2ki")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.16258, 0)
|
||||||
|
|
||||||
|
[node name="LCB" parent="." instance=ExtResource("3_htmjl")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.58244, 2.40247, -7.38809)
|
||||||
|
|
||||||
|
[node name="PSD_Panel" parent="." instance=ExtResource("4_wjde3")]
|
||||||
|
transform = Transform3D(0.381944, 0, 0, 0, 0.381944, 0, 0, 0, 0.381944, 4.13301, 1.83159, -7.03252)
|
||||||
|
|
||||||
|
[node name="screenDoor" parent="." instance=ExtResource("2_rvfj7")]
|
||||||
|
|
||||||
|
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||||
|
environment = SubResource("Environment_mybsf")
|
||||||
|
|
||||||
|
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
||||||
|
transform = Transform3D(0.775947, 2.3125e-07, -0.630798, 0.387003, 0.789684, 0.476054, 0.498131, -0.613514, 0.612753, -0.369306, 2.06538, 1.72595)
|
||||||
|
light_energy = 4.962
|
||||||
|
|
||||||
|
[node name="Camera3D" type="Camera3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 0.92041, 0.390956, 0, -0.390956, 0.92041, 4.25592, 2.82422, -2.07876)
|
||||||
|
projection = 1
|
||||||
|
current = true
|
||||||
|
fov = 23.7
|
||||||
|
size = 4.56913
|
@ -1,9 +1,10 @@
|
|||||||
[gd_scene load_steps=6 format=3 uid="uid://4ygkabji3g16"]
|
[gd_scene load_steps=7 format=3 uid="uid://4ygkabji3g16"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://bmiexmyoh0ehv" path="res://experiments/platform1.tscn" id="1_cq2ki"]
|
[ext_resource type="PackedScene" uid="uid://bmiexmyoh0ehv" path="res://experiments/platform1.tscn" id="1_cq2ki"]
|
||||||
[ext_resource type="PackedScene" uid="uid://c8btaqbln1kwd" path="res://Assets/models/test.blend" id="1_vdsgb"]
|
[ext_resource type="PackedScene" uid="uid://c8btaqbln1kwd" path="res://Assets/models/test.blend" id="1_vdsgb"]
|
||||||
[ext_resource type="PackedScene" uid="uid://crpmwcp85khdr" path="res://experiments/screen_door_t1.tscn" id="2_rvfj7"]
|
[ext_resource type="PackedScene" uid="uid://crpmwcp85khdr" path="res://experiments/screen_door_t1.tscn" id="2_rvfj7"]
|
||||||
[ext_resource type="PackedScene" uid="uid://c63e3ugq35q5g" path="res://experiments/psd_panel.tscn" id="4_wjde3"]
|
[ext_resource type="PackedScene" uid="uid://cgu3hl1db2sgn" path="res://station_info_panel/style1/current_station_panel.tscn" id="4_ba44j"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bakfrv2vd4ya3" path="res://station_info_panel/style1/site_panel.tscn" id="5_5lsy8"]
|
||||||
|
|
||||||
[sub_resource type="Environment" id="Environment_mybsf"]
|
[sub_resource type="Environment" id="Environment_mybsf"]
|
||||||
ambient_light_color = Color(0.831373, 0.290196, 0.556863, 1)
|
ambient_light_color = Color(0.831373, 0.290196, 0.556863, 1)
|
||||||
@ -17,11 +18,6 @@ ambient_light_energy = 6.23
|
|||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.16258, 0)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.16258, 0)
|
||||||
visible = false
|
visible = false
|
||||||
|
|
||||||
[node name="PSD_Panel" parent="." instance=ExtResource("4_wjde3")]
|
|
||||||
transform = Transform3D(0.381944, 0, 0, 0, 0.381944, 0, 0, 0, 0.381944, 15.3792, 1.86346, -7.03252)
|
|
||||||
visible = false
|
|
||||||
station_names = Array[String]([])
|
|
||||||
|
|
||||||
[node name="screenDoor" parent="." instance=ExtResource("2_rvfj7")]
|
[node name="screenDoor" parent="." instance=ExtResource("2_rvfj7")]
|
||||||
|
|
||||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||||
@ -37,3 +33,9 @@ projection = 1
|
|||||||
current = true
|
current = true
|
||||||
fov = 23.7
|
fov = 23.7
|
||||||
size = 5.357
|
size = 5.357
|
||||||
|
|
||||||
|
[node name="CurrentStationPanel" parent="." instance=ExtResource("4_ba44j")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.23448, -6.85517)
|
||||||
|
|
||||||
|
[node name="SitePanel" parent="." instance=ExtResource("5_5lsy8")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.012841, 3.83133, -6.10879)
|
||||||
|
@ -11,14 +11,14 @@ config_version=5
|
|||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="godot_experiments"
|
config/name="godot_experiments"
|
||||||
run/main_scene="res://experiments/test_3d.tscn"
|
run/main_scene="res://station_info_panel/style1/site_panel_content.tscn"
|
||||||
config/features=PackedStringArray("4.2", "GL Compatibility")
|
config/features=PackedStringArray("4.2", "GL Compatibility")
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
|
||||||
window/size/viewport_width=1920
|
window/size/viewport_width=1680
|
||||||
window/size/viewport_height=1080
|
window/size/viewport_height=920
|
||||||
window/size/initial_position_type=0
|
window/size/initial_position_type=0
|
||||||
window/stretch/mode="canvas_items"
|
window/stretch/mode="canvas_items"
|
||||||
|
|
||||||
|
BIN
station_info_panel/style1/SourceHanSerifCN-Regular.ttf
Normal file
BIN
station_info_panel/style1/SourceHanSerifCN-Regular.ttf
Normal file
Binary file not shown.
@ -0,0 +1,33 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="font_data_dynamic"
|
||||||
|
type="FontFile"
|
||||||
|
uid="uid://c0kstbg4bshow"
|
||||||
|
path="res://.godot/imported/SourceHanSerifCN-Regular.ttf-97c80509c35f0aa3b81c9fd1373f7202.fontdata"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://station_info_panel/style1/SourceHanSerifCN-Regular.ttf"
|
||||||
|
dest_files=["res://.godot/imported/SourceHanSerifCN-Regular.ttf-97c80509c35f0aa3b81c9fd1373f7202.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={}
|
@ -1,4 +1,4 @@
|
|||||||
#@tool
|
@tool
|
||||||
extends Node3D
|
extends Node3D
|
||||||
|
|
||||||
## 面板宽度,单位(m)
|
## 面板宽度,单位(m)
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
[gd_scene load_steps=5 format=3 uid="uid://cgu3hl1db2sgn"]
|
[gd_scene load_steps=6 format=3 uid="uid://cgu3hl1db2sgn"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://station_info_panel/style1/current_station_panel.gd" id="1_farda"]
|
[ext_resource type="Script" path="res://station_info_panel/style1/current_station_panel.gd" id="1_farda"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cnc8yp8xdrm00" path="res://station_info_panel/style1/current_station_panel_content.tscn" id="2_v131p"]
|
[ext_resource type="PackedScene" uid="uid://cnc8yp8xdrm00" path="res://station_info_panel/style1/current_station_panel_content.tscn" id="2_v131p"]
|
||||||
|
|
||||||
|
[sub_resource type="ViewportTexture" id="ViewportTexture_5b541"]
|
||||||
|
viewport_path = NodePath("SubViewport")
|
||||||
|
|
||||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_hypnq"]
|
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_hypnq"]
|
||||||
|
albedo_texture = SubResource("ViewportTexture_5b541")
|
||||||
|
|
||||||
[sub_resource type="PlaneMesh" id="PlaneMesh_xu5kk"]
|
[sub_resource type="PlaneMesh" id="PlaneMesh_xu5kk"]
|
||||||
size = Vector2(5.189, 1.459)
|
size = Vector2(5.189, 1.459)
|
||||||
@ -18,7 +22,6 @@ panelHeight = 1.459
|
|||||||
size = Vector2i(1024, 256)
|
size = Vector2i(1024, 256)
|
||||||
|
|
||||||
[node name="CurrentStationPanelContent" parent="SubViewport" instance=ExtResource("2_v131p")]
|
[node name="CurrentStationPanelContent" parent="SubViewport" instance=ExtResource("2_v131p")]
|
||||||
bgColor = Color(0.662745, 0.662745, 0.662745, 1)
|
|
||||||
|
|
||||||
[node name="Plane" type="MeshInstance3D" parent="."]
|
[node name="Plane" type="MeshInstance3D" parent="."]
|
||||||
material_override = SubResource("StandardMaterial3D_hypnq")
|
material_override = SubResource("StandardMaterial3D_hypnq")
|
||||||
|
@ -59,8 +59,8 @@ func update():
|
|||||||
# 更新背景色
|
# 更新背景色
|
||||||
$Bg["theme_override_styles/panel"].bg_color = bgColor
|
$Bg["theme_override_styles/panel"].bg_color = bgColor
|
||||||
# 装饰条颜色
|
# 装饰条颜色
|
||||||
$Bg/Strip["theme_override_styles/panel"].color = stripColor
|
$Bg/Strip["theme_override_styles/panel"].bg_color = stripColor
|
||||||
$Bg/Strip2["theme_override_styles/panel"].color = stripColor
|
$Bg/Strip2["theme_override_styles/panel"].bg_color = stripColor
|
||||||
# 控制线路显示
|
# 控制线路显示
|
||||||
if lineInfoShow:
|
if lineInfoShow:
|
||||||
$LineInfo["theme_override_styles/panel"].bg_color = lineInfoBgColor
|
$LineInfo["theme_override_styles/panel"].bg_color = lineInfoBgColor
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=7 format=3 uid="uid://cnc8yp8xdrm00"]
|
[gd_scene load_steps=8 format=3 uid="uid://cnc8yp8xdrm00"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://station_info_panel/style1/current_station_panel_content.gd" id="1_wspij"]
|
[ext_resource type="Script" path="res://station_info_panel/style1/current_station_panel_content.gd" id="1_wspij"]
|
||||||
|
|
||||||
@ -10,9 +10,11 @@ border_width_right = 2
|
|||||||
border_width_bottom = 2
|
border_width_bottom = 2
|
||||||
border_color = Color(0, 0, 0, 1)
|
border_color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
[sub_resource type="StyleBoxLine" id="StyleBoxLine_vsvkd"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_880ss"]
|
||||||
color = Color(0, 0.392157, 0, 1)
|
bg_color = Color(0, 0.392157, 0, 1)
|
||||||
thickness = 24
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_7u3ik"]
|
||||||
|
bg_color = Color(0, 0.392157, 0, 1)
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_iudvd"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_iudvd"]
|
||||||
bg_color = Color(0, 0.392157, 0, 1)
|
bg_color = Color(0, 0.392157, 0, 1)
|
||||||
@ -48,16 +50,16 @@ layout_mode = 0
|
|||||||
offset_left = 3.0
|
offset_left = 3.0
|
||||||
offset_top = 100.0
|
offset_top = 100.0
|
||||||
offset_right = 223.0
|
offset_right = 223.0
|
||||||
offset_bottom = 124.0
|
offset_bottom = 120.0
|
||||||
theme_override_styles/panel = SubResource("StyleBoxLine_vsvkd")
|
theme_override_styles/panel = SubResource("StyleBoxFlat_880ss")
|
||||||
|
|
||||||
[node name="Strip2" type="Panel" parent="Bg"]
|
[node name="Strip2" type="Panel" parent="Bg"]
|
||||||
layout_mode = 0
|
layout_mode = 0
|
||||||
offset_left = 801.0
|
offset_left = 801.0
|
||||||
offset_top = 100.0
|
offset_top = 100.0
|
||||||
offset_right = 1021.0
|
offset_right = 1021.0
|
||||||
offset_bottom = 124.0
|
offset_bottom = 120.0
|
||||||
theme_override_styles/panel = SubResource("StyleBoxLine_vsvkd")
|
theme_override_styles/panel = SubResource("StyleBoxFlat_7u3ik")
|
||||||
|
|
||||||
[node name="LineInfo" type="PanelContainer" parent="."]
|
[node name="LineInfo" type="PanelContainer" parent="."]
|
||||||
custom_minimum_size = Vector2(100, 60)
|
custom_minimum_size = Vector2(100, 60)
|
||||||
|
@ -29,6 +29,10 @@ extends Node2D
|
|||||||
set(v):
|
set(v):
|
||||||
stationEnName = v
|
stationEnName = v
|
||||||
update()
|
update()
|
||||||
|
## 站点圆圈样式
|
||||||
|
@export var siteCircleStyle: StyleBoxFlat
|
||||||
|
## 站点条样式
|
||||||
|
@export var siteStripStyle: StyleBoxFlat
|
||||||
|
|
||||||
var isReady = false
|
var isReady = false
|
||||||
|
|
||||||
@ -36,11 +40,11 @@ func update():
|
|||||||
if not isReady:
|
if not isReady:
|
||||||
return
|
return
|
||||||
# 更新背景色
|
# 更新背景色
|
||||||
$Strip["theme_override_styles/panel"].bg_color = stripColor
|
$Strip["theme_override_styles/panel"] = siteStripStyle
|
||||||
$Circle["theme_override_styles/panel"].border_color = stripColor
|
$Circle["theme_override_styles/panel"] = siteCircleStyle
|
||||||
# 更新文字颜色
|
# 更新文字颜色
|
||||||
%Name.label_settings.font_color = nameColor
|
%Name["theme_override_colors/font_color"] = nameColor
|
||||||
%EnName.label_settings.font_color = nameColor
|
%EnName["theme_override_colors/font_color"] = nameColor
|
||||||
# 更新文字
|
# 更新文字
|
||||||
%Name.text = stationName
|
%Name.text = stationName
|
||||||
%EnName.text = stationEnName
|
%EnName.text = stationEnName
|
||||||
@ -55,7 +59,6 @@ func calculateWidth() -> float:
|
|||||||
return w + 5
|
return w + 5
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
print("site info ready")
|
|
||||||
isReady = true
|
isReady = true
|
||||||
update()
|
update()
|
||||||
|
|
@ -1,41 +1,15 @@
|
|||||||
[gd_scene load_steps=8 format=3 uid="uid://dbun083kn0oom"]
|
[gd_scene load_steps=5 format=3 uid="uid://dbun083kn0oom"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://SiteInfo.gd" id="1_x2sr2"]
|
[ext_resource type="Script" path="res://station_info_panel/style1/site_info.gd" id="1_ys73f"]
|
||||||
|
[ext_resource type="FontFile" uid="uid://c0kstbg4bshow" path="res://station_info_panel/style1/SourceHanSerifCN-Regular.ttf" id="2_26ovv"]
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_flnbk"]
|
[ext_resource type="StyleBox" uid="uid://ddj1ajtx312pj" path="res://station_info_panel/style1/site_style_circle.tres" id="2_qdtjh"]
|
||||||
bg_color = Color(0, 1, 1, 1)
|
[ext_resource type="StyleBox" uid="uid://dxf00nrmospua" path="res://station_info_panel/style1/site_style_strip.tres" id="3_55roq"]
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_j0fnk"]
|
|
||||||
bg_color = Color(1, 1, 1, 1)
|
|
||||||
border_width_left = 7
|
|
||||||
border_width_top = 7
|
|
||||||
border_width_right = 7
|
|
||||||
border_width_bottom = 7
|
|
||||||
border_color = Color(0, 1, 1, 1)
|
|
||||||
corner_radius_top_left = 40
|
|
||||||
corner_radius_top_right = 40
|
|
||||||
corner_radius_bottom_right = 40
|
|
||||||
corner_radius_bottom_left = 40
|
|
||||||
|
|
||||||
[sub_resource type="SystemFont" id="SystemFont_7obcg"]
|
|
||||||
|
|
||||||
[sub_resource type="LabelSettings" id="LabelSettings_6l0vq"]
|
|
||||||
font = SubResource("SystemFont_7obcg")
|
|
||||||
font_size = 20
|
|
||||||
font_color = Color(0, 0, 1, 1)
|
|
||||||
|
|
||||||
[sub_resource type="SystemFont" id="SystemFont_ys3vy"]
|
|
||||||
|
|
||||||
[sub_resource type="LabelSettings" id="LabelSettings_uy188"]
|
|
||||||
font = SubResource("SystemFont_ys3vy")
|
|
||||||
font_size = 11
|
|
||||||
font_color = Color(0, 0, 1, 1)
|
|
||||||
|
|
||||||
[node name="SiteInfo" type="Node2D"]
|
[node name="SiteInfo" type="Node2D"]
|
||||||
script = ExtResource("1_x2sr2")
|
script = ExtResource("1_ys73f")
|
||||||
stripColor = Color(0, 0.788235, 0.482353, 1)
|
|
||||||
stationName = "北客站北广场"
|
|
||||||
stationEnName = "DATANGFURONGYUAN"
|
stationEnName = "DATANGFURONGYUAN"
|
||||||
|
siteCircleStyle = ExtResource("2_qdtjh")
|
||||||
|
siteStripStyle = ExtResource("3_55roq")
|
||||||
|
|
||||||
[node name="Strip" type="Panel" parent="."]
|
[node name="Strip" type="Panel" parent="."]
|
||||||
anchors_preset = 5
|
anchors_preset = 5
|
||||||
@ -45,8 +19,7 @@ offset_left = -3.5
|
|||||||
offset_right = 3.5
|
offset_right = 3.5
|
||||||
offset_bottom = 34.0
|
offset_bottom = 34.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
theme_override_styles/panel = SubResource("StyleBoxFlat_flnbk")
|
theme_override_styles/panel = ExtResource("3_55roq")
|
||||||
metadata/_edit_use_anchors_ = true
|
|
||||||
|
|
||||||
[node name="Circle" type="Panel" parent="."]
|
[node name="Circle" type="Panel" parent="."]
|
||||||
anchors_preset = 8
|
anchors_preset = 8
|
||||||
@ -60,7 +33,7 @@ offset_right = 17.0
|
|||||||
offset_bottom = 19.0
|
offset_bottom = 19.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
theme_override_styles/panel = SubResource("StyleBoxFlat_j0fnk")
|
theme_override_styles/panel = ExtResource("2_qdtjh")
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||||
offset_left = 10.0
|
offset_left = 10.0
|
||||||
@ -74,18 +47,16 @@ theme_override_constants/separation = -4
|
|||||||
[node name="Name" type="Label" parent="VBoxContainer"]
|
[node name="Name" type="Label" parent="VBoxContainer"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "北客站北广场"
|
theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||||
label_settings = SubResource("LabelSettings_6l0vq")
|
theme_override_fonts/font = ExtResource("2_26ovv")
|
||||||
|
theme_override_font_sizes/font_size = 20
|
||||||
|
text = "车站一"
|
||||||
vertical_alignment = 2
|
vertical_alignment = 2
|
||||||
|
|
||||||
[node name="EnName" type="Label" parent="VBoxContainer"]
|
[node name="EnName" type="Label" parent="VBoxContainer"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||||
|
theme_override_fonts/font = ExtResource("2_26ovv")
|
||||||
|
theme_override_font_sizes/font_size = 11
|
||||||
text = "DATANGFURONGYUAN"
|
text = "DATANGFURONGYUAN"
|
||||||
label_settings = SubResource("LabelSettings_uy188")
|
|
||||||
|
|
||||||
[node name="Panel" type="Panel" parent="."]
|
|
||||||
offset_left = -2.0
|
|
||||||
offset_top = -10.0
|
|
||||||
offset_right = 71.0
|
|
||||||
offset_bottom = 190.0
|
|
||||||
|
@ -1,56 +1,34 @@
|
|||||||
@tool
|
@tool
|
||||||
extends Node2D
|
extends Node3D
|
||||||
|
|
||||||
## 从左到右/从右到左
|
## 面板宽度,单位(m)
|
||||||
@export var leftToRight: bool = true:
|
@export_range(1, 10) var panelWidth: float = 3:
|
||||||
get:
|
get:
|
||||||
return leftToRight
|
return panelWidth
|
||||||
set(v):
|
set(v):
|
||||||
leftToRight = v
|
panelWidth = v
|
||||||
update()
|
update()
|
||||||
## 车站列表
|
## 面板高度,单位(m)
|
||||||
@export var stations: Array[String] = ["车站一|CHEZHANYI"]:
|
@export_range(0.1, 5) var panelHeight: float = 1:
|
||||||
get:
|
get:
|
||||||
return stations
|
return panelHeight
|
||||||
set(v):
|
set(v):
|
||||||
stations = v
|
panelHeight = v
|
||||||
assert(stations.size() > 0, "车站列表不能为空")
|
|
||||||
for s in stations:
|
|
||||||
assert(s.split("|").size() == 2, "车站名格式:'车站名|车站英文名'")
|
|
||||||
update()
|
|
||||||
## 当前车站索引
|
|
||||||
@export var currentStationIndex: int = 0:
|
|
||||||
get:
|
|
||||||
return currentStationIndex
|
|
||||||
set(v):
|
|
||||||
currentStationIndex = v
|
|
||||||
update()
|
update()
|
||||||
|
|
||||||
|
var isReady: bool
|
||||||
|
|
||||||
@onready var siteInfoScene: PackedScene = preload("res://station_info_panel/style1/site_info.tscn")
|
|
||||||
|
|
||||||
var isReady = false
|
|
||||||
func update():
|
func update():
|
||||||
if not isReady:
|
if not isReady:
|
||||||
|
|
||||||
return
|
return
|
||||||
for c in $Sites.get_children():
|
var vp = $SubViewport
|
||||||
c.free()
|
|
||||||
var size = stations.size()
|
|
||||||
var s = stations[0]
|
|
||||||
var sns = s.split("|")
|
|
||||||
var sis = siteInfoScene.instantiate()
|
|
||||||
sis.stationName = sns[0]
|
|
||||||
sis.stationEnName = sns[1]
|
|
||||||
sis.stripColor = Color.AQUA
|
|
||||||
sis.nameColor = Color.BLUE
|
|
||||||
$Sites.add_child(sis)
|
|
||||||
|
|
||||||
var w = sis.calculateWidth()
|
$Plane.mesh.size.x = panelWidth
|
||||||
print(w)
|
$Plane.mesh.size.y = panelHeight
|
||||||
#for i in stations.size():
|
$Plane.material_override.albedo_texture = vp.get_texture()
|
||||||
|
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
isReady = true
|
isReady = true
|
||||||
|
print("csPanel ready")
|
||||||
update()
|
update()
|
||||||
|
@ -1,50 +1,27 @@
|
|||||||
[gd_scene load_steps=5 format=3 uid="uid://dsv55hv2sr7hd"]
|
[gd_scene load_steps=6 format=3 uid="uid://bakfrv2vd4ya3"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dsv55hv2sr7hd" path="res://station_info_panel/style1/site_panel_content.tscn" id="1_ayfto"]
|
||||||
[ext_resource type="Script" path="res://station_info_panel/style1/site_panel.gd" id="1_fjyyy"]
|
[ext_resource type="Script" path="res://station_info_panel/style1/site_panel.gd" id="1_fjyyy"]
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_48edc"]
|
[sub_resource type="ViewportTexture" id="ViewportTexture_g2fgb"]
|
||||||
bg_color = Color(0.941176, 0.466667, 0.788235, 1)
|
viewport_path = NodePath("SubViewport")
|
||||||
border_width_left = 2
|
|
||||||
border_width_top = 2
|
|
||||||
border_width_right = 2
|
|
||||||
border_width_bottom = 2
|
|
||||||
border_color = Color(0, 0, 0, 1)
|
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_dmayk"]
|
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_hypnq"]
|
||||||
bg_color = Color(0.113725, 0.470588, 0.113725, 1)
|
albedo_texture = SubResource("ViewportTexture_g2fgb")
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ve86j"]
|
[sub_resource type="PlaneMesh" id="PlaneMesh_xu5kk"]
|
||||||
bg_color = Color(0.47451, 0.47451, 0.47451, 1)
|
size = Vector2(4, 1)
|
||||||
|
orientation = 2
|
||||||
|
|
||||||
[node name="SitePanel" type="Node2D"]
|
[node name="SitePanel" type="Node3D"]
|
||||||
script = ExtResource("1_fjyyy")
|
script = ExtResource("1_fjyyy")
|
||||||
stations = Array[String](["北客站北广场|BEIKEZHAN"])
|
panelWidth = 4.0
|
||||||
|
|
||||||
[node name="Bg" type="Panel" parent="."]
|
[node name="SubViewport" type="SubViewport" parent="."]
|
||||||
offset_right = 1450.0
|
size = Vector2i(1450, 350)
|
||||||
offset_bottom = 350.0
|
|
||||||
theme_override_styles/panel = SubResource("StyleBoxFlat_48edc")
|
|
||||||
|
|
||||||
[node name="Unfinished" type="Panel" parent="Bg"]
|
[node name="SitePanel" parent="SubViewport" instance=ExtResource("1_ayfto")]
|
||||||
layout_mode = 0
|
|
||||||
offset_left = 3.0
|
|
||||||
offset_top = 100.0
|
|
||||||
offset_right = 223.0
|
|
||||||
offset_bottom = 120.0
|
|
||||||
theme_override_styles/panel = SubResource("StyleBoxFlat_dmayk")
|
|
||||||
|
|
||||||
[node name="Finished" type="Panel" parent="Bg"]
|
[node name="Plane" type="MeshInstance3D" parent="."]
|
||||||
layout_mode = 0
|
material_override = SubResource("StandardMaterial3D_hypnq")
|
||||||
offset_left = 500.0
|
mesh = SubResource("PlaneMesh_xu5kk")
|
||||||
offset_top = 100.0
|
|
||||||
offset_right = 720.0
|
|
||||||
offset_bottom = 120.0
|
|
||||||
theme_override_styles/panel = SubResource("StyleBoxFlat_ve86j")
|
|
||||||
|
|
||||||
[node name="Sites" type="Control" parent="."]
|
|
||||||
layout_mode = 3
|
|
||||||
anchors_preset = 0
|
|
||||||
offset_left = 176.0
|
|
||||||
offset_top = 110.0
|
|
||||||
offset_right = 216.0
|
|
||||||
offset_bottom = 150.0
|
|
||||||
|
160
station_info_panel/style1/site_panel_content.gd
Normal file
160
station_info_panel/style1/site_panel_content.gd
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
@tool
|
||||||
|
extends Node2D
|
||||||
|
|
||||||
|
## 从左到右/从右到左
|
||||||
|
@export var leftToRight: bool = true:
|
||||||
|
get:
|
||||||
|
return leftToRight
|
||||||
|
set(v):
|
||||||
|
leftToRight = v
|
||||||
|
update()
|
||||||
|
## 车站列表
|
||||||
|
@export var stations: Array[String] = [
|
||||||
|
"航天新城|HANGTIANXINCHENG","航天东路|HANGTIANDONGLU","神舟大道|SHENZHOUDADAO",
|
||||||
|
"东长安街|DONGCHANGANJIE","飞天路|FEITIANLU",
|
||||||
|
"航天大道|HANGTIANDADAO","金滹沱|JINHUTUO","曲江池西|QUJIANGCHIXI",
|
||||||
|
"大唐芙蓉园|DATANGFURONGYUAN","大雁塔|DAYANTA","西安科技大学|XIANKEJIDAXUE",
|
||||||
|
"建筑科技大学·李家村|JIANZHUKEJIDAXUE-LIJIACUN","和平门|HEPINGMEN",
|
||||||
|
"大差市|DACHAISHI","五路口|WULUKOU","西安站|XIANZHAN","含元殿|HANYUANDIAN",
|
||||||
|
"大明宫|DAMINGGONG","大明宫北|DAMINGGONGBEI","余家寨|YUJIAZHAI",
|
||||||
|
"百花村|BAIHUACUN","常青路|CHANGQINGLU",
|
||||||
|
"市中医医院|SHIZHONGYIYIYUAN","行政中心|XINGZHENGZHONGXIN","文景路|WENJINGLU",
|
||||||
|
"凤城九路|FENGCHENGJIULU","凤城十二路|FENGCHENGSHIERLU","元朔路|YUANSHUOLU",
|
||||||
|
"北客站(北广场)|BEIKEZHAN(BEIGUANGCHANG)"]:
|
||||||
|
get:
|
||||||
|
return stations
|
||||||
|
set(v):
|
||||||
|
stations = v
|
||||||
|
assert(stations.size() > 0, "车站列表不能为空")
|
||||||
|
for s in stations:
|
||||||
|
assert(s.split("|").size() == 2, "车站名格式:'车站名|车站英文名'")
|
||||||
|
update()
|
||||||
|
## 当前车站索引
|
||||||
|
@export var currentStationIndex: int = 0:
|
||||||
|
get:
|
||||||
|
return currentStationIndex
|
||||||
|
set(v):
|
||||||
|
currentStationIndex = v
|
||||||
|
assert(v >= 0 && v < stations.size(), "当前站超出车站索引范围")
|
||||||
|
update()
|
||||||
|
## 背景色
|
||||||
|
@export var bgColor: Color = Color.DARK_GRAY:
|
||||||
|
get:
|
||||||
|
return bgColor
|
||||||
|
set(v):
|
||||||
|
bgColor = v
|
||||||
|
update()
|
||||||
|
## 已经过站点图标颜色
|
||||||
|
@export var finishedColor: Color = Color.DARK_GRAY:
|
||||||
|
get:
|
||||||
|
return finishedColor
|
||||||
|
set(v):
|
||||||
|
finishedColor = v
|
||||||
|
update()
|
||||||
|
## 未经过站点图标颜色
|
||||||
|
@export var unfinishedColor: Color = Color.DARK_GREEN:
|
||||||
|
get:
|
||||||
|
return unfinishedColor
|
||||||
|
set(v):
|
||||||
|
unfinishedColor = v
|
||||||
|
update()
|
||||||
|
|
||||||
|
@onready var siteInfoScene: PackedScene = preload("res://station_info_panel/style1/site_info.tscn")
|
||||||
|
@onready var siteCircleStyle: StyleBoxFlat = preload("res://station_info_panel/style1/site_style_circle.tres")
|
||||||
|
@onready var siteStripStyle: StyleBoxFlat = preload("res://station_info_panel/style1/site_style_strip.tres")
|
||||||
|
## 站点样式缓存
|
||||||
|
var siteStyleMap: Dictionary = {}
|
||||||
|
|
||||||
|
const BorderWidth = 2
|
||||||
|
const PassedColor = Color.DARK_GRAY
|
||||||
|
|
||||||
|
var isReady = false
|
||||||
|
|
||||||
|
# 重绘完成和未完成的线路条
|
||||||
|
func updateBgStrips():
|
||||||
|
var totalWidth = $Bg.size.x - (2 * BorderWidth)
|
||||||
|
if leftToRight:
|
||||||
|
var currentSite = $Sites.get_child(currentStationIndex)
|
||||||
|
$Bg/Finished["theme_override_styles/panel"].bg_color = finishedColor
|
||||||
|
$Bg/Finished.position.x = BorderWidth
|
||||||
|
$Bg/Finished.size.x = currentSite.position.x - BorderWidth
|
||||||
|
$Bg/Unfinished["theme_override_styles/panel"].bg_color = unfinishedColor
|
||||||
|
$Bg/Unfinished.position.x = currentSite.position.x
|
||||||
|
$Bg/Unfinished.size.x = totalWidth - currentSite.position.x
|
||||||
|
else:
|
||||||
|
var currentSite = $Sites.get_child(stations.size()-1-currentStationIndex)
|
||||||
|
$Bg/Finished["theme_override_styles/panel"].bg_color = finishedColor
|
||||||
|
$Bg/Finished.position.x = currentSite.position.x
|
||||||
|
$Bg/Finished.size.x = totalWidth - currentSite.position.x
|
||||||
|
$Bg/Unfinished["theme_override_styles/panel"].bg_color = unfinishedColor
|
||||||
|
$Bg/Unfinished.position.x = BorderWidth
|
||||||
|
$Bg/Unfinished.size.x = currentSite.position.x - BorderWidth
|
||||||
|
|
||||||
|
## 更新站点颜色样式
|
||||||
|
func updateSite(site, siteStyleColor: Color, nameColor):
|
||||||
|
var key = siteStyleColor.to_html()
|
||||||
|
var siteStyle
|
||||||
|
if siteStyleMap.has(key):
|
||||||
|
siteStyle = siteStyleMap[key]
|
||||||
|
else:
|
||||||
|
var circleStyle = siteCircleStyle.duplicate()
|
||||||
|
var stripStyle = siteStripStyle.duplicate()
|
||||||
|
circleStyle.border_color = siteStyleColor
|
||||||
|
stripStyle.bg_color = siteStyleColor
|
||||||
|
siteStyle = {"circle": circleStyle, "strip": stripStyle}
|
||||||
|
siteStyleMap[key] = siteStyle
|
||||||
|
site.siteCircleStyle = siteStyle["circle"]
|
||||||
|
site.siteStripStyle = siteStyle["strip"]
|
||||||
|
site.nameColor = nameColor
|
||||||
|
|
||||||
|
## 重绘
|
||||||
|
func update():
|
||||||
|
if not isReady:
|
||||||
|
return
|
||||||
|
# 更新前先删除之前的
|
||||||
|
for c in $Sites.get_children():
|
||||||
|
c.free()
|
||||||
|
# 更新背景色
|
||||||
|
$Bg["theme_override_styles/panel"].bg_color = bgColor
|
||||||
|
# 根据方向添加站点信息组件
|
||||||
|
var size = stations.size()
|
||||||
|
var range: Array
|
||||||
|
if leftToRight:
|
||||||
|
range = range(size)
|
||||||
|
else:
|
||||||
|
range = range(size-1, -1, -1)
|
||||||
|
assert(currentStationIndex >= 0 && currentStationIndex < size, "当前站超出车站索引范围")
|
||||||
|
for i in range:
|
||||||
|
var si = stations[i]
|
||||||
|
var sns = si.split("|")
|
||||||
|
var sis = siteInfoScene.instantiate()
|
||||||
|
sis.stationName = sns[0]
|
||||||
|
sis.stationEnName = sns[1]
|
||||||
|
if i > currentStationIndex:
|
||||||
|
updateSite(sis, unfinishedColor, unfinishedColor)
|
||||||
|
else:
|
||||||
|
#sis.siteCircleStyle = siteFinishedCircleStyle
|
||||||
|
#sis.siteStripStyle = siteFinishedStripStyle
|
||||||
|
#sis.nameColor = finishedColor
|
||||||
|
updateSite(sis, finishedColor, finishedColor)
|
||||||
|
$Sites.add_child(sis)
|
||||||
|
# 计算边界最小尺寸(最右边文字不超出边界)
|
||||||
|
var last = $Sites.get_child(size-1)
|
||||||
|
var edgeWidth = last.calculateWidth()
|
||||||
|
# 计算间隔
|
||||||
|
var totalWidth = $Bg.size.x - (2 * BorderWidth)
|
||||||
|
var interval = totalWidth / (size + 1)
|
||||||
|
print(edgeWidth, ", ", interval)
|
||||||
|
if interval < edgeWidth:
|
||||||
|
var remain = totalWidth - edgeWidth
|
||||||
|
interval = remain / size
|
||||||
|
var i = 1
|
||||||
|
for sc in $Sites.get_children():
|
||||||
|
sc.position.x += i * interval
|
||||||
|
i += 1
|
||||||
|
# 更新线路条
|
||||||
|
updateBgStrips()
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
isReady = true
|
||||||
|
update()
|
52
station_info_panel/style1/site_panel_content.tscn
Normal file
52
station_info_panel/style1/site_panel_content.tscn
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
[gd_scene load_steps=5 format=3 uid="uid://dsv55hv2sr7hd"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://station_info_panel/style1/site_panel_content.gd" id="1_rx766"]
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_48edc"]
|
||||||
|
bg_color = Color(0.290196, 0.309804, 0.333333, 1)
|
||||||
|
border_width_left = 2
|
||||||
|
border_width_top = 2
|
||||||
|
border_width_right = 2
|
||||||
|
border_width_bottom = 2
|
||||||
|
border_color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_dmayk"]
|
||||||
|
bg_color = Color(0.929412, 0.407843, 0.0745098, 1)
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ve86j"]
|
||||||
|
bg_color = Color(0.662745, 0.662745, 0.662745, 1)
|
||||||
|
|
||||||
|
[node name="SitePanel" type="Node2D"]
|
||||||
|
script = ExtResource("1_rx766")
|
||||||
|
currentStationIndex = 5
|
||||||
|
bgColor = Color(0.290196, 0.309804, 0.333333, 1)
|
||||||
|
unfinishedColor = Color(0.929412, 0.407843, 0.0745098, 1)
|
||||||
|
|
||||||
|
[node name="Bg" type="Panel" parent="."]
|
||||||
|
offset_right = 1450.0
|
||||||
|
offset_bottom = 350.0
|
||||||
|
theme_override_styles/panel = SubResource("StyleBoxFlat_48edc")
|
||||||
|
|
||||||
|
[node name="Unfinished" type="Panel" parent="Bg"]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_left = 275.763
|
||||||
|
offset_top = 110.0
|
||||||
|
offset_right = 1446.0
|
||||||
|
offset_bottom = 130.0
|
||||||
|
theme_override_styles/panel = SubResource("StyleBoxFlat_dmayk")
|
||||||
|
|
||||||
|
[node name="Finished" type="Panel" parent="Bg"]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_left = 2.0
|
||||||
|
offset_top = 110.0
|
||||||
|
offset_right = 275.763
|
||||||
|
offset_bottom = 130.0
|
||||||
|
theme_override_styles/panel = SubResource("StyleBoxFlat_ve86j")
|
||||||
|
|
||||||
|
[node name="Sites" type="Control" parent="."]
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 0
|
||||||
|
offset_left = 2.0
|
||||||
|
offset_top = 117.0
|
||||||
|
offset_right = 42.0
|
||||||
|
offset_bottom = 157.0
|
14
station_info_panel/style1/site_style_circle.tres
Normal file
14
station_info_panel/style1/site_style_circle.tres
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
[gd_resource type="StyleBoxFlat" format=3 uid="uid://ddj1ajtx312pj"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
bg_color = Color(1, 1, 1, 1)
|
||||||
|
border_width_left = 7
|
||||||
|
border_width_top = 7
|
||||||
|
border_width_right = 7
|
||||||
|
border_width_bottom = 7
|
||||||
|
border_color = Color(0.662745, 0.662745, 0.662745, 1)
|
||||||
|
corner_radius_top_left = 40
|
||||||
|
corner_radius_top_right = 40
|
||||||
|
corner_radius_bottom_right = 40
|
||||||
|
corner_radius_bottom_left = 40
|
||||||
|
shadow_color = Color(0, 0, 0, 0.780392)
|
4
station_info_panel/style1/site_style_strip.tres
Normal file
4
station_info_panel/style1/site_style_strip.tres
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
[gd_resource type="StyleBoxFlat" format=3 uid="uid://dxf00nrmospua"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
bg_color = Color(0.662745, 0.662745, 0.662745, 1)
|
8
station_info_panel/style1/station_site_info.gd
Normal file
8
station_info_panel/style1/station_site_info.gd
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
class_name StationSiteInfo
|
||||||
|
|
||||||
|
## 中文名
|
||||||
|
var name: String
|
||||||
|
## 英文/拼音名称
|
||||||
|
var enName: String
|
||||||
|
## 是否换乘站
|
||||||
|
var isTransfer: bool
|
Loading…
Reference in New Issue
Block a user