ai and game menu
This commit was merged in pull request #23.
This commit is contained in:
@@ -28,6 +28,7 @@ func _ready() -> void:
|
||||
slider.max_value = MAX_VOLUME
|
||||
slider.step = 0.01
|
||||
slider.value_changed.connect(_on_slider_value_changed)
|
||||
AudioManager.volume_changed.connect(_on_audio_manager_volume_changed)
|
||||
refresh()
|
||||
|
||||
func refresh() -> void:
|
||||
@@ -65,3 +66,7 @@ func _set_bus_volume(linear_value: float) -> void:
|
||||
|
||||
func _on_slider_value_changed(value: float) -> void:
|
||||
_set_bus_volume(value)
|
||||
|
||||
func _on_audio_manager_volume_changed(changed_bus_name: StringName, volume: float) -> void:
|
||||
if changed_bus_name == bus_name:
|
||||
slider.set_value_no_signal(volume)
|
||||
|
||||
@@ -5,19 +5,27 @@ extends Control
|
||||
|
||||
func _ready() -> void:
|
||||
for tab: GameMenuTab in tabs:
|
||||
tab.on_tab_selected.connect(_on_tab_pressed)
|
||||
tab.on_tab_selected.connect(on_tab_pressed)
|
||||
|
||||
tabs[0].select_without_animation()
|
||||
pages[0].show()
|
||||
on_tab_pressed(0, true)
|
||||
|
||||
func _on_tab_pressed(index: int):
|
||||
func on_tab_pressed(index: int, disable_animation: bool = false) -> void:
|
||||
for page in pages:
|
||||
page.hide()
|
||||
|
||||
for tab in tabs:
|
||||
if tab.index == index:
|
||||
tab.select()
|
||||
if disable_animation:
|
||||
tab.select_without_animation()
|
||||
else:
|
||||
tab.select()
|
||||
else:
|
||||
tab.deselect()
|
||||
if disable_animation:
|
||||
tab.deselect_without_animation()
|
||||
else:
|
||||
tab.deselect()
|
||||
|
||||
pages[index].show()
|
||||
|
||||
func _on_resume_button_on_button_pressed() -> void:
|
||||
hide()
|
||||
|
||||
@@ -20,6 +20,14 @@ grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
script = ExtResource("1_57vaj")
|
||||
|
||||
[node name="Panel" type="Panel" parent="." unique_id=992567199]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Tabs" type="HBoxContainer" parent="." unique_id=1745270897]
|
||||
layout_mode = 1
|
||||
offset_left = 1138.0
|
||||
@@ -75,3 +83,8 @@ layout_mode = 1
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
|
||||
[connection signal="on_button_pressed" from="Pages/Page3/OptionMenu/VBoxContainer/ResumeButton" to="." method="_on_resume_button_on_button_pressed"]
|
||||
|
||||
[editable path="Pages/Page3"]
|
||||
[editable path="Pages/Page3/OptionMenu"]
|
||||
|
||||
@@ -38,6 +38,10 @@ func deselect():
|
||||
func select_without_animation():
|
||||
is_selected = true
|
||||
texture.position.y = -bob_height
|
||||
|
||||
func deselect_without_animation():
|
||||
is_selected = false
|
||||
texture.position.y = 0
|
||||
|
||||
func _move_up():
|
||||
if hover_tween: hover_tween.kill()
|
||||
|
||||
Reference in New Issue
Block a user