immersive-home/app/content/ui/menu/settings/menus/features_menu.gd
2024-05-06 12:42:45 +02:00

40 lines
900 B
GDScript

extends Node3D
@onready var voice_assist = $VoiceAssist
func _ready():
var settings_store = Store.settings.state
if Store.settings.is_loaded() == false:
await Store.settings.on_loaded
var button_label = R.computed(func(_arg):
return "mic_off" if settings_store.voice_assistant == false else "mic"
)
voice_assist.on_button_down.connect(func():
if Store.settings.is_loaded() == false:
await Store.settings.on_loaded
OS.request_permissions()
voice_assist.label="mic"
settings_store.voice_assistant=true
Store.settings.save_local()
)
voice_assist.on_button_up.connect(func():
if Store.settings.is_loaded() == false:
await Store.settings.on_loaded
voice_assist.label="mic_off"
settings_store.voice_assistant=false
Store.settings.save_local()
)
R.bind(voice_assist, "label", button_label)
R.bind(voice_assist, "active", settings_store, "voice_assistant")