75 lines
2.0 KiB
GDScript
75 lines
2.0 KiB
GDScript
class_name MainMenuUIHandler extends Control
|
|
|
|
static var vsyncSetting: int = 1
|
|
|
|
@export var animator: AnimationPlayer
|
|
|
|
func _on_settings_pressed() -> void:
|
|
animator.play_backwards("ShowMain")
|
|
await animator.animation_finished
|
|
animator.play("ShowSettings")
|
|
|
|
func _on_credits_pressed() -> void:
|
|
animator.play_backwards("ShowMain")
|
|
await animator.animation_finished
|
|
animator.play("ShowCredits")
|
|
|
|
func _on_how_to_play_pressed() -> void:
|
|
animator.play_backwards("ShowMain")
|
|
await animator.animation_finished
|
|
animator.play("ShowHowTo")
|
|
|
|
func _on_back_pressed() -> void:
|
|
animator.play_backwards("ShowSettings")
|
|
await animator.animation_finished
|
|
animator.play("ShowMain")
|
|
|
|
func _on_credits_back_pressed() -> void:
|
|
animator.play_backwards("ShowCredits")
|
|
await animator.animation_finished
|
|
animator.play("ShowMain")
|
|
|
|
func _on__HowTo_back_pressed() -> void:
|
|
animator.play_backwards("ShowHowTo")
|
|
await animator.animation_finished
|
|
animator.play("ShowMain")
|
|
|
|
|
|
func _on_master_slider_value_changed(value: float) -> void:
|
|
AudioServer.set_bus_volume_db(0, linear_to_db(value))
|
|
|
|
func _on_music_slider_value_changed(value: float) -> void:
|
|
AudioServer.set_bus_volume_db(1, linear_to_db(value))
|
|
|
|
func _on_effects_slider_value_changed(value: float) -> void:
|
|
AudioServer.set_bus_volume_db(2, linear_to_db(value))
|
|
|
|
func _on_ambiance_slider_value_changed(value: float) -> void:
|
|
AudioServer.set_bus_volume_db(3, linear_to_db(value))
|
|
|
|
|
|
func _on_anti_aliasing_item_selected(index: int) -> void:
|
|
get_window().msaa_3d = index as Viewport.MSAA
|
|
|
|
func _on_v_sync_mode_item_selected(index: int) -> void:
|
|
vsyncSetting = index
|
|
DisplayServer.window_set_vsync_mode(index as DisplayServer.VSyncMode)
|
|
|
|
func _on_fps_cap_item_selected(index: int) -> void:
|
|
match index:
|
|
0:
|
|
Engine.max_fps = 0
|
|
1:
|
|
Engine.max_fps = 30
|
|
2:
|
|
Engine.max_fps = 60
|
|
3:
|
|
Engine.max_fps = 90
|
|
4:
|
|
Engine.max_fps = 120
|
|
5:
|
|
Engine.max_fps = 144
|
|
|
|
func _on_check_box_toggled(toggled_on: bool) -> void:
|
|
FPSCounter.instance.visible = toggled_on
|