godot-vn/menus/options_menu.gd

62 lines
1.7 KiB
GDScript

extends Control
var from_scene_name
# game opts
onready var read_speed_slider = get_node("split/opts_panel/panels/game_opts/read_speed_slider")
# display opts
onready var window_size_menu = get_node("split/opts_panel/panels/display_opts/window_size_menu")
onready var window_mode_menu = get_node("split/opts_panel/panels/display_opts/window_mode_menu")
# audio opts
onready var master_slider = get_node("split/opts_panel/panels/sound_opts/master_vol_slider")
onready var music_slider = get_node("split/opts_panel/panels/sound_opts/music_vol_slider")
onready var sfx_slider = get_node("split/opts_panel/panels/sound_opts/sfx_vol_slider")
onready var back_btn = get_node("back_btn")
func _ready():
# game opt connections
read_speed_slider.connect("changed", self, "_on_read_speed_changed")
# display opt connections
var size_popup = window_size_menu.get_popup()
size_popup.connect("id_pressed", self, "_on_window_size_menu_id_pressed")
var mode_popup = window_mode_menu.get_popup()
mode_popup.connect("id_pressed", self, "_on_window_mode_menu_id_pressed")
# music opt sliders
master_slider.value = Game.master_vol
music_slider.value = Game.music_vol
sfx_slider.value = Game.sfx_vol
master_slider.connect("changed", self, "_on_master_vol_changed")
music_slider.connect("changed", self, "_on_music_vol_changed")
sfx_slider.connect("changed", self, "_on_sfx_vol_changed")
# back to menu
back_btn.connect("pressed", self, "_on_back_pressed")
func _on_read_speed_changed(v):
pass
func _on_window_size_menu_id_pressed(id):
pass
func _on_window_mode_menu_id_pressed(id):
pass
func _on_master_vol_changed(v):
pass
func _on_music_vol_changed(v):
pass
func _on_sfx_vol_changed(v):
pass
func _on_back_pressed():
Game.switch_scene_to(from_scene_name, false)