Compare commits
3 Commits
01bd04c905
...
8e8812ee64
| Author | SHA1 | Date | |
|---|---|---|---|
| 8e8812ee64 | |||
| 43991a4fa0 | |||
| 399606357c |
@ -57,6 +57,20 @@ model_point_class_save_path="godot/maps/entity_models"
|
|||||||
|
|
||||||
[input]
|
[input]
|
||||||
|
|
||||||
|
ui_accept={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":16,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194309,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":16,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194310,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":16,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":32,"physical_keycode":0,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":true,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
ui_cancel={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":16,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194305,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":1,"pressure":0.0,"pressed":true,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
toggle_cli={
|
toggle_cli={
|
||||||
"deadzone": 0.2,
|
"deadzone": 0.2,
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":167,"key_label":0,"unicode":167,"location":0,"echo":false,"script":null)
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":167,"key_label":0,"unicode":167,"location":0,"echo":false,"script":null)
|
||||||
|
|||||||
@ -39,6 +39,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
|
||||||
|
focus_next = Callable()
|
||||||
theme = ExtResource("3_dfnwm")
|
theme = ExtResource("3_dfnwm")
|
||||||
theme_override_styles/panel = SubResource("StyleBoxFlat_7j863")
|
theme_override_styles/panel = SubResource("StyleBoxFlat_7j863")
|
||||||
|
|
||||||
@ -229,3 +230,4 @@ current = true
|
|||||||
[connection signal="pressed" from="lobby/v_box_container3/h_box_container/exit_button" to="lobby" method="exit"]
|
[connection signal="pressed" from="lobby/v_box_container3/h_box_container/exit_button" to="lobby" method="exit"]
|
||||||
[connection signal="pressed" from="lobby/v_box_container3/h_box_container/options_button" to="lobby" method="open_options"]
|
[connection signal="pressed" from="lobby/v_box_container3/h_box_container/options_button" to="lobby" method="open_options"]
|
||||||
[connection signal="pressed" from="lobby/v_box_container3/h_box_container/settings_button" to="lobby/settings" method="open"]
|
[connection signal="pressed" from="lobby/v_box_container3/h_box_container/settings_button" to="lobby/settings" method="open"]
|
||||||
|
[connection signal="on_close" from="lobby/settings" to="lobby" method="focus_next"]
|
||||||
|
|||||||
@ -11,17 +11,17 @@
|
|||||||
camera = NodePath("camera_3d")
|
camera = NodePath("camera_3d")
|
||||||
main_position = NodePath("main_pos")
|
main_position = NodePath("main_pos")
|
||||||
host_position = NodePath("host_pos")
|
host_position = NodePath("host_pos")
|
||||||
main_panel = NodePath("main_panel")
|
main_panel = NodePath("menus/main_panel")
|
||||||
host_panel = NodePath("host_panel")
|
host_panel = NodePath("menus/host_panel")
|
||||||
join_panel = NodePath("join_panel")
|
join_panel = NodePath("menus/join_panel")
|
||||||
host_port = NodePath("host_panel/v_box_container/host_port")
|
host_port = NodePath("menus/host_panel/v_box_container/host_port")
|
||||||
join_addr = NodePath("join_panel/v_box_container/margin_container/v_box_container/address_text")
|
join_addr = NodePath("menus/join_panel/v_box_container/margin_container/v_box_container/address_text")
|
||||||
join_port = NodePath("join_panel/v_box_container/margin_container/v_box_container/port_text")
|
join_port = NodePath("menus/join_panel/v_box_container/margin_container/v_box_container/port_text")
|
||||||
recent_servers_button = NodePath("join_panel/v_box_container/margin_container/v_box_container/recent_servers")
|
recent_servers_button = NodePath("menus/join_panel/v_box_container/margin_container/v_box_container/recent_servers")
|
||||||
popup_panel = NodePath("popup_panel")
|
popup_panel = NodePath("menus/popup_panel")
|
||||||
popup_title = NodePath("popup_panel/v_box_container/title")
|
popup_title = NodePath("menus/popup_panel/v_box_container/title")
|
||||||
popup_text = NodePath("popup_panel/v_box_container/text")
|
popup_text = NodePath("menus/popup_panel/v_box_container/text")
|
||||||
popup_button = NodePath("popup_panel/v_box_container/ok")
|
popup_button = NodePath("menus/popup_panel/v_box_container/ok")
|
||||||
credits = ExtResource("1_sugp2")
|
credits = ExtResource("1_sugp2")
|
||||||
open_replay_dialog = NodePath("open_replay_dialog")
|
open_replay_dialog = NodePath("open_replay_dialog")
|
||||||
|
|
||||||
@ -38,256 +38,12 @@ transform = Transform3D(0.9823497, 0, 0.18705386, 0, 1, 0, -0.18705386, 0, 0.982
|
|||||||
[node name="menu_player3" parent="." unique_id=1638403481 instance=ExtResource("1_o5qli")]
|
[node name="menu_player3" parent="." unique_id=1638403481 instance=ExtResource("1_o5qli")]
|
||||||
transform = Transform3D(-0.26696783, 0, 0.9637054, 0, 1, 0, -0.9637054, 0, -0.26696783, -3.5550833, -2.3841858e-07, 2.7302406)
|
transform = Transform3D(-0.26696783, 0, 0.9637054, 0, 1, 0, -0.9637054, 0, -0.26696783, -3.5550833, -2.3841858e-07, 2.7302406)
|
||||||
|
|
||||||
[node name="main_panel" type="Panel" parent="." unique_id=2078435804]
|
|
||||||
offset_left = 136.0
|
|
||||||
offset_top = 111.0
|
|
||||||
offset_right = 339.0
|
|
||||||
offset_bottom = 508.0
|
|
||||||
theme = ExtResource("3_jscy8")
|
|
||||||
|
|
||||||
[node name="v_box_container" type="VBoxContainer" parent="main_panel" unique_id=287461844]
|
|
||||||
layout_mode = 1
|
|
||||||
anchors_preset = 8
|
|
||||||
anchor_left = 0.5
|
|
||||||
anchor_top = 0.5
|
|
||||||
anchor_right = 0.5
|
|
||||||
anchor_bottom = 0.5
|
|
||||||
offset_left = -47.0
|
|
||||||
offset_top = -95.0
|
|
||||||
offset_right = 47.0
|
|
||||||
offset_bottom = 95.0
|
|
||||||
grow_horizontal = 2
|
|
||||||
grow_vertical = 2
|
|
||||||
alignment = 1
|
|
||||||
|
|
||||||
[node name="texture_rect" type="TextureRect" parent="main_panel/v_box_container" unique_id=1881966626]
|
|
||||||
custom_minimum_size = Vector2(0, 30)
|
|
||||||
layout_mode = 2
|
|
||||||
texture = ExtResource("4_pm3ni")
|
|
||||||
expand_mode = 3
|
|
||||||
stretch_mode = 4
|
|
||||||
|
|
||||||
[node name="margin_container" type="MarginContainer" parent="main_panel/v_box_container" unique_id=143702935]
|
|
||||||
layout_mode = 2
|
|
||||||
theme_override_constants/margin_top = 50
|
|
||||||
|
|
||||||
[node name="v_box_container" type="VBoxContainer" parent="main_panel/v_box_container/margin_container" unique_id=358951965]
|
|
||||||
layout_mode = 2
|
|
||||||
|
|
||||||
[node name="host" type="Button" parent="main_panel/v_box_container/margin_container/v_box_container" unique_id=1962091117]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "Host Game"
|
|
||||||
metadata/_edit_lock_ = true
|
|
||||||
|
|
||||||
[node name="join" type="Button" parent="main_panel/v_box_container/margin_container/v_box_container" unique_id=1364459397]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "Join Game"
|
|
||||||
metadata/_edit_lock_ = true
|
|
||||||
|
|
||||||
[node name="play_replay" type="Button" parent="main_panel/v_box_container/margin_container/v_box_container" unique_id=275552647]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "Play Replay"
|
|
||||||
metadata/_edit_lock_ = true
|
|
||||||
|
|
||||||
[node name="credits" type="Button" parent="main_panel/v_box_container/margin_container/v_box_container" unique_id=953921422]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "Credits"
|
|
||||||
metadata/_edit_lock_ = true
|
|
||||||
|
|
||||||
[node name="settings" type="Button" parent="main_panel/v_box_container/margin_container/v_box_container" unique_id=1153899756]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "Settings"
|
|
||||||
metadata/_edit_lock_ = true
|
|
||||||
|
|
||||||
[node name="quit" type="Button" parent="main_panel/v_box_container/margin_container/v_box_container" unique_id=1508139096]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "Quit"
|
|
||||||
metadata/_edit_lock_ = true
|
|
||||||
|
|
||||||
[node name="host_panel" type="Panel" parent="." unique_id=1633876079]
|
|
||||||
visible = false
|
|
||||||
offset_left = 139.0
|
|
||||||
offset_top = 167.0
|
|
||||||
offset_right = 336.0
|
|
||||||
offset_bottom = 474.0
|
|
||||||
theme = ExtResource("3_jscy8")
|
|
||||||
|
|
||||||
[node name="v_box_container" type="VBoxContainer" parent="host_panel" unique_id=1651169053]
|
|
||||||
layout_mode = 1
|
|
||||||
anchors_preset = 8
|
|
||||||
anchor_left = 0.5
|
|
||||||
anchor_top = 0.5
|
|
||||||
anchor_right = 0.5
|
|
||||||
anchor_bottom = 0.5
|
|
||||||
offset_left = -47.0
|
|
||||||
offset_top = -95.0
|
|
||||||
offset_right = 47.0
|
|
||||||
offset_bottom = 95.0
|
|
||||||
grow_horizontal = 2
|
|
||||||
grow_vertical = 2
|
|
||||||
alignment = 1
|
|
||||||
|
|
||||||
[node name="title" type="Label" parent="host_panel/v_box_container" unique_id=1539421918]
|
|
||||||
custom_minimum_size = Vector2(0, 50)
|
|
||||||
layout_mode = 2
|
|
||||||
text = "Host Game"
|
|
||||||
horizontal_alignment = 1
|
|
||||||
metadata/_edit_lock_ = true
|
|
||||||
|
|
||||||
[node name="port_label" type="Label" parent="host_panel/v_box_container" unique_id=1618746525]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "Port"
|
|
||||||
horizontal_alignment = 1
|
|
||||||
|
|
||||||
[node name="host_port" type="SpinBox" parent="host_panel/v_box_container" unique_id=1116593197]
|
|
||||||
layout_mode = 2
|
|
||||||
max_value = 16000.0
|
|
||||||
value = 8080.0
|
|
||||||
alignment = 1
|
|
||||||
|
|
||||||
[node name="host" type="Button" parent="host_panel/v_box_container" unique_id=312403378]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "Host"
|
|
||||||
|
|
||||||
[node name="back" type="Button" parent="host_panel/v_box_container" unique_id=1658922684]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "Back"
|
|
||||||
|
|
||||||
[node name="join_panel" type="Panel" parent="." unique_id=1630672771]
|
|
||||||
visible = false
|
|
||||||
offset_left = 122.0
|
|
||||||
offset_top = 115.0
|
|
||||||
offset_right = 352.0
|
|
||||||
offset_bottom = 509.0
|
|
||||||
theme = ExtResource("3_jscy8")
|
|
||||||
|
|
||||||
[node name="v_box_container" type="VBoxContainer" parent="join_panel" unique_id=2029384993]
|
|
||||||
layout_mode = 1
|
|
||||||
anchors_preset = 8
|
|
||||||
anchor_left = 0.5
|
|
||||||
anchor_top = 0.5
|
|
||||||
anchor_right = 0.5
|
|
||||||
anchor_bottom = 0.5
|
|
||||||
offset_left = -47.0
|
|
||||||
offset_top = -95.0
|
|
||||||
offset_right = 47.0
|
|
||||||
offset_bottom = 95.0
|
|
||||||
grow_horizontal = 2
|
|
||||||
grow_vertical = 2
|
|
||||||
alignment = 1
|
|
||||||
|
|
||||||
[node name="title" type="Label" parent="join_panel/v_box_container" unique_id=268455606]
|
|
||||||
custom_minimum_size = Vector2(0, 50)
|
|
||||||
layout_mode = 2
|
|
||||||
text = "Join Game"
|
|
||||||
horizontal_alignment = 1
|
|
||||||
metadata/_edit_lock_ = true
|
|
||||||
|
|
||||||
[node name="margin_container" type="MarginContainer" parent="join_panel/v_box_container" unique_id=979302447]
|
|
||||||
layout_mode = 2
|
|
||||||
theme_override_constants/margin_top = 0
|
|
||||||
theme_override_constants/margin_bottom = 30
|
|
||||||
|
|
||||||
[node name="v_box_container" type="VBoxContainer" parent="join_panel/v_box_container/margin_container" unique_id=1555998390]
|
|
||||||
layout_mode = 2
|
|
||||||
|
|
||||||
[node name="recent_servers_label" type="Label" parent="join_panel/v_box_container/margin_container/v_box_container" unique_id=683871668]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "Recent Servers"
|
|
||||||
horizontal_alignment = 1
|
|
||||||
|
|
||||||
[node name="recent_servers" type="OptionButton" parent="join_panel/v_box_container/margin_container/v_box_container" unique_id=486398131]
|
|
||||||
layout_mode = 2
|
|
||||||
|
|
||||||
[node name="address_label" type="Label" parent="join_panel/v_box_container/margin_container/v_box_container" unique_id=425811384]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "Address"
|
|
||||||
horizontal_alignment = 1
|
|
||||||
|
|
||||||
[node name="address_text" type="LineEdit" parent="join_panel/v_box_container/margin_container/v_box_container" unique_id=672176728]
|
|
||||||
custom_minimum_size = Vector2(150, 30)
|
|
||||||
layout_mode = 2
|
|
||||||
text = "127.0.0.1"
|
|
||||||
|
|
||||||
[node name="port_label" type="Label" parent="join_panel/v_box_container/margin_container/v_box_container" unique_id=1606834624]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "Port"
|
|
||||||
horizontal_alignment = 1
|
|
||||||
|
|
||||||
[node name="port_text" type="SpinBox" parent="join_panel/v_box_container/margin_container/v_box_container" unique_id=418812818]
|
|
||||||
custom_minimum_size = Vector2(150, 30)
|
|
||||||
layout_mode = 2
|
|
||||||
min_value = 1.0
|
|
||||||
max_value = 16000.0
|
|
||||||
value = 8080.0
|
|
||||||
|
|
||||||
[node name="join" type="Button" parent="join_panel/v_box_container" unique_id=1953386108]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "Join"
|
|
||||||
|
|
||||||
[node name="back" type="Button" parent="join_panel/v_box_container" unique_id=759190425]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "Back"
|
|
||||||
|
|
||||||
[node name="settings" parent="." unique_id=999912383 instance=ExtResource("2_0wfyh")]
|
|
||||||
visible = false
|
|
||||||
|
|
||||||
[node name="main_pos" type="Node3D" parent="." unique_id=98241074]
|
[node name="main_pos" type="Node3D" parent="." unique_id=98241074]
|
||||||
transform = Transform3D(0.98629165, -0.031186387, 0.16203767, -1.4054484e-08, 0.981978, 0.1889952, -0.16501155, -0.18640435, 0.9685167, 1.0974054, 1.7166122, 1.4909104)
|
transform = Transform3D(0.98629165, -0.031186387, 0.16203767, -1.4054484e-08, 0.981978, 0.1889952, -0.16501155, -0.18640435, 0.9685167, 1.0974054, 1.7166122, 1.4909104)
|
||||||
|
|
||||||
[node name="host_pos" type="Node3D" parent="." unique_id=663794107]
|
[node name="host_pos" type="Node3D" parent="." unique_id=663794107]
|
||||||
transform = Transform3D(0.3960592, -0.17354009, 0.90167665, -1.9851193e-08, 0.981978, 0.18899521, -0.9182249, -0.0748533, 0.38892144, -1.0602233, 1.7166122, 3.759781)
|
transform = Transform3D(0.3960592, -0.17354009, 0.90167665, -1.9851193e-08, 0.981978, 0.18899521, -0.9182249, -0.0748533, 0.38892144, -1.0602233, 1.7166122, 3.759781)
|
||||||
|
|
||||||
[node name="popup_panel" type="Panel" parent="." unique_id=1792775604]
|
|
||||||
visible = false
|
|
||||||
anchors_preset = 8
|
|
||||||
anchor_left = 0.5
|
|
||||||
anchor_top = 0.5
|
|
||||||
anchor_right = 0.5
|
|
||||||
anchor_bottom = 0.5
|
|
||||||
offset_left = -153.0
|
|
||||||
offset_top = -71.0
|
|
||||||
offset_right = 153.0
|
|
||||||
offset_bottom = 71.0
|
|
||||||
grow_horizontal = 2
|
|
||||||
grow_vertical = 2
|
|
||||||
theme = ExtResource("3_jscy8")
|
|
||||||
|
|
||||||
[node name="v_box_container" type="VBoxContainer" parent="popup_panel" unique_id=465766643]
|
|
||||||
layout_mode = 1
|
|
||||||
anchors_preset = 8
|
|
||||||
anchor_left = 0.5
|
|
||||||
anchor_top = 0.5
|
|
||||||
anchor_right = 0.5
|
|
||||||
anchor_bottom = 0.5
|
|
||||||
offset_left = -20.0
|
|
||||||
offset_top = -20.0
|
|
||||||
offset_right = 20.0
|
|
||||||
offset_bottom = 20.0
|
|
||||||
grow_horizontal = 2
|
|
||||||
grow_vertical = 2
|
|
||||||
alignment = 1
|
|
||||||
|
|
||||||
[node name="title" type="Label" parent="popup_panel/v_box_container" unique_id=1944397487]
|
|
||||||
layout_mode = 2
|
|
||||||
size_flags_horizontal = 4
|
|
||||||
theme_override_font_sizes/font_size = 25
|
|
||||||
text = "Some Title"
|
|
||||||
horizontal_alignment = 1
|
|
||||||
|
|
||||||
[node name="text" type="Label" parent="popup_panel/v_box_container" unique_id=1988165424]
|
|
||||||
custom_minimum_size = Vector2(300, 0)
|
|
||||||
custom_maximum_size = Vector2(300, -1)
|
|
||||||
layout_mode = 2
|
|
||||||
size_flags_horizontal = 4
|
|
||||||
text = "Some text"
|
|
||||||
horizontal_alignment = 1
|
|
||||||
autowrap_mode = 3
|
|
||||||
|
|
||||||
[node name="ok" type="Button" parent="popup_panel/v_box_container" unique_id=488898874]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "Ok"
|
|
||||||
|
|
||||||
[node name="open_replay_dialog" type="FileDialog" parent="." unique_id=925465558]
|
[node name="open_replay_dialog" type="FileDialog" parent="." unique_id=925465558]
|
||||||
title = "Open a File"
|
title = "Open a File"
|
||||||
file_mode = 0
|
file_mode = 0
|
||||||
@ -318,14 +74,280 @@ spot_angle = 11.861256
|
|||||||
[node name="precipice_static" parent="background" unique_id=1151780860 instance=ExtResource("6_tefeu")]
|
[node name="precipice_static" parent="background" unique_id=1151780860 instance=ExtResource("6_tefeu")]
|
||||||
transform = Transform3D(0.37768292, 0, 0.925935, 0, 1, 0, -0.925935, 0, 0.37768292, 34.79668, -16.012611, -118.59651)
|
transform = Transform3D(0.37768292, 0, 0.925935, 0, 1, 0, -0.925935, 0, 0.37768292, 34.79668, -16.012611, -118.59651)
|
||||||
|
|
||||||
[connection signal="pressed" from="main_panel/v_box_container/margin_container/v_box_container/host" to="." method="go_to_host_game"]
|
[node name="menus" type="Control" parent="." unique_id=63647336]
|
||||||
[connection signal="pressed" from="main_panel/v_box_container/margin_container/v_box_container/join" to="." method="go_to_join_game"]
|
layout_mode = 3
|
||||||
[connection signal="pressed" from="main_panel/v_box_container/margin_container/v_box_container/play_replay" to="." method="open_replay_dialog"]
|
anchors_preset = 15
|
||||||
[connection signal="pressed" from="main_panel/v_box_container/margin_container/v_box_container/credits" to="." method="open_credits"]
|
anchor_right = 1.0
|
||||||
[connection signal="pressed" from="main_panel/v_box_container/margin_container/v_box_container/settings" to="settings" method="open"]
|
anchor_bottom = 1.0
|
||||||
[connection signal="pressed" from="main_panel/v_box_container/margin_container/v_box_container/quit" to="." method="quit_game"]
|
grow_horizontal = 2
|
||||||
[connection signal="pressed" from="host_panel/v_box_container/host" to="." method="host_game"]
|
grow_vertical = 2
|
||||||
[connection signal="pressed" from="host_panel/v_box_container/back" to="." method="go_to_main_menu"]
|
|
||||||
[connection signal="pressed" from="join_panel/v_box_container/join" to="." method="join_game"]
|
[node name="main_panel" type="Panel" parent="menus" unique_id=2078435804]
|
||||||
[connection signal="pressed" from="join_panel/v_box_container/back" to="." method="go_to_main_menu"]
|
layout_mode = 0
|
||||||
[connection signal="pressed" from="popup_panel/v_box_container/ok" to="." method="hide_popup"]
|
offset_left = 136.0
|
||||||
|
offset_top = 111.0
|
||||||
|
offset_right = 339.0
|
||||||
|
offset_bottom = 508.0
|
||||||
|
theme = ExtResource("3_jscy8")
|
||||||
|
|
||||||
|
[node name="v_box_container" type="VBoxContainer" parent="menus/main_panel" unique_id=287461844]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -47.0
|
||||||
|
offset_top = -95.0
|
||||||
|
offset_right = 47.0
|
||||||
|
offset_bottom = 95.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="texture_rect" type="TextureRect" parent="menus/main_panel/v_box_container" unique_id=1881966626]
|
||||||
|
custom_minimum_size = Vector2(0, 30)
|
||||||
|
layout_mode = 2
|
||||||
|
texture = ExtResource("4_pm3ni")
|
||||||
|
expand_mode = 3
|
||||||
|
stretch_mode = 4
|
||||||
|
|
||||||
|
[node name="margin_container" type="MarginContainer" parent="menus/main_panel/v_box_container" unique_id=143702935]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/margin_top = 50
|
||||||
|
|
||||||
|
[node name="v_box_container" type="VBoxContainer" parent="menus/main_panel/v_box_container/margin_container" unique_id=358951965]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="host" type="Button" parent="menus/main_panel/v_box_container/margin_container/v_box_container" unique_id=1962091117]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Host Game"
|
||||||
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
|
[node name="join" type="Button" parent="menus/main_panel/v_box_container/margin_container/v_box_container" unique_id=1364459397]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Join Game"
|
||||||
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
|
[node name="play_replay" type="Button" parent="menus/main_panel/v_box_container/margin_container/v_box_container" unique_id=275552647]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Play Replay"
|
||||||
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
|
[node name="credits" type="Button" parent="menus/main_panel/v_box_container/margin_container/v_box_container" unique_id=953921422]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Credits"
|
||||||
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
|
[node name="settings" type="Button" parent="menus/main_panel/v_box_container/margin_container/v_box_container" unique_id=1153899756]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Settings"
|
||||||
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
|
[node name="quit" type="Button" parent="menus/main_panel/v_box_container/margin_container/v_box_container" unique_id=1508139096]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Quit"
|
||||||
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
|
[node name="host_panel" type="Panel" parent="menus" unique_id=1633876079]
|
||||||
|
visible = false
|
||||||
|
layout_mode = 0
|
||||||
|
offset_left = 139.0
|
||||||
|
offset_top = 167.0
|
||||||
|
offset_right = 336.0
|
||||||
|
offset_bottom = 474.0
|
||||||
|
theme = ExtResource("3_jscy8")
|
||||||
|
|
||||||
|
[node name="v_box_container" type="VBoxContainer" parent="menus/host_panel" unique_id=1651169053]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -47.0
|
||||||
|
offset_top = -95.0
|
||||||
|
offset_right = 47.0
|
||||||
|
offset_bottom = 95.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="title" type="Label" parent="menus/host_panel/v_box_container" unique_id=1539421918]
|
||||||
|
custom_minimum_size = Vector2(0, 50)
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Host Game"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
|
[node name="port_label" type="Label" parent="menus/host_panel/v_box_container" unique_id=1618746525]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Port"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="host_port" type="SpinBox" parent="menus/host_panel/v_box_container" unique_id=1116593197]
|
||||||
|
layout_mode = 2
|
||||||
|
max_value = 16000.0
|
||||||
|
value = 8080.0
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="host" type="Button" parent="menus/host_panel/v_box_container" unique_id=312403378]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Host"
|
||||||
|
|
||||||
|
[node name="back" type="Button" parent="menus/host_panel/v_box_container" unique_id=1658922684]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Back"
|
||||||
|
|
||||||
|
[node name="join_panel" type="Panel" parent="menus" unique_id=1630672771]
|
||||||
|
visible = false
|
||||||
|
layout_mode = 0
|
||||||
|
offset_left = 122.0
|
||||||
|
offset_top = 115.0
|
||||||
|
offset_right = 352.0
|
||||||
|
offset_bottom = 509.0
|
||||||
|
theme = ExtResource("3_jscy8")
|
||||||
|
|
||||||
|
[node name="v_box_container" type="VBoxContainer" parent="menus/join_panel" unique_id=2029384993]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -47.0
|
||||||
|
offset_top = -95.0
|
||||||
|
offset_right = 47.0
|
||||||
|
offset_bottom = 95.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="title" type="Label" parent="menus/join_panel/v_box_container" unique_id=268455606]
|
||||||
|
custom_minimum_size = Vector2(0, 50)
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Join Game"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
|
[node name="margin_container" type="MarginContainer" parent="menus/join_panel/v_box_container" unique_id=979302447]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/margin_top = 0
|
||||||
|
theme_override_constants/margin_bottom = 30
|
||||||
|
|
||||||
|
[node name="v_box_container" type="VBoxContainer" parent="menus/join_panel/v_box_container/margin_container" unique_id=1555998390]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="recent_servers_label" type="Label" parent="menus/join_panel/v_box_container/margin_container/v_box_container" unique_id=683871668]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Recent Servers"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="recent_servers" type="OptionButton" parent="menus/join_panel/v_box_container/margin_container/v_box_container" unique_id=486398131]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="address_label" type="Label" parent="menus/join_panel/v_box_container/margin_container/v_box_container" unique_id=425811384]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Address"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="address_text" type="LineEdit" parent="menus/join_panel/v_box_container/margin_container/v_box_container" unique_id=672176728]
|
||||||
|
custom_minimum_size = Vector2(150, 30)
|
||||||
|
layout_mode = 2
|
||||||
|
text = "127.0.0.1"
|
||||||
|
|
||||||
|
[node name="port_label" type="Label" parent="menus/join_panel/v_box_container/margin_container/v_box_container" unique_id=1606834624]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Port"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="port_text" type="SpinBox" parent="menus/join_panel/v_box_container/margin_container/v_box_container" unique_id=418812818]
|
||||||
|
custom_minimum_size = Vector2(150, 30)
|
||||||
|
layout_mode = 2
|
||||||
|
min_value = 1.0
|
||||||
|
max_value = 16000.0
|
||||||
|
value = 8080.0
|
||||||
|
|
||||||
|
[node name="join" type="Button" parent="menus/join_panel/v_box_container" unique_id=1953386108]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Join"
|
||||||
|
|
||||||
|
[node name="back" type="Button" parent="menus/join_panel/v_box_container" unique_id=759190425]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Back"
|
||||||
|
|
||||||
|
[node name="settings" parent="menus" unique_id=999912383 instance=ExtResource("2_0wfyh")]
|
||||||
|
visible = false
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_left = 0.0
|
||||||
|
anchor_top = 0.0
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_left = 339.0
|
||||||
|
offset_top = 67.0
|
||||||
|
offset_right = -301.0
|
||||||
|
offset_bottom = -69.0
|
||||||
|
|
||||||
|
[node name="popup_panel" type="Panel" parent="menus" unique_id=1792775604]
|
||||||
|
visible = false
|
||||||
|
layout_mode = 0
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -153.0
|
||||||
|
offset_top = -71.0
|
||||||
|
offset_right = 153.0
|
||||||
|
offset_bottom = 71.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
theme = ExtResource("3_jscy8")
|
||||||
|
|
||||||
|
[node name="v_box_container" type="VBoxContainer" parent="menus/popup_panel" unique_id=465766643]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -20.0
|
||||||
|
offset_top = -20.0
|
||||||
|
offset_right = 20.0
|
||||||
|
offset_bottom = 20.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="title" type="Label" parent="menus/popup_panel/v_box_container" unique_id=1944397487]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 4
|
||||||
|
theme_override_font_sizes/font_size = 25
|
||||||
|
text = "Some Title"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="text" type="Label" parent="menus/popup_panel/v_box_container" unique_id=1988165424]
|
||||||
|
custom_minimum_size = Vector2(300, 0)
|
||||||
|
custom_maximum_size = Vector2(300, -1)
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 4
|
||||||
|
text = "Some text"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
autowrap_mode = 3
|
||||||
|
|
||||||
|
[node name="ok" type="Button" parent="menus/popup_panel/v_box_container" unique_id=488898874]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Ok"
|
||||||
|
|
||||||
|
[connection signal="pressed" from="menus/main_panel/v_box_container/margin_container/v_box_container/host" to="." method="go_to_host_game"]
|
||||||
|
[connection signal="pressed" from="menus/main_panel/v_box_container/margin_container/v_box_container/join" to="." method="go_to_join_game"]
|
||||||
|
[connection signal="pressed" from="menus/main_panel/v_box_container/margin_container/v_box_container/play_replay" to="." method="open_replay_dialog"]
|
||||||
|
[connection signal="pressed" from="menus/main_panel/v_box_container/margin_container/v_box_container/credits" to="." method="open_credits"]
|
||||||
|
[connection signal="pressed" from="menus/main_panel/v_box_container/margin_container/v_box_container/settings" to="menus/settings" method="open"]
|
||||||
|
[connection signal="pressed" from="menus/main_panel/v_box_container/margin_container/v_box_container/quit" to="." method="quit_game"]
|
||||||
|
[connection signal="pressed" from="menus/host_panel/v_box_container/host" to="." method="host_game"]
|
||||||
|
[connection signal="pressed" from="menus/host_panel/v_box_container/back" to="." method="go_to_main_menu"]
|
||||||
|
[connection signal="pressed" from="menus/join_panel/v_box_container/join" to="." method="join_game"]
|
||||||
|
[connection signal="pressed" from="menus/join_panel/v_box_container/back" to="." method="go_to_main_menu"]
|
||||||
|
[connection signal="on_close" from="menus/settings" to="." method="focus_next"]
|
||||||
|
[connection signal="pressed" from="menus/popup_panel/v_box_container/ok" to="." method="hide_popup"]
|
||||||
|
|||||||
@ -59,6 +59,10 @@ impl IPanel for GameFinishedScreen {
|
|||||||
.on_saved()
|
.on_saved()
|
||||||
.connect_other(self, Self::on_replay_saved);
|
.connect_other(self, Self::on_replay_saved);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Some(focus) = &mut self.base_mut().find_next_valid_focus() {
|
||||||
|
focus.grab_focus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -114,11 +114,15 @@ impl IControl for Hud {
|
|||||||
fn input(&mut self, event: Gd<InputEvent>) {
|
fn input(&mut self, event: Gd<InputEvent>) {
|
||||||
if event.is_action_pressed("pause") {
|
if event.is_action_pressed("pause") {
|
||||||
if let Some(pause_panel) = &mut self.pause_panel {
|
if let Some(pause_panel) = &mut self.pause_panel {
|
||||||
let is_visible = pause_panel.is_visible();
|
let was_visible = pause_panel.is_visible();
|
||||||
pause_panel.set_visible(!is_visible);
|
pause_panel.set_visible(!was_visible);
|
||||||
if !pause_panel.is_visible() {
|
if !pause_panel.is_visible() {
|
||||||
if let Some(settings_panel) = &mut self.settings_panel {
|
if let Some(settings_panel) = &mut self.settings_panel {
|
||||||
settings_panel.set_visible(false);
|
settings_panel.bind_mut().close();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if let Some(focus) = &mut pause_panel.find_next_valid_focus() {
|
||||||
|
focus.grab_focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.update_lock();
|
self.update_lock();
|
||||||
|
|||||||
@ -2,8 +2,8 @@ use std::collections::HashMap;
|
|||||||
|
|
||||||
use godot::{
|
use godot::{
|
||||||
classes::{
|
classes::{
|
||||||
Button, CheckBox, CompressedTexture2D, Control, GridContainer, IPanel, Label, LineEdit,
|
Button, CheckBox, CompressedTexture2D, Control, GridContainer, IPanel, InputEvent, Label,
|
||||||
OptionButton, Os, Panel, SpinBox, TabContainer, VBoxContainer,
|
LineEdit, OptionButton, Os, Panel, SpinBox, TabContainer, VBoxContainer,
|
||||||
},
|
},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
};
|
};
|
||||||
@ -223,6 +223,14 @@ impl IPanel for LobbyPanel {
|
|||||||
MusicManager::singleton()
|
MusicManager::singleton()
|
||||||
.bind_mut()
|
.bind_mut()
|
||||||
.play(Some(Music::MainMenu), false);
|
.play(Some(Music::MainMenu), false);
|
||||||
|
|
||||||
|
self.focus_next();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn input(&mut self, event: Gd<InputEvent>) {
|
||||||
|
if event.is_action_pressed("ui_cancel") {
|
||||||
|
self.close_options();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,13 +243,19 @@ impl LobbyPanel {
|
|||||||
fn open_options(&mut self) {
|
fn open_options(&mut self) {
|
||||||
if let Some(panel) = &mut self.options_panel {
|
if let Some(panel) = &mut self.options_panel {
|
||||||
panel.set_visible(true);
|
panel.set_visible(true);
|
||||||
|
if let Some(focus) = &mut panel.find_next_valid_focus() {
|
||||||
|
focus.grab_focus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[func]
|
#[func]
|
||||||
fn close_options(&mut self) {
|
fn close_options(&mut self) {
|
||||||
if let Some(panel) = &mut self.options_panel {
|
if let Some(panel) = &mut self.options_panel
|
||||||
|
&& panel.is_visible()
|
||||||
|
{
|
||||||
panel.set_visible(false);
|
panel.set_visible(false);
|
||||||
|
self.focus_next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -537,6 +551,13 @@ impl LobbyPanel {
|
|||||||
}
|
}
|
||||||
nodes
|
nodes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[func]
|
||||||
|
pub fn focus_next(&mut self) {
|
||||||
|
if let Some(focus) = &mut self.base_mut().find_next_valid_focus() {
|
||||||
|
focus.grab_focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_control(control: Gd<Control>, value: GameOptionValue) {
|
fn update_control(control: Gd<Control>, value: GameOptionValue) {
|
||||||
|
|||||||
@ -72,6 +72,8 @@ pub struct MainMenu {
|
|||||||
|
|
||||||
recent_servers: Vec<RecentServer>,
|
recent_servers: Vec<RecentServer>,
|
||||||
|
|
||||||
|
focus_next: bool,
|
||||||
|
|
||||||
base: Base<Node3D>,
|
base: Base<Node3D>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,6 +107,8 @@ impl INode3D for MainMenu {
|
|||||||
MusicManager::singleton()
|
MusicManager::singleton()
|
||||||
.bind_mut()
|
.bind_mut()
|
||||||
.play(Some(Music::MainMenu), false);
|
.play(Some(Music::MainMenu), false);
|
||||||
|
|
||||||
|
self.focus_next = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn process(&mut self, _delta: f64) {
|
fn process(&mut self, _delta: f64) {
|
||||||
@ -154,13 +158,21 @@ impl INode3D for MainMenu {
|
|||||||
camera.set_global_rotation(new_rot);
|
camera.set_global_rotation(new_rot);
|
||||||
|
|
||||||
if let Some(mut panel) = target_panel {
|
if let Some(mut panel) = target_panel {
|
||||||
|
let mut changed = false;
|
||||||
if let Some(prev_panel) = &mut self.prev_panel {
|
if let Some(prev_panel) = &mut self.prev_panel {
|
||||||
if prev_panel.instance_id() != panel.instance_id() {
|
if prev_panel.instance_id() != panel.instance_id() {
|
||||||
|
changed = true;
|
||||||
prev_panel.set_visible(false);
|
prev_panel.set_visible(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.prev_panel = Some(panel.clone());
|
self.prev_panel = Some(panel.clone());
|
||||||
panel.set_visible(true);
|
panel.set_visible(true);
|
||||||
|
if changed || self.focus_next {
|
||||||
|
if let Some(focus) = &mut panel.find_next_valid_focus() {
|
||||||
|
focus.grab_focus();
|
||||||
|
}
|
||||||
|
self.focus_next = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -270,6 +282,10 @@ impl MainMenu {
|
|||||||
if let Some(button) = &mut self.popup_button {
|
if let Some(button) = &mut self.popup_button {
|
||||||
button.set_visible(ok);
|
button.set_visible(ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Some(focus) = &mut panel.find_next_valid_focus() {
|
||||||
|
focus.grab_focus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,6 +293,7 @@ impl MainMenu {
|
|||||||
pub fn hide_popup(&mut self) {
|
pub fn hide_popup(&mut self) {
|
||||||
if let Some(panel) = &mut self.popup_panel {
|
if let Some(panel) = &mut self.popup_panel {
|
||||||
panel.set_visible(false);
|
panel.set_visible(false);
|
||||||
|
self.focus_next = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,4 +311,9 @@ impl MainMenu {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[func]
|
||||||
|
pub fn focus_next(&mut self) {
|
||||||
|
self.focus_next = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,6 +33,10 @@ impl IPanel for ReplayFinishedScreen {
|
|||||||
GameManager::singleton().bind().go_to_main_menu();
|
GameManager::singleton().bind().go_to_main_menu();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Some(focus) = &mut self.base_mut().find_next_valid_focus() {
|
||||||
|
focus.grab_focus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,7 @@ use godot::{
|
|||||||
classes::{
|
classes::{
|
||||||
Button, Control, GridContainer, IPanelContainer, InputEvent, Label, LineEdit, OptionButton,
|
Button, Control, GridContainer, IPanelContainer, InputEvent, Label, LineEdit, OptionButton,
|
||||||
PanelContainer,
|
PanelContainer,
|
||||||
|
class_macros::private::virtuals::Xrvrs::Side,
|
||||||
control::{FocusBehaviorRecursive, SizeFlags},
|
control::{FocusBehaviorRecursive, SizeFlags},
|
||||||
},
|
},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
@ -171,7 +172,7 @@ impl IPanelContainer for SettingsPanel {
|
|||||||
label.set_h_size_flags(SizeFlags::EXPAND | SizeFlags::SHRINK_BEGIN);
|
label.set_h_size_flags(SizeFlags::EXPAND | SizeFlags::SHRINK_BEGIN);
|
||||||
grid.add_child(&label);
|
grid.add_child(&label);
|
||||||
|
|
||||||
if let Some(reset_btn) = &self.reset_button {
|
let mut reset_btn = if let Some(reset_btn) = &self.reset_button {
|
||||||
let mut button = reset_btn.instantiate_as::<Button>();
|
let mut button = reset_btn.instantiate_as::<Button>();
|
||||||
button.set_disabled(value == default_value);
|
button.set_disabled(value == default_value);
|
||||||
|
|
||||||
@ -182,11 +183,14 @@ impl IPanelContainer for SettingsPanel {
|
|||||||
});
|
});
|
||||||
|
|
||||||
grid.add_child(&button);
|
grid.add_child(&button);
|
||||||
self.reset_buttons.insert(*setting, button);
|
self.reset_buttons.insert(*setting, button.clone());
|
||||||
}
|
Some(button)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
|
||||||
if let Some(scene) = self.slider_scene.clone() {
|
if let Some(scene) = self.slider_scene.clone() {
|
||||||
let node = match value {
|
let mut node = match value {
|
||||||
SettingValue::SliderNumber(slider_value) => {
|
SettingValue::SliderNumber(slider_value) => {
|
||||||
let mut slider = scene.instantiate_as::<SliderContainer>();
|
let mut slider = scene.instantiate_as::<SliderContainer>();
|
||||||
|
|
||||||
@ -281,12 +285,25 @@ impl IPanelContainer for SettingsPanel {
|
|||||||
self.values.insert(*setting, node.clone());
|
self.values.insert(*setting, node.clone());
|
||||||
|
|
||||||
grid.add_child(&node);
|
grid.add_child(&node);
|
||||||
|
|
||||||
|
if let Some(reset_btn) = &mut reset_btn {
|
||||||
|
reset_btn.set_focus_neighbor(Side::RIGHT, &node.get_path());
|
||||||
|
node.set_focus_neighbor(Side::LEFT, &reset_btn.get_path());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn input(&mut self, event: Gd<InputEvent>) {
|
fn input(&mut self, event: Gd<InputEvent>) {
|
||||||
|
if event.is_action("ui_cancel") && self.base().is_visible() {
|
||||||
|
if let Some((_, mut button)) = self.keybind_button.take() {
|
||||||
|
button.set_pressed(false);
|
||||||
|
} else {
|
||||||
|
self.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if let Some((setting, mut button)) = self.keybind_button.clone()
|
if let Some((setting, mut button)) = self.keybind_button.clone()
|
||||||
&& let Some(keybind) = Keybind::from_event(event)
|
&& let Some(keybind) = Keybind::from_event(event)
|
||||||
{
|
{
|
||||||
@ -302,6 +319,9 @@ impl IPanelContainer for SettingsPanel {
|
|||||||
|
|
||||||
#[godot_api]
|
#[godot_api]
|
||||||
impl SettingsPanel {
|
impl SettingsPanel {
|
||||||
|
#[signal]
|
||||||
|
pub fn on_close();
|
||||||
|
|
||||||
pub fn change_value(&mut self, setting: Setting, new_value: SettingValue) {
|
pub fn change_value(&mut self, setting: Setting, new_value: SettingValue) {
|
||||||
if let Some(control) = self.values.get(&setting).cloned() {
|
if let Some(control) = self.values.get(&setting).cloned() {
|
||||||
match new_value.clone() {
|
match new_value.clone() {
|
||||||
@ -418,11 +438,18 @@ impl SettingsPanel {
|
|||||||
#[func]
|
#[func]
|
||||||
pub fn open(&mut self) {
|
pub fn open(&mut self) {
|
||||||
self.base_mut().set_visible(true);
|
self.base_mut().set_visible(true);
|
||||||
|
if let Some(focus) = &mut self.base_mut().find_next_valid_focus() {
|
||||||
|
focus.grab_focus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[func]
|
#[func]
|
||||||
pub fn close(&mut self) {
|
pub fn close(&mut self) {
|
||||||
|
if let Some((_, mut button)) = self.keybind_button.take() {
|
||||||
|
button.set_pressed(false);
|
||||||
|
}
|
||||||
self.base_mut().set_visible(false);
|
self.base_mut().set_visible(false);
|
||||||
|
self.signals().on_close().emit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user