khanat-client/scenes/interfaces/options/options.gd

77 lines
2.5 KiB
GDScript3
Raw Normal View History

extends Control
signal quit_pressed
signal mute_pressed
#signal musicplayer_pressed
func _ready():
#get_node("option_settings").connect("mute_pressed", self, "_on_control_mute_pressed")
MusicManager.connect("mute_pressed", self, "_on_control_mute_pressed")
MusicManager.connect("musicplayer_pressed", self, "_on_control_musicplayer_pressed")
MusicManager.connect_ext( "mute_pressed", self )
$option_settings.connect( "mute_pressed", self, "_on_control_mute_pressed" )
$option_settings.connect_ext( "mute_pressed", self )
update_sound_button()
func _on_quit_button_pressed():
Config.msg_debug("_on_quit_button_pressed")
emit_signal( "quit_pressed" )
func _on_control_musicplayer_pressed():
Config.msg_debug("Option -> Receibed signal")
#emit_signal ( "musicplayer_pressed" )
func _on_language_button_pressed():
$option_language/window_dialog.show()
func _on_news_button_pressed():
#$option_news/accept_dialog.show()
$option_news/window_dialog.show()
func _on_help_button_pressed():
$option_info/window_dialog.show()
func _on_settings_button_pressed():
$option_settings/window_dialog.show()
func update_sound_button():
Config.msg_debug("<Option> update_sound_button")
if Config.mute:
$options_reduce/h_box_container/sound_button.texture_normal = load ( "res://assets/interfaces/Login-Khanat-sound-muted-button.png")
$options_reduce/h_box_container/sound_button.texture_hover = load ( "res://assets/interfaces/Login-Khanat-sound-muted-button-hover.png")
#MusicManager.set_mute_on()
else:
$options_reduce/h_box_container/sound_button.texture_normal = load ( "res://assets/interfaces/Login-Khanat-sound-button.png")
$options_reduce/h_box_container/sound_button.texture_hover = load ( "res://assets/interfaces/Login-Khanat-sound-button-hover.png")
#MusicManager.set_mute_off()
#$option_settings/window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND/h_box_container_2/mute.pressed = Config.mute
func update_musicplayer():
Config.msg_debug("update_musicplayer")
$option_settings/window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND/h_box_container_5/musicplayer.pressed = Config.get_playermusic()
if Config.get_playermusic():
MusicManager.set_playermusic_on()
else:
MusicManager.set_playermusic_off()
func _on_sound_button_pressed():
Config.msg_debug("Option mute")
MusicManager.set_sound_mute(not Config.mute)
emit_signal( "mute_pressed" )
func _on_control_mute_pressed():
Config.msg_debug("<Option> Received Signal mute")
update_sound_button()