Multiple navigation goal support, general control improvements
This commit is contained in:
parent
1d2332d9bd
commit
57d6826d5a
6 changed files with 83 additions and 7 deletions
|
|
@ -199,6 +199,12 @@ navpanel={
|
||||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":4,"pressure":0.0,"pressed":true,"script":null)
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":4,"pressure":0.0,"pressed":true,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
ui_back={
|
||||||
|
"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":4194308,"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)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
[physics]
|
[physics]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -292,6 +292,7 @@ grow_vertical = 2
|
||||||
theme = ExtResource("15_ir15t")
|
theme = ExtResource("15_ir15t")
|
||||||
|
|
||||||
[node name="Start" type="HFlowContainer" parent="UI/Control/Navpanel"]
|
[node name="Start" type="HFlowContainer" parent="UI/Control/Navpanel"]
|
||||||
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme_override_constants/v_separation = 0
|
theme_override_constants/v_separation = 0
|
||||||
|
|
||||||
|
|
@ -334,11 +335,11 @@ layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
text = "navigation"
|
text = "navigation"
|
||||||
|
|
||||||
[node name="Button2" type="Button" parent="UI/Control/Navpanel/Start"]
|
[node name="Quit" type="Button" parent="UI/Control/Navpanel/Start"]
|
||||||
custom_minimum_size = Vector2(256, 0)
|
custom_minimum_size = Vector2(256, 0)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
text = "test"
|
text = "quit"
|
||||||
|
|
||||||
[node name="Cheery" type="Label" parent="UI/Control/Navpanel/Start"]
|
[node name="Cheery" type="Label" parent="UI/Control/Navpanel/Start"]
|
||||||
custom_minimum_size = Vector2(256, 0)
|
custom_minimum_size = Vector2(256, 0)
|
||||||
|
|
@ -417,6 +418,14 @@ text = "PICK ROUTE"
|
||||||
label_settings = SubResource("LabelSettings_5newe")
|
label_settings = SubResource("LabelSettings_5newe")
|
||||||
horizontal_alignment = 1
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="Scroll" type="ScrollContainer" parent="UI/Control/Navpanel/NavigationRoutes"]
|
||||||
|
custom_minimum_size = Vector2(256, 512)
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Box" type="VBoxContainer" parent="UI/Control/Navpanel/NavigationRoutes/Scroll"]
|
||||||
|
custom_minimum_size = Vector2(256, 0)
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="NavpanelBack" type="Button" parent="UI/Control/Navpanel/NavigationRoutes"]
|
[node name="NavpanelBack" type="Button" parent="UI/Control/Navpanel/NavigationRoutes"]
|
||||||
custom_minimum_size = Vector2(256, 0)
|
custom_minimum_size = Vector2(256, 0)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
@ -554,6 +563,7 @@ color = Color(1, 1, 1, 0)
|
||||||
[connection signal="body_entered" from="Orbits/SpaceStation1/SpaceStation1/EnterHitbox" to="Orbits/SpaceStation1/SpaceStation1" method="_on_enter_hitbox_body_entered"]
|
[connection signal="body_entered" from="Orbits/SpaceStation1/SpaceStation1/EnterHitbox" to="Orbits/SpaceStation1/SpaceStation1" method="_on_enter_hitbox_body_entered"]
|
||||||
[connection signal="body_shape_entered" from="Player/Hitbox" to="Player" method="_on_hitbox_body_shape_entered"]
|
[connection signal="body_shape_entered" from="Player/Hitbox" to="Player" method="_on_hitbox_body_shape_entered"]
|
||||||
[connection signal="pressed" from="UI/Control/Navpanel/Start/Navigation" to="." method="_on_navigation_pressed"]
|
[connection signal="pressed" from="UI/Control/Navpanel/Start/Navigation" to="." method="_on_navigation_pressed"]
|
||||||
|
[connection signal="pressed" from="UI/Control/Navpanel/Start/Quit" to="." method="_on_quit_pressed"]
|
||||||
[connection signal="pressed" from="UI/Control/Navpanel/Navigation/NewRoute" to="." method="_on_new_route_pressed"]
|
[connection signal="pressed" from="UI/Control/Navpanel/Navigation/NewRoute" to="." method="_on_new_route_pressed"]
|
||||||
[connection signal="pressed" from="UI/Control/Navpanel/Navigation/CancelRoute" to="." method="_on_cancel_route_pressed"]
|
[connection signal="pressed" from="UI/Control/Navpanel/Navigation/CancelRoute" to="." method="_on_cancel_route_pressed"]
|
||||||
[connection signal="pressed" from="UI/Control/Navpanel/Navigation/NavpanelBack" to="." method="_on_navpanel_back_pressed"]
|
[connection signal="pressed" from="UI/Control/Navpanel/Navigation/NavpanelBack" to="." method="_on_navpanel_back_pressed"]
|
||||||
|
|
|
||||||
20
scenes/navigation_item.tscn
Normal file
20
scenes/navigation_item.tscn
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
[gd_scene load_steps=2 format=3 uid="uid://cky1bhmlnicwx"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://usvp2plv7qsx" path="res://scripts/navigation_item.gd" id="1_vuhx2"]
|
||||||
|
|
||||||
|
[node name="NavigationItem" type="VBoxContainer"]
|
||||||
|
script = ExtResource("1_vuhx2")
|
||||||
|
|
||||||
|
[node name="RichTextLabel" type="RichTextLabel" parent="."]
|
||||||
|
layout_mode = 2
|
||||||
|
bbcode_enabled = true
|
||||||
|
text = "[font size=24]space station 1[/font]
|
||||||
|
1000u away"
|
||||||
|
fit_content = true
|
||||||
|
scroll_active = false
|
||||||
|
|
||||||
|
[node name="Button" type="Button" parent="."]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "navigate"
|
||||||
|
|
||||||
|
[connection signal="pressed" from="Button" to="." method="_on_button_pressed"]
|
||||||
|
|
@ -73,6 +73,14 @@ func _ready() -> void:
|
||||||
$Player.global_position = spawn_points[global.stats.location].global_position
|
$Player.global_position = spawn_points[global.stats.location].global_position
|
||||||
$Player.rotation = spawn_points[global.stats.location].rotation
|
$Player.rotation = spawn_points[global.stats.location].rotation
|
||||||
|
|
||||||
|
for n in navigation_points:
|
||||||
|
var navigation_item = preload("res://scenes/navigation_item.tscn").instantiate()
|
||||||
|
|
||||||
|
navigation_item.goal = n
|
||||||
|
navigation_item.game = self
|
||||||
|
|
||||||
|
$UI/Control/Navpanel/NavigationRoutes/Scroll/Box.add_child(navigation_item)
|
||||||
|
|
||||||
var i = 0
|
var i = 0
|
||||||
while i < 1024 / 3:
|
while i < 1024 / 3:
|
||||||
var star = star_scene.instantiate()
|
var star = star_scene.instantiate()
|
||||||
|
|
@ -213,10 +221,13 @@ func _set_navpanel_menu(menu: String) -> void:
|
||||||
if n.get_name() == menu:
|
if n.get_name() == menu:
|
||||||
n.visible = true
|
n.visible = true
|
||||||
|
|
||||||
for o in n.get_children():
|
if menu == "NavigationRoutes":
|
||||||
if o.is_class("Button"):
|
n.get_node("Scroll/Box").get_children()[0].get_node("Button").grab_focus()
|
||||||
o.grab_focus()
|
else:
|
||||||
break
|
for o in n.get_children():
|
||||||
|
if o.is_class("Button"):
|
||||||
|
o.grab_focus()
|
||||||
|
break
|
||||||
else:
|
else:
|
||||||
n.visible = false
|
n.visible = false
|
||||||
|
|
||||||
|
|
@ -234,6 +245,16 @@ func _input(event: InputEvent) -> void:
|
||||||
$UI/Control/Navpanel.visible = true
|
$UI/Control/Navpanel.visible = true
|
||||||
|
|
||||||
_set_navpanel_menu("Start")
|
_set_navpanel_menu("Start")
|
||||||
|
elif event.is_action_pressed("ui_back"):
|
||||||
|
if $UI/Control/Navpanel.visible:
|
||||||
|
$UiSelect.play()
|
||||||
|
|
||||||
|
if $UI/Control/Navpanel/NavigationRoutes.visible:
|
||||||
|
_set_navpanel_menu("Navigation")
|
||||||
|
elif $UI/Control/Navpanel/Start.visible:
|
||||||
|
$UI/Control/Navpanel.visible = false
|
||||||
|
else:
|
||||||
|
_set_navpanel_menu("Start")
|
||||||
|
|
||||||
|
|
||||||
func _on_tree_exiting() -> void:
|
func _on_tree_exiting() -> void:
|
||||||
|
|
@ -253,9 +274,20 @@ func _on_navpanel_back_pressed() -> void:
|
||||||
|
|
||||||
func _on_new_route_pressed() -> void:
|
func _on_new_route_pressed() -> void:
|
||||||
$UiSelect.play()
|
$UiSelect.play()
|
||||||
global.stats.navigation_goal = navigation_points[0]
|
_set_navpanel_menu("NavigationRoutes")
|
||||||
|
|
||||||
|
|
||||||
func _on_cancel_route_pressed() -> void:
|
func _on_cancel_route_pressed() -> void:
|
||||||
$UiSelect.play()
|
$UiSelect.play()
|
||||||
global.stats.navigation_goal = null
|
global.stats.navigation_goal = null
|
||||||
|
|
||||||
|
|
||||||
|
func _on_quit_pressed() -> void:
|
||||||
|
$UiSelect.play()
|
||||||
|
$UI/Control/Navpanel.visible = false
|
||||||
|
|
||||||
|
|
||||||
|
func _navigation_item_pressed(goal) -> void:
|
||||||
|
global.stats.navigation_goal = goal
|
||||||
|
$UiSelect.play()
|
||||||
|
_set_navpanel_menu("Navigation")
|
||||||
|
|
|
||||||
7
scripts/navigation_item.gd
Normal file
7
scripts/navigation_item.gd
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
extends VBoxContainer
|
||||||
|
|
||||||
|
var goal = null
|
||||||
|
var game = null
|
||||||
|
|
||||||
|
func _on_button_pressed() -> void:
|
||||||
|
game._navigation_item_pressed(goal)
|
||||||
1
scripts/navigation_item.gd.uid
Normal file
1
scripts/navigation_item.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://usvp2plv7qsx
|
||||||
Loading…
Reference in a new issue