Adds the delete account feature to the teacher settings.
This commit is contained in:
@@ -0,0 +1,8 @@
|
|||||||
|
[gd_resource type="StyleBoxFlat" format=3 uid="uid://blkufkitnlfqi"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
bg_color = Color(0.658824, 0, 0, 1)
|
||||||
|
border_width_left = 5
|
||||||
|
border_width_top = 5
|
||||||
|
border_width_right = 5
|
||||||
|
border_width_bottom = 5
|
||||||
@@ -248,4 +248,6 @@ Locked;Verrouillé;Bloqueado
|
|||||||
Unlocked;Déverrouillé;Desbloqueado
|
Unlocked;Déverrouillé;Desbloqueado
|
||||||
Completed;Terminé;Completado
|
Completed;Terminé;Completado
|
||||||
CHECKING_DATA;Vérification des données...;Comprobando datos...
|
CHECKING_DATA;Vérification des données...;Comprobando datos...
|
||||||
TEACHER_SETTINGS_HELP;"Pour accéder aux paramètres, veuillez appuyer sur le plus et la barre verticale, puis maintenez le bouton ""Paramètres"" pendant 5 secondes";Para acceder a los ajustes, pulse el signo más y la barra vertical y, a continuación, mantenga pulsado el botón «Configuración» durante 5 segundos
|
TEACHER_SETTINGS_HELP;"Pour accéder aux paramètres, veuillez appuyer sur le plus et la barre verticale, puis maintenez le bouton ""Paramètres"" pendant 5 secondes";Para acceder a los ajustes, pulse el signo más y la barra vertical y, a continuación, mantenga pulsado el botón «Configuración» durante 5 segundos
|
||||||
|
DELETE_ACCOUNT;Supprimer le compte;Eliminar cuenta
|
||||||
|
DELETE_ACCOUNT_POPUP;Voulez-vous vraiment supprimer votre compte ? Cette action est irréversible !;¿De verdad quieres eliminar tu cuenta? ¡Esta acción es irreversible!
|
||||||
|
Binary file not shown.
Binary file not shown.
@@ -1,22 +1,22 @@
|
|||||||
[gd_resource type="AudioBusLayout" format=3 uid="uid://crtt36bkguxm5"]
|
[gd_resource type="AudioBusLayout" format=3 uid="uid://crtt36bkguxm5"]
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
bus/0/volume_db = 0.0672607
|
bus/0/volume_db = -0.030508
|
||||||
bus/1/name = &"Music"
|
bus/1/name = &"Music"
|
||||||
bus/1/solo = false
|
bus/1/solo = false
|
||||||
bus/1/mute = false
|
bus/1/mute = false
|
||||||
bus/1/bypass_fx = false
|
bus/1/bypass_fx = false
|
||||||
bus/1/volume_db = -8.99984
|
bus/1/volume_db = -0.030508
|
||||||
bus/1/send = &"Master"
|
bus/1/send = &"Master"
|
||||||
bus/2/name = &"Voice"
|
bus/2/name = &"Voice"
|
||||||
bus/2/solo = false
|
bus/2/solo = false
|
||||||
bus/2/mute = false
|
bus/2/mute = false
|
||||||
bus/2/bypass_fx = false
|
bus/2/bypass_fx = false
|
||||||
bus/2/volume_db = -9.0
|
bus/2/volume_db = -0.0327301
|
||||||
bus/2/send = &"Master"
|
bus/2/send = &"Master"
|
||||||
bus/3/name = &"Effects"
|
bus/3/name = &"Effects"
|
||||||
bus/3/solo = false
|
bus/3/solo = false
|
||||||
bus/3/mute = false
|
bus/3/mute = false
|
||||||
bus/3/bypass_fx = false
|
bus/3/bypass_fx = false
|
||||||
bus/3/volume_db = -13.2455
|
bus/3/volume_db = -0.030508
|
||||||
bus/3/send = &"Master"
|
bus/3/send = &"Master"
|
||||||
|
|||||||
@@ -16,6 +16,30 @@ const supported_locales: Array[String] = [
|
|||||||
@export var device_id : int
|
@export var device_id : int
|
||||||
@export var language_versions: Dictionary # locale : datetime
|
@export var language_versions: Dictionary # locale : datetime
|
||||||
|
|
||||||
|
@export var master_volume: = 0.0 :
|
||||||
|
set(volume):
|
||||||
|
master_volume = volume
|
||||||
|
var ind: = AudioServer.get_bus_index("Master")
|
||||||
|
AudioServer.set_bus_volume_db(ind, volume)
|
||||||
|
|
||||||
|
@export var music_volume: = 0.0 :
|
||||||
|
set(volume):
|
||||||
|
music_volume = volume
|
||||||
|
var ind: = AudioServer.get_bus_index("Music")
|
||||||
|
AudioServer.set_bus_volume_db(ind, volume)
|
||||||
|
|
||||||
|
@export var voice_volume: = 0.0 :
|
||||||
|
set(volume):
|
||||||
|
voice_volume = volume
|
||||||
|
var ind: = AudioServer.get_bus_index("Voice")
|
||||||
|
AudioServer.set_bus_volume_db(ind, volume)
|
||||||
|
|
||||||
|
@export var effects_volume: = 0.0 :
|
||||||
|
set(volume):
|
||||||
|
effects_volume = volume
|
||||||
|
var ind: = AudioServer.get_bus_index("Effects")
|
||||||
|
AudioServer.set_bus_volume_db(ind, volume)
|
||||||
|
|
||||||
|
|
||||||
func init_OS_language() -> void:
|
func init_OS_language() -> void:
|
||||||
# Gets the OS language and checks if it is supported
|
# Gets the OS language and checks if it is supported
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
[gd_resource type="Theme" load_steps=56 format=3 uid="uid://dqjvrt5nrtwn1"]
|
[gd_resource type="Theme" load_steps=58 format=3 uid="uid://dqjvrt5nrtwn1"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://2pldpmhcg6v4" path="res://assets/theme/previous.svg" id="1_mdn6k"]
|
[ext_resource type="Texture2D" uid="uid://2pldpmhcg6v4" path="res://assets/theme/previous.svg" id="1_mdn6k"]
|
||||||
[ext_resource type="FontFile" uid="uid://c7hsjkvr1pbud" path="res://assets/fonts/ScriptEcoleNormal.otf" id="1_shpmh"]
|
[ext_resource type="FontFile" uid="uid://c7hsjkvr1pbud" path="res://assets/fonts/ScriptEcoleNormal.otf" id="1_shpmh"]
|
||||||
|
[ext_resource type="StyleBox" uid="uid://blkufkitnlfqi" path="res://danger_button_stylebox.tres" id="2_0ex6x"]
|
||||||
[ext_resource type="Texture2D" uid="uid://c156h72ld8d4s" path="res://assets/theme/next.svg" id="2_hbp6q"]
|
[ext_resource type="Texture2D" uid="uid://c156h72ld8d4s" path="res://assets/theme/next.svg" id="2_hbp6q"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cacy10k45kq6u" path="res://assets/theme/up.svg" id="3_1nwm4"]
|
[ext_resource type="Texture2D" uid="uid://cacy10k45kq6u" path="res://assets/theme/up.svg" id="3_1nwm4"]
|
||||||
[ext_resource type="Texture2D" uid="uid://b7fqrj816kdjg" path="res://assets/theme/refresh.svg" id="4_ymfot"]
|
[ext_resource type="Texture2D" uid="uid://b7fqrj816kdjg" path="res://assets/theme/refresh.svg" id="4_ymfot"]
|
||||||
@@ -38,10 +39,10 @@ border_color = Color(0.854902, 0.85098, 0.862745, 1)
|
|||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_qwwu7"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_qwwu7"]
|
||||||
bg_color = Color(0.117647, 0.160784, 0.356863, 1)
|
bg_color = Color(0.117647, 0.160784, 0.356863, 1)
|
||||||
border_width_left = 10
|
border_width_left = 7
|
||||||
border_width_top = 10
|
border_width_top = 7
|
||||||
border_width_right = 10
|
border_width_right = 7
|
||||||
border_width_bottom = 10
|
border_width_bottom = 7
|
||||||
border_color = Color(0.854902, 0.85098, 0.862745, 1)
|
border_color = Color(0.854902, 0.85098, 0.862745, 1)
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_whtl8"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_whtl8"]
|
||||||
@@ -177,6 +178,13 @@ corner_radius_bottom_right = 3
|
|||||||
corner_radius_bottom_left = 3
|
corner_radius_bottom_left = 3
|
||||||
corner_detail = 5
|
corner_detail = 5
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_idrao"]
|
||||||
|
bg_color = Color(0.658824, 0, 0, 1)
|
||||||
|
border_width_left = 7
|
||||||
|
border_width_top = 7
|
||||||
|
border_width_right = 7
|
||||||
|
border_width_bottom = 7
|
||||||
|
|
||||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_cpwf5"]
|
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_cpwf5"]
|
||||||
|
|
||||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_g4sj8"]
|
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_g4sj8"]
|
||||||
@@ -422,6 +430,11 @@ Combobox/styles/normal = SubResource("StyleBoxFlat_3qgjx")
|
|||||||
Combobox/styles/normal_mirrored = SubResource("StyleBoxFlat_cul2e")
|
Combobox/styles/normal_mirrored = SubResource("StyleBoxFlat_cul2e")
|
||||||
Combobox/styles/pressed = SubResource("StyleBoxFlat_c05kv")
|
Combobox/styles/pressed = SubResource("StyleBoxFlat_c05kv")
|
||||||
Combobox/styles/pressed_mirrored = SubResource("StyleBoxFlat_u3yhj")
|
Combobox/styles/pressed_mirrored = SubResource("StyleBoxFlat_u3yhj")
|
||||||
|
DangerButton/base_type = &"Button"
|
||||||
|
DangerButton/fonts/font = ExtResource("1_shpmh")
|
||||||
|
DangerButton/styles/hover = ExtResource("2_0ex6x")
|
||||||
|
DangerButton/styles/normal = ExtResource("2_0ex6x")
|
||||||
|
DangerButton/styles/pressed = SubResource("StyleBoxFlat_idrao")
|
||||||
FileDialog/icons/back_folder = ExtResource("1_mdn6k")
|
FileDialog/icons/back_folder = ExtResource("1_mdn6k")
|
||||||
FileDialog/icons/forward_folder = ExtResource("2_hbp6q")
|
FileDialog/icons/forward_folder = ExtResource("2_hbp6q")
|
||||||
FileDialog/icons/parent_folder = ExtResource("3_1nwm4")
|
FileDialog/icons/parent_folder = ExtResource("3_1nwm4")
|
||||||
|
|||||||
@@ -22,30 +22,6 @@ var password : String
|
|||||||
@export var token: String
|
@export var token: String
|
||||||
@export var last_modified: String
|
@export var last_modified: String
|
||||||
|
|
||||||
@export var master_volume: = 0.0 :
|
|
||||||
set(volume):
|
|
||||||
master_volume = volume
|
|
||||||
var ind: = AudioServer.get_bus_index("Master")
|
|
||||||
AudioServer.set_bus_volume_db(ind, volume)
|
|
||||||
|
|
||||||
@export var music_volume: = 0.0 :
|
|
||||||
set(volume):
|
|
||||||
music_volume = volume
|
|
||||||
var ind: = AudioServer.get_bus_index("Music")
|
|
||||||
AudioServer.set_bus_volume_db(ind, volume)
|
|
||||||
|
|
||||||
@export var voice_volume: = 0.0 :
|
|
||||||
set(volume):
|
|
||||||
voice_volume = volume
|
|
||||||
var ind: = AudioServer.get_bus_index("Voice")
|
|
||||||
AudioServer.set_bus_volume_db(ind, volume)
|
|
||||||
|
|
||||||
@export var effects_volume: = 0.0 :
|
|
||||||
set(volume):
|
|
||||||
effects_volume = volume
|
|
||||||
var ind: = AudioServer.get_bus_index("Effects")
|
|
||||||
AudioServer.set_bus_volume_db(ind, volume)
|
|
||||||
|
|
||||||
func update_from_dict(dict: Dictionary) -> void:
|
func update_from_dict(dict: Dictionary) -> void:
|
||||||
account_type = dict.account_type
|
account_type = dict.account_type
|
||||||
education_method = dict.education_method
|
education_method = dict.education_method
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
extends Resource
|
|
||||||
class_name UserSettings
|
|
||||||
|
|
||||||
@export var version: = 1.0
|
|
||||||
|
|
||||||
@export var master_volume: = 0.0 :
|
|
||||||
set(volume):
|
|
||||||
master_volume = volume
|
|
||||||
var ind: = AudioServer.get_bus_index("Master")
|
|
||||||
AudioServer.set_bus_volume_db(ind, volume)
|
|
||||||
|
|
||||||
@export var music_volume: = 0.0 :
|
|
||||||
set(volume):
|
|
||||||
music_volume = volume
|
|
||||||
var ind: = AudioServer.get_bus_index("Music")
|
|
||||||
AudioServer.set_bus_volume_db(ind, volume)
|
|
||||||
|
|
||||||
@export var voice_volume: = 0.0 :
|
|
||||||
set(volume):
|
|
||||||
voice_volume = volume
|
|
||||||
var ind: = AudioServer.get_bus_index("Voice")
|
|
||||||
AudioServer.set_bus_volume_db(ind, volume)
|
|
||||||
|
|
||||||
@export var effects_volume: = 0.0 :
|
|
||||||
set(volume):
|
|
||||||
effects_volume = volume
|
|
||||||
var ind: = AudioServer.get_bus_index("Effects")
|
|
||||||
AudioServer.set_bus_volume_db(ind, volume)
|
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
extends TextureButton
|
||||||
|
|
||||||
|
@onready var volume_menu: Control = %VolumeMenu
|
||||||
|
@onready var volume_panel: Panel = %VolumePanel
|
||||||
|
@onready var master_volume_slider: HSlider = %MasterVolumeSlider
|
||||||
|
@onready var music_volume_slider: HSlider = %MusicVolumeSlider
|
||||||
|
@onready var voice_volume_slider: HSlider = %VoiceVolumeSlider
|
||||||
|
@onready var effects_volume_slider: HSlider = %EffectsVolumeSlider
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
set_master_volume_slider(UserDataManager.get_master_volume())
|
||||||
|
set_music_volume_slider(UserDataManager.get_music_volume())
|
||||||
|
set_voice_volume_slider(UserDataManager.get_voice_volume())
|
||||||
|
set_effects_volume_slider(UserDataManager.get_effects_volume())
|
||||||
|
|
||||||
|
|
||||||
|
func set_master_volume_slider(volume: float) -> void:
|
||||||
|
master_volume_slider.value = volume
|
||||||
|
|
||||||
|
|
||||||
|
func set_music_volume_slider(volume: float) -> void:
|
||||||
|
music_volume_slider.value = volume
|
||||||
|
|
||||||
|
|
||||||
|
func set_voice_volume_slider(volume: float) -> void:
|
||||||
|
voice_volume_slider.value = volume
|
||||||
|
|
||||||
|
|
||||||
|
func set_effects_volume_slider(volume: float) -> void:
|
||||||
|
effects_volume_slider.value = volume
|
||||||
|
|
||||||
|
#region Connections
|
||||||
|
|
||||||
|
func _on_volume_menu_gui_input(event: InputEvent) -> void:
|
||||||
|
if event.is_action_pressed("left_click"):
|
||||||
|
volume_menu.visible = not volume_menu.visible
|
||||||
|
|
||||||
|
|
||||||
|
func _on_volume_button_pressed() -> void:
|
||||||
|
volume_panel.global_position = Vector2(self.global_position.x + 300, self.global_position.y)
|
||||||
|
volume_menu.visible = not volume_menu.visible
|
||||||
|
|
||||||
|
|
||||||
|
func _on_master_volume_slider_value_changed(volume: float) -> void:
|
||||||
|
UserDataManager.set_master_volume(volume)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_music_volume_slider_value_changed(volume: float) -> void:
|
||||||
|
UserDataManager.set_music_volume(volume)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_voice_volume_slider_value_changed(volume: float) -> void:
|
||||||
|
UserDataManager.set_voice_volume(volume)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_effects_volume_slider_value_changed(volume: float) -> void:
|
||||||
|
UserDataManager.set_effects_volume(volume)
|
||||||
|
|
||||||
|
#endregion
|
||||||
@@ -0,0 +1,163 @@
|
|||||||
|
[gd_scene load_steps=6 format=3 uid="uid://bo7rpk4gebh24"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://dkvf2b6b1keqf" path="res://assets/minigames/minigame_ui/graphic/volume_up.png" id="1_r06v3"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://blgoagm5j5jh2" path="res://assets/minigames/minigame_ui/graphic/volume_down.png" id="2_uxdkc"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://cuxo6l6hmin1y" path="res://assets/minigames/minigame_ui/graphic/volume_disabled.png" id="3_u3u18"]
|
||||||
|
[ext_resource type="Script" path="res://sources/menus/settings/sound_settings_button.gd" id="4_crs35"]
|
||||||
|
[ext_resource type="Theme" uid="uid://dqjvrt5nrtwn1" path="res://resources/themes/kalulu_theme.tres" id="4_y2ecw"]
|
||||||
|
|
||||||
|
[node name="VolumeButton" type="TextureButton"]
|
||||||
|
texture_normal = ExtResource("1_r06v3")
|
||||||
|
texture_pressed = ExtResource("2_uxdkc")
|
||||||
|
texture_disabled = ExtResource("3_u3u18")
|
||||||
|
stretch_mode = 4
|
||||||
|
script = ExtResource("4_crs35")
|
||||||
|
|
||||||
|
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||||
|
|
||||||
|
[node name="VolumeMenu" type="Control" parent="CanvasLayer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
visible = false
|
||||||
|
z_index = 10
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="VolumePanel" type="Panel" parent="CanvasLayer/VolumeMenu"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
offset_right = 481.0
|
||||||
|
offset_bottom = 456.0
|
||||||
|
theme = ExtResource("4_y2ecw")
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/VolumeMenu/VolumePanel"]
|
||||||
|
layout_mode = 2
|
||||||
|
offset_right = 481.0
|
||||||
|
offset_bottom = 456.0
|
||||||
|
|
||||||
|
[node name="MasterVolumeMarginContainer" type="MarginContainer" parent="CanvasLayer/VolumeMenu/VolumePanel/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/margin_left = 25
|
||||||
|
theme_override_constants/margin_top = 25
|
||||||
|
theme_override_constants/margin_right = 25
|
||||||
|
theme_override_constants/margin_bottom = 25
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/VolumeMenu/VolumePanel/VBoxContainer/MasterVolumeMarginContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="HBoxContainer" type="HBoxContainer" parent="CanvasLayer/VolumeMenu/VolumePanel/VBoxContainer/MasterVolumeMarginContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="CanvasLayer/VolumeMenu/VolumePanel/VBoxContainer/MasterVolumeMarginContainer/VBoxContainer/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
text = "Master"
|
||||||
|
|
||||||
|
[node name="MarginContainer" type="MarginContainer" parent="CanvasLayer/VolumeMenu/VolumePanel/VBoxContainer/MasterVolumeMarginContainer/VBoxContainer/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/margin_left = 35
|
||||||
|
|
||||||
|
[node name="MasterVolumeSlider" type="HSlider" parent="CanvasLayer/VolumeMenu/VolumePanel/VBoxContainer/MasterVolumeMarginContainer/VBoxContainer/HBoxContainer/MarginContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
custom_minimum_size = Vector2(250, 0)
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 4
|
||||||
|
|
||||||
|
[node name="MusicVolumeMarginContainer" type="MarginContainer" parent="CanvasLayer/VolumeMenu/VolumePanel/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/margin_left = 25
|
||||||
|
theme_override_constants/margin_top = 25
|
||||||
|
theme_override_constants/margin_right = 25
|
||||||
|
theme_override_constants/margin_bottom = 25
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/VolumeMenu/VolumePanel/VBoxContainer/MusicVolumeMarginContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="HBoxContainer" type="HBoxContainer" parent="CanvasLayer/VolumeMenu/VolumePanel/VBoxContainer/MusicVolumeMarginContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="CanvasLayer/VolumeMenu/VolumePanel/VBoxContainer/MusicVolumeMarginContainer/VBoxContainer/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
text = "Music"
|
||||||
|
|
||||||
|
[node name="MarginContainer" type="MarginContainer" parent="CanvasLayer/VolumeMenu/VolumePanel/VBoxContainer/MusicVolumeMarginContainer/VBoxContainer/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/margin_left = 35
|
||||||
|
|
||||||
|
[node name="MusicVolumeSlider" type="HSlider" parent="CanvasLayer/VolumeMenu/VolumePanel/VBoxContainer/MusicVolumeMarginContainer/VBoxContainer/HBoxContainer/MarginContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
custom_minimum_size = Vector2(250, 0)
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 4
|
||||||
|
|
||||||
|
[node name="VoiceVolumeMarginContainer" type="MarginContainer" parent="CanvasLayer/VolumeMenu/VolumePanel/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/margin_left = 25
|
||||||
|
theme_override_constants/margin_top = 25
|
||||||
|
theme_override_constants/margin_right = 25
|
||||||
|
theme_override_constants/margin_bottom = 25
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/VolumeMenu/VolumePanel/VBoxContainer/VoiceVolumeMarginContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="HBoxContainer" type="HBoxContainer" parent="CanvasLayer/VolumeMenu/VolumePanel/VBoxContainer/VoiceVolumeMarginContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="CanvasLayer/VolumeMenu/VolumePanel/VBoxContainer/VoiceVolumeMarginContainer/VBoxContainer/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
text = "Voice"
|
||||||
|
|
||||||
|
[node name="MarginContainer" type="MarginContainer" parent="CanvasLayer/VolumeMenu/VolumePanel/VBoxContainer/VoiceVolumeMarginContainer/VBoxContainer/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/margin_left = 35
|
||||||
|
|
||||||
|
[node name="VoiceVolumeSlider" type="HSlider" parent="CanvasLayer/VolumeMenu/VolumePanel/VBoxContainer/VoiceVolumeMarginContainer/VBoxContainer/HBoxContainer/MarginContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
custom_minimum_size = Vector2(250, 0)
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 4
|
||||||
|
|
||||||
|
[node name="EffectsVolumeMarginContainer" type="MarginContainer" parent="CanvasLayer/VolumeMenu/VolumePanel/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/margin_left = 25
|
||||||
|
theme_override_constants/margin_top = 25
|
||||||
|
theme_override_constants/margin_right = 25
|
||||||
|
theme_override_constants/margin_bottom = 25
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/VolumeMenu/VolumePanel/VBoxContainer/EffectsVolumeMarginContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="HBoxContainer" type="HBoxContainer" parent="CanvasLayer/VolumeMenu/VolumePanel/VBoxContainer/EffectsVolumeMarginContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="CanvasLayer/VolumeMenu/VolumePanel/VBoxContainer/EffectsVolumeMarginContainer/VBoxContainer/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
text = "Effects
|
||||||
|
"
|
||||||
|
|
||||||
|
[node name="MarginContainer" type="MarginContainer" parent="CanvasLayer/VolumeMenu/VolumePanel/VBoxContainer/EffectsVolumeMarginContainer/VBoxContainer/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/margin_left = 35
|
||||||
|
|
||||||
|
[node name="EffectsVolumeSlider" type="HSlider" parent="CanvasLayer/VolumeMenu/VolumePanel/VBoxContainer/EffectsVolumeMarginContainer/VBoxContainer/HBoxContainer/MarginContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
custom_minimum_size = Vector2(250, 0)
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 4
|
||||||
|
|
||||||
|
[connection signal="pressed" from="." to="." method="_on_volume_button_pressed"]
|
||||||
|
[connection signal="gui_input" from="CanvasLayer/VolumeMenu" to="." method="_on_volume_menu_gui_input"]
|
||||||
|
[connection signal="value_changed" from="CanvasLayer/VolumeMenu/VolumePanel/VBoxContainer/MasterVolumeMarginContainer/VBoxContainer/HBoxContainer/MarginContainer/MasterVolumeSlider" to="." method="_on_master_volume_slider_value_changed"]
|
||||||
|
[connection signal="value_changed" from="CanvasLayer/VolumeMenu/VolumePanel/VBoxContainer/MusicVolumeMarginContainer/VBoxContainer/HBoxContainer/MarginContainer/MusicVolumeSlider" to="." method="_on_music_volume_slider_value_changed"]
|
||||||
|
[connection signal="value_changed" from="CanvasLayer/VolumeMenu/VolumePanel/VBoxContainer/VoiceVolumeMarginContainer/VBoxContainer/HBoxContainer/MarginContainer/VoiceVolumeSlider" to="." method="_on_voice_volume_slider_value_changed"]
|
||||||
|
[connection signal="value_changed" from="CanvasLayer/VolumeMenu/VolumePanel/VBoxContainer/EffectsVolumeMarginContainer/VBoxContainer/HBoxContainer/MarginContainer/EffectsVolumeSlider" to="." method="_on_effects_volume_slider_value_changed"]
|
||||||
@@ -5,26 +5,14 @@ const login_menu_path := "res://sources/menus/login/login.tscn"
|
|||||||
|
|
||||||
const DeviceTab: = preload("res://sources/menus/settings/device_tab.gd")
|
const DeviceTab: = preload("res://sources/menus/settings/device_tab.gd")
|
||||||
const device_tab_scene : PackedScene = preload("res://sources/menus/settings/device_tab.tscn")
|
const device_tab_scene : PackedScene = preload("res://sources/menus/settings/device_tab.tscn")
|
||||||
|
const ConfirmPopup: = preload("res://sources/ui/popup.gd")
|
||||||
# Volume menu
|
|
||||||
@onready var volume_menu: Control = %VolumeMenu
|
|
||||||
@onready var master_volume_slider: HSlider = %MasterVolumeSlider
|
|
||||||
@onready var music_volume_slider: HSlider = %MusicVolumeSlider
|
|
||||||
@onready var voice_volume_slider: HSlider = %VoiceVolumeSlider
|
|
||||||
@onready var effects_volume_slider: HSlider = %EffectsVolumeSlider
|
|
||||||
|
|
||||||
@onready var devices_tab_container : TabContainer = %DevicesTabContainer
|
@onready var devices_tab_container : TabContainer = %DevicesTabContainer
|
||||||
@onready var lesson_unlocks: LessonUnlocks = $LessonUnlocks
|
@onready var lesson_unlocks: LessonUnlocks = $LessonUnlocks
|
||||||
|
@onready var delete_popup: ConfirmPopup = %DeletePopup
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
_refresh_devices_tabs()
|
_refresh_devices_tabs()
|
||||||
|
|
||||||
set_master_volume_slider(UserDataManager.get_master_volume())
|
|
||||||
set_music_volume_slider(UserDataManager.get_music_volume())
|
|
||||||
set_voice_volume_slider(UserDataManager.get_voice_volume())
|
|
||||||
set_effects_volume_slider(UserDataManager.get_effects_volume())
|
|
||||||
|
|
||||||
OpeningCurtain.open()
|
OpeningCurtain.open()
|
||||||
|
|
||||||
|
|
||||||
@@ -51,6 +39,18 @@ func _on_back_button_pressed() -> void:
|
|||||||
get_tree().change_scene_to_file(login_menu_path)
|
get_tree().change_scene_to_file(login_menu_path)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_delete_button_pressed() -> void:
|
||||||
|
delete_popup.show()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_delete_popup_accepted() -> void:
|
||||||
|
var res: Dictionary = await ServerManager.delete_account()
|
||||||
|
if res.code == 200:
|
||||||
|
UserDataManager.delete_teacher_data()
|
||||||
|
UserDataManager.logout()
|
||||||
|
get_tree().change_scene_to_file(main_menu_path)
|
||||||
|
|
||||||
|
|
||||||
func _on_logout_button_pressed() -> void:
|
func _on_logout_button_pressed() -> void:
|
||||||
await OpeningCurtain.close()
|
await OpeningCurtain.close()
|
||||||
UserDataManager.logout()
|
UserDataManager.logout()
|
||||||
@@ -82,39 +82,3 @@ func _on_add_student_button_pressed() -> void:
|
|||||||
func _on_add_device_button_pressed() -> void:
|
func _on_add_device_button_pressed() -> void:
|
||||||
if UserDataManager.add_device():
|
if UserDataManager.add_device():
|
||||||
_refresh_devices_tabs()
|
_refresh_devices_tabs()
|
||||||
|
|
||||||
# ------------ Volume Menu ------------
|
|
||||||
|
|
||||||
func _on_volume_button_pressed() -> void:
|
|
||||||
volume_menu.visible = not volume_menu.visible
|
|
||||||
|
|
||||||
|
|
||||||
func set_master_volume_slider(volume: float) -> void:
|
|
||||||
master_volume_slider.value = volume
|
|
||||||
|
|
||||||
|
|
||||||
func set_music_volume_slider(volume: float) -> void:
|
|
||||||
music_volume_slider.value = volume
|
|
||||||
|
|
||||||
|
|
||||||
func set_voice_volume_slider(volume: float) -> void:
|
|
||||||
voice_volume_slider.value = volume
|
|
||||||
|
|
||||||
|
|
||||||
func set_effects_volume_slider(volume: float) -> void:
|
|
||||||
effects_volume_slider.value = volume
|
|
||||||
|
|
||||||
func _on_master_volume_slider_value_changed(volume: float) -> void:
|
|
||||||
UserDataManager.set_master_volume(volume)
|
|
||||||
|
|
||||||
|
|
||||||
func _on_music_volume_slider_value_changed(volume: float) -> void:
|
|
||||||
UserDataManager.set_music_volume(volume)
|
|
||||||
|
|
||||||
|
|
||||||
func _on_voice_volume_slider_value_changed(volume: float) -> void:
|
|
||||||
UserDataManager.set_voice_volume(volume)
|
|
||||||
|
|
||||||
|
|
||||||
func _on_effects_volume_slider_value_changed(volume: float) -> void:
|
|
||||||
UserDataManager.set_effects_volume(volume)
|
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
[gd_scene load_steps=10 format=3 uid="uid://ci7ueo06f24k3"]
|
[gd_scene load_steps=9 format=3 uid="uid://ci7ueo06f24k3"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://sources/menus/settings/teacher_settings.gd" id="1_ojivk"]
|
[ext_resource type="Script" path="res://sources/menus/settings/teacher_settings.gd" id="1_ojivk"]
|
||||||
[ext_resource type="PackedScene" uid="uid://wdjp1sv55q4f" path="res://sources/menus/components/night_sky/night_sky.tscn" id="1_v06h8"]
|
[ext_resource type="PackedScene" uid="uid://wdjp1sv55q4f" path="res://sources/menus/components/night_sky/night_sky.tscn" id="1_v06h8"]
|
||||||
[ext_resource type="Texture2D" uid="uid://wtx3wqs0l4si" path="res://assets/minigames/minigame_ui/graphic/button_back_up.png" id="3_hvu1i"]
|
[ext_resource type="Texture2D" uid="uid://wtx3wqs0l4si" path="res://assets/minigames/minigame_ui/graphic/button_back_up.png" id="3_hvu1i"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cbhip35yyqneg" path="res://assets/minigames/minigame_ui/graphic/button_back_down.png" id="4_045cm"]
|
[ext_resource type="Texture2D" uid="uid://cbhip35yyqneg" path="res://assets/minigames/minigame_ui/graphic/button_back_down.png" id="4_045cm"]
|
||||||
[ext_resource type="Texture2D" uid="uid://tcapan0mj64o" path="res://assets/minigames/minigame_ui/graphic/button_back_disabled.png" id="5_e3piv"]
|
[ext_resource type="Texture2D" uid="uid://tcapan0mj64o" path="res://assets/minigames/minigame_ui/graphic/button_back_disabled.png" id="5_e3piv"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dkvf2b6b1keqf" path="res://assets/minigames/minigame_ui/graphic/volume_up.png" id="6_urri0"]
|
[ext_resource type="PackedScene" uid="uid://bo7rpk4gebh24" path="res://sources/menus/settings/sound_settings_button.tscn" id="6_s8nbl"]
|
||||||
[ext_resource type="Texture2D" uid="uid://blgoagm5j5jh2" path="res://assets/minigames/minigame_ui/graphic/volume_down.png" id="7_71of5"]
|
[ext_resource type="PackedScene" uid="uid://bhdh5xfyauss0" path="res://sources/ui/Popup.tscn" id="7_jetb7"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cuxo6l6hmin1y" path="res://assets/minigames/minigame_ui/graphic/volume_disabled.png" id="8_tfdgw"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://qsvbq6ruc44v" path="res://sources/menus/settings/lesson_unlocks.tscn" id="9_mljfd"]
|
[ext_resource type="PackedScene" uid="uid://qsvbq6ruc44v" path="res://sources/menus/settings/lesson_unlocks.tscn" id="9_mljfd"]
|
||||||
|
|
||||||
[node name="TeacherSettings" type="Control"]
|
[node name="TeacherSettings" type="Control"]
|
||||||
@@ -36,6 +35,7 @@ theme_override_constants/margin_bottom = 50
|
|||||||
|
|
||||||
[node name="Container" type="VBoxContainer" parent="InterfaceLeft"]
|
[node name="Container" type="VBoxContainer" parent="InterfaceLeft"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
theme_override_constants/separation = 20
|
||||||
|
|
||||||
[node name="BackButton" type="TextureButton" parent="InterfaceLeft/Container"]
|
[node name="BackButton" type="TextureButton" parent="InterfaceLeft/Container"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
@@ -49,157 +49,28 @@ stretch_mode = 4
|
|||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
size_flags_stretch_ratio = 3.0
|
size_flags_stretch_ratio = 3.0
|
||||||
theme_override_constants/margin_left = 50
|
theme_override_constants/margin_left = 75
|
||||||
theme_override_constants/margin_top = 50
|
theme_override_constants/margin_top = 50
|
||||||
theme_override_constants/margin_right = 100
|
theme_override_constants/margin_right = 75
|
||||||
|
|
||||||
[node name="VolumeButton" type="TextureButton" parent="InterfaceLeft/Container/VolumeContainer"]
|
[node name="VolumeButton" parent="InterfaceLeft/Container/VolumeContainer" instance=ExtResource("6_s8nbl")]
|
||||||
unique_name_in_owner = true
|
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
texture_normal = ExtResource("6_urri0")
|
|
||||||
texture_pressed = ExtResource("7_71of5")
|
|
||||||
texture_disabled = ExtResource("8_tfdgw")
|
|
||||||
stretch_mode = 4
|
|
||||||
|
|
||||||
[node name="VolumeMenu" type="Control" parent="InterfaceLeft/Container/VolumeContainer/VolumeButton"]
|
[node name="DeleteButton" type="Button" parent="InterfaceLeft/Container"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_type_variation = &"DangerButton"
|
||||||
|
theme_override_font_sizes/font_size = 40
|
||||||
|
text = "DELETE_ACCOUNT"
|
||||||
|
|
||||||
|
[node name="DeletePopup" parent="InterfaceLeft/Container/DeleteButton" instance=ExtResource("7_jetb7")]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
visible = false
|
visible = false
|
||||||
layout_mode = 3
|
content_text = "Voulez-vous vraiment supprimer votre compte ?
|
||||||
anchors_preset = 0
|
Cette action est irréversible !"
|
||||||
offset_left = 300.0
|
|
||||||
offset_right = 781.0
|
|
||||||
offset_bottom = 456.0
|
|
||||||
|
|
||||||
[node name="Panel" type="Panel" parent="InterfaceLeft/Container/VolumeContainer/VolumeButton/VolumeMenu"]
|
|
||||||
layout_mode = 2
|
|
||||||
offset_right = 481.0
|
|
||||||
offset_bottom = 456.0
|
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="InterfaceLeft/Container/VolumeContainer/VolumeButton/VolumeMenu"]
|
|
||||||
layout_mode = 2
|
|
||||||
offset_right = 481.0
|
|
||||||
offset_bottom = 456.0
|
|
||||||
|
|
||||||
[node name="MasterVolumeMarginContainer" type="MarginContainer" parent="InterfaceLeft/Container/VolumeContainer/VolumeButton/VolumeMenu/VBoxContainer"]
|
|
||||||
layout_mode = 2
|
|
||||||
theme_override_constants/margin_left = 25
|
|
||||||
theme_override_constants/margin_top = 25
|
|
||||||
theme_override_constants/margin_right = 25
|
|
||||||
theme_override_constants/margin_bottom = 25
|
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="InterfaceLeft/Container/VolumeContainer/VolumeButton/VolumeMenu/VBoxContainer/MasterVolumeMarginContainer"]
|
|
||||||
layout_mode = 2
|
|
||||||
|
|
||||||
[node name="HBoxContainer" type="HBoxContainer" parent="InterfaceLeft/Container/VolumeContainer/VolumeButton/VolumeMenu/VBoxContainer/MasterVolumeMarginContainer/VBoxContainer"]
|
|
||||||
layout_mode = 2
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="InterfaceLeft/Container/VolumeContainer/VolumeButton/VolumeMenu/VBoxContainer/MasterVolumeMarginContainer/VBoxContainer/HBoxContainer"]
|
|
||||||
layout_mode = 2
|
|
||||||
size_flags_horizontal = 3
|
|
||||||
text = "Master"
|
|
||||||
|
|
||||||
[node name="MarginContainer" type="MarginContainer" parent="InterfaceLeft/Container/VolumeContainer/VolumeButton/VolumeMenu/VBoxContainer/MasterVolumeMarginContainer/VBoxContainer/HBoxContainer"]
|
|
||||||
layout_mode = 2
|
|
||||||
theme_override_constants/margin_left = 35
|
|
||||||
|
|
||||||
[node name="MasterVolumeSlider" type="HSlider" parent="InterfaceLeft/Container/VolumeContainer/VolumeButton/VolumeMenu/VBoxContainer/MasterVolumeMarginContainer/VBoxContainer/HBoxContainer/MarginContainer"]
|
|
||||||
unique_name_in_owner = true
|
|
||||||
custom_minimum_size = Vector2(250, 0)
|
|
||||||
layout_mode = 2
|
|
||||||
size_flags_horizontal = 3
|
|
||||||
size_flags_vertical = 4
|
|
||||||
|
|
||||||
[node name="MusicVolumeMarginContainer" type="MarginContainer" parent="InterfaceLeft/Container/VolumeContainer/VolumeButton/VolumeMenu/VBoxContainer"]
|
|
||||||
layout_mode = 2
|
|
||||||
theme_override_constants/margin_left = 25
|
|
||||||
theme_override_constants/margin_top = 25
|
|
||||||
theme_override_constants/margin_right = 25
|
|
||||||
theme_override_constants/margin_bottom = 25
|
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="InterfaceLeft/Container/VolumeContainer/VolumeButton/VolumeMenu/VBoxContainer/MusicVolumeMarginContainer"]
|
|
||||||
layout_mode = 2
|
|
||||||
|
|
||||||
[node name="HBoxContainer" type="HBoxContainer" parent="InterfaceLeft/Container/VolumeContainer/VolumeButton/VolumeMenu/VBoxContainer/MusicVolumeMarginContainer/VBoxContainer"]
|
|
||||||
layout_mode = 2
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="InterfaceLeft/Container/VolumeContainer/VolumeButton/VolumeMenu/VBoxContainer/MusicVolumeMarginContainer/VBoxContainer/HBoxContainer"]
|
|
||||||
layout_mode = 2
|
|
||||||
size_flags_horizontal = 3
|
|
||||||
text = "Music"
|
|
||||||
|
|
||||||
[node name="MarginContainer" type="MarginContainer" parent="InterfaceLeft/Container/VolumeContainer/VolumeButton/VolumeMenu/VBoxContainer/MusicVolumeMarginContainer/VBoxContainer/HBoxContainer"]
|
|
||||||
layout_mode = 2
|
|
||||||
theme_override_constants/margin_left = 35
|
|
||||||
|
|
||||||
[node name="MusicVolumeSlider" type="HSlider" parent="InterfaceLeft/Container/VolumeContainer/VolumeButton/VolumeMenu/VBoxContainer/MusicVolumeMarginContainer/VBoxContainer/HBoxContainer/MarginContainer"]
|
|
||||||
unique_name_in_owner = true
|
|
||||||
custom_minimum_size = Vector2(250, 0)
|
|
||||||
layout_mode = 2
|
|
||||||
size_flags_horizontal = 3
|
|
||||||
size_flags_vertical = 4
|
|
||||||
|
|
||||||
[node name="VoiceVolumeMarginContainer" type="MarginContainer" parent="InterfaceLeft/Container/VolumeContainer/VolumeButton/VolumeMenu/VBoxContainer"]
|
|
||||||
layout_mode = 2
|
|
||||||
theme_override_constants/margin_left = 25
|
|
||||||
theme_override_constants/margin_top = 25
|
|
||||||
theme_override_constants/margin_right = 25
|
|
||||||
theme_override_constants/margin_bottom = 25
|
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="InterfaceLeft/Container/VolumeContainer/VolumeButton/VolumeMenu/VBoxContainer/VoiceVolumeMarginContainer"]
|
|
||||||
layout_mode = 2
|
|
||||||
|
|
||||||
[node name="HBoxContainer" type="HBoxContainer" parent="InterfaceLeft/Container/VolumeContainer/VolumeButton/VolumeMenu/VBoxContainer/VoiceVolumeMarginContainer/VBoxContainer"]
|
|
||||||
layout_mode = 2
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="InterfaceLeft/Container/VolumeContainer/VolumeButton/VolumeMenu/VBoxContainer/VoiceVolumeMarginContainer/VBoxContainer/HBoxContainer"]
|
|
||||||
layout_mode = 2
|
|
||||||
size_flags_horizontal = 3
|
|
||||||
text = "Voice"
|
|
||||||
|
|
||||||
[node name="MarginContainer" type="MarginContainer" parent="InterfaceLeft/Container/VolumeContainer/VolumeButton/VolumeMenu/VBoxContainer/VoiceVolumeMarginContainer/VBoxContainer/HBoxContainer"]
|
|
||||||
layout_mode = 2
|
|
||||||
theme_override_constants/margin_left = 35
|
|
||||||
|
|
||||||
[node name="VoiceVolumeSlider" type="HSlider" parent="InterfaceLeft/Container/VolumeContainer/VolumeButton/VolumeMenu/VBoxContainer/VoiceVolumeMarginContainer/VBoxContainer/HBoxContainer/MarginContainer"]
|
|
||||||
unique_name_in_owner = true
|
|
||||||
custom_minimum_size = Vector2(250, 0)
|
|
||||||
layout_mode = 2
|
|
||||||
size_flags_horizontal = 3
|
|
||||||
size_flags_vertical = 4
|
|
||||||
|
|
||||||
[node name="EffectsVolumeMarginContainer" type="MarginContainer" parent="InterfaceLeft/Container/VolumeContainer/VolumeButton/VolumeMenu/VBoxContainer"]
|
|
||||||
layout_mode = 2
|
|
||||||
theme_override_constants/margin_left = 25
|
|
||||||
theme_override_constants/margin_top = 25
|
|
||||||
theme_override_constants/margin_right = 25
|
|
||||||
theme_override_constants/margin_bottom = 25
|
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="InterfaceLeft/Container/VolumeContainer/VolumeButton/VolumeMenu/VBoxContainer/EffectsVolumeMarginContainer"]
|
|
||||||
layout_mode = 2
|
|
||||||
|
|
||||||
[node name="HBoxContainer" type="HBoxContainer" parent="InterfaceLeft/Container/VolumeContainer/VolumeButton/VolumeMenu/VBoxContainer/EffectsVolumeMarginContainer/VBoxContainer"]
|
|
||||||
layout_mode = 2
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="InterfaceLeft/Container/VolumeContainer/VolumeButton/VolumeMenu/VBoxContainer/EffectsVolumeMarginContainer/VBoxContainer/HBoxContainer"]
|
|
||||||
layout_mode = 2
|
|
||||||
size_flags_horizontal = 3
|
|
||||||
text = "Effects
|
|
||||||
"
|
|
||||||
|
|
||||||
[node name="MarginContainer" type="MarginContainer" parent="InterfaceLeft/Container/VolumeContainer/VolumeButton/VolumeMenu/VBoxContainer/EffectsVolumeMarginContainer/VBoxContainer/HBoxContainer"]
|
|
||||||
layout_mode = 2
|
|
||||||
theme_override_constants/margin_left = 35
|
|
||||||
|
|
||||||
[node name="EffectsVolumeSlider" type="HSlider" parent="InterfaceLeft/Container/VolumeContainer/VolumeButton/VolumeMenu/VBoxContainer/EffectsVolumeMarginContainer/VBoxContainer/HBoxContainer/MarginContainer"]
|
|
||||||
unique_name_in_owner = true
|
|
||||||
custom_minimum_size = Vector2(250, 0)
|
|
||||||
layout_mode = 2
|
|
||||||
size_flags_horizontal = 3
|
|
||||||
size_flags_vertical = 4
|
|
||||||
|
|
||||||
[node name="LogoutButton" type="Button" parent="InterfaceLeft/Container"]
|
[node name="LogoutButton" type="Button" parent="InterfaceLeft/Container"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme_override_font_sizes/font_size = 70
|
theme_override_font_sizes/font_size = 40
|
||||||
text = "LOGOUT"
|
text = "LOGOUT"
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||||
@@ -252,11 +123,8 @@ visible = false
|
|||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
|
|
||||||
[connection signal="pressed" from="InterfaceLeft/Container/BackButton" to="." method="_on_back_button_pressed"]
|
[connection signal="pressed" from="InterfaceLeft/Container/BackButton" to="." method="_on_back_button_pressed"]
|
||||||
[connection signal="pressed" from="InterfaceLeft/Container/VolumeContainer/VolumeButton" to="." method="_on_volume_button_pressed"]
|
[connection signal="pressed" from="InterfaceLeft/Container/DeleteButton" to="." method="_on_delete_button_pressed"]
|
||||||
[connection signal="value_changed" from="InterfaceLeft/Container/VolumeContainer/VolumeButton/VolumeMenu/VBoxContainer/MasterVolumeMarginContainer/VBoxContainer/HBoxContainer/MarginContainer/MasterVolumeSlider" to="." method="_on_master_volume_slider_value_changed"]
|
[connection signal="accepted" from="InterfaceLeft/Container/DeleteButton/DeletePopup" to="." method="_on_delete_popup_accepted"]
|
||||||
[connection signal="value_changed" from="InterfaceLeft/Container/VolumeContainer/VolumeButton/VolumeMenu/VBoxContainer/MusicVolumeMarginContainer/VBoxContainer/HBoxContainer/MarginContainer/MusicVolumeSlider" to="." method="_on_music_volume_slider_value_changed"]
|
|
||||||
[connection signal="value_changed" from="InterfaceLeft/Container/VolumeContainer/VolumeButton/VolumeMenu/VBoxContainer/VoiceVolumeMarginContainer/VBoxContainer/HBoxContainer/MarginContainer/VoiceVolumeSlider" to="." method="_on_voice_volume_slider_value_changed"]
|
|
||||||
[connection signal="value_changed" from="InterfaceLeft/Container/VolumeContainer/VolumeButton/VolumeMenu/VBoxContainer/EffectsVolumeMarginContainer/VBoxContainer/HBoxContainer/MarginContainer/EffectsVolumeSlider" to="." method="_on_effects_volume_slider_value_changed"]
|
|
||||||
[connection signal="pressed" from="InterfaceLeft/Container/LogoutButton" to="." method="_on_logout_button_pressed"]
|
[connection signal="pressed" from="InterfaceLeft/Container/LogoutButton" to="." method="_on_logout_button_pressed"]
|
||||||
[connection signal="tab_changed" from="VBoxContainer/DevicesTabContainer" to="." method="_on_devices_tab_container_tab_changed"]
|
[connection signal="tab_changed" from="VBoxContainer/DevicesTabContainer" to="." method="_on_devices_tab_container_tab_changed"]
|
||||||
[connection signal="pressed" from="VBoxContainer/InterfaceBottom/Container/AddDeviceButton" to="." method="_on_add_device_button_pressed"]
|
[connection signal="pressed" from="VBoxContainer/InterfaceBottom/Container/AddDeviceButton" to="." method="_on_add_device_button_pressed"]
|
||||||
|
|||||||
@@ -0,0 +1,81 @@
|
|||||||
|
[gd_scene load_steps=4 format=3 uid="uid://bhdh5xfyauss0"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://sources/ui/popup.gd" id="1_o3fd6"]
|
||||||
|
|
||||||
|
[sub_resource type="Gradient" id="Gradient_22q4u"]
|
||||||
|
colors = PackedColorArray(0.2, 0.2, 0.2, 0.505882, 0.2, 0.2, 0.2, 0.505882)
|
||||||
|
|
||||||
|
[sub_resource type="GradientTexture1D" id="GradientTexture1D_ymust"]
|
||||||
|
gradient = SubResource("Gradient_22q4u")
|
||||||
|
|
||||||
|
[node name="Popup" type="CanvasLayer"]
|
||||||
|
script = ExtResource("1_o3fd6")
|
||||||
|
|
||||||
|
[node name="TextureRect" type="TextureRect" parent="."]
|
||||||
|
top_level = true
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
mouse_filter = 0
|
||||||
|
texture = SubResource("GradientTexture1D_ymust")
|
||||||
|
|
||||||
|
[node name="PanelContainer" type="PanelContainer" parent="TextureRect"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -20.0
|
||||||
|
offset_top = -20.0
|
||||||
|
offset_right = 20.0
|
||||||
|
offset_bottom = 20.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
theme_type_variation = &"PanelKalulu"
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="TextureRect/PanelContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="MarginContainer" type="MarginContainer" parent="TextureRect/PanelContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/margin_left = 50
|
||||||
|
theme_override_constants/margin_top = 50
|
||||||
|
theme_override_constants/margin_right = 50
|
||||||
|
theme_override_constants/margin_bottom = 25
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="TextureRect/PanelContainer/VBoxContainer/MarginContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/separation = 20
|
||||||
|
|
||||||
|
[node name="ContentLabel" type="Label" parent="TextureRect/PanelContainer/VBoxContainer/MarginContainer/VBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
custom_minimum_size = Vector2(1000, 0)
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_vertical = 1
|
||||||
|
theme_override_font_sizes/font_size = 70
|
||||||
|
autowrap_mode = 2
|
||||||
|
|
||||||
|
[node name="HBoxContainer" type="HBoxContainer" parent="TextureRect/PanelContainer/VBoxContainer/MarginContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="ConfirmButton" type="Button" parent="TextureRect/PanelContainer/VBoxContainer/MarginContainer/VBoxContainer/HBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_font_sizes/font_size = 70
|
||||||
|
text = "VALIDATE"
|
||||||
|
|
||||||
|
[node name="Separator" type="Control" parent="TextureRect/PanelContainer/VBoxContainer/MarginContainer/VBoxContainer/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
|
[node name="CancelButton" type="Button" parent="TextureRect/PanelContainer/VBoxContainer/MarginContainer/VBoxContainer/HBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_font_sizes/font_size = 70
|
||||||
|
text = "CANCEL"
|
||||||
|
|
||||||
|
[connection signal="pressed" from="TextureRect/PanelContainer/VBoxContainer/MarginContainer/VBoxContainer/HBoxContainer/ConfirmButton" to="." method="_on_confirm_button_pressed"]
|
||||||
|
[connection signal="pressed" from="TextureRect/PanelContainer/VBoxContainer/MarginContainer/VBoxContainer/HBoxContainer/CancelButton" to="." method="_on_cancel_button_pressed"]
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
@tool
|
||||||
|
extends CanvasLayer
|
||||||
|
|
||||||
|
signal accepted
|
||||||
|
signal refused
|
||||||
|
|
||||||
|
@export_multiline var content_text: String = "": set = _set_content_text
|
||||||
|
|
||||||
|
@onready var content_label: Label = %ContentLabel
|
||||||
|
@onready var confirm_button: Button = %ConfirmButton
|
||||||
|
@onready var cancel_button: Button = %CancelButton
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
_set_content_text(content_text)
|
||||||
|
|
||||||
|
|
||||||
|
func _set_content_text(p_content_text: String) -> void:
|
||||||
|
content_text = p_content_text
|
||||||
|
if content_label:
|
||||||
|
content_label.text = content_text
|
||||||
|
|
||||||
|
|
||||||
|
func _on_confirm_button_pressed() -> void:
|
||||||
|
accepted.emit()
|
||||||
|
hide()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_cancel_button_pressed() -> void:
|
||||||
|
refused.emit()
|
||||||
|
hide()
|
||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
[ext_resource type="Script" path="res://sources/utils/autoloads/server_manager.gd" id="1_n6vsh"]
|
[ext_resource type="Script" path="res://sources/utils/autoloads/server_manager.gd" id="1_n6vsh"]
|
||||||
|
|
||||||
[sub_resource type="Gradient" id="Gradient_22q4u"]
|
[sub_resource type="Gradient" id="Gradient_wm8cn"]
|
||||||
colors = PackedColorArray(0.2, 0.2, 0.2, 0.505882, 0.2, 0.2, 0.2, 0.505882)
|
colors = PackedColorArray(0.2, 0.2, 0.2, 0.505882, 0.2, 0.2, 0.2, 0.505882)
|
||||||
|
|
||||||
[sub_resource type="GradientTexture1D" id="GradientTexture1D_68deq"]
|
[sub_resource type="GradientTexture1D" id="GradientTexture1D_68deq"]
|
||||||
gradient = SubResource("Gradient_22q4u")
|
gradient = SubResource("Gradient_wm8cn")
|
||||||
|
|
||||||
[node name="ServerManager" type="CanvasLayer"]
|
[node name="ServerManager" type="CanvasLayer"]
|
||||||
script = ExtResource("1_n6vsh")
|
script = ExtResource("1_n6vsh")
|
||||||
|
|||||||
@@ -21,10 +21,17 @@ func register(data: Dictionary) -> Dictionary:
|
|||||||
return _response()
|
return _response()
|
||||||
|
|
||||||
func login(type: TeacherSettings.AccountType, device:int, mail: String, password: String) -> Dictionary:
|
func login(type: TeacherSettings.AccountType, device:int, mail: String, password: String) -> Dictionary:
|
||||||
loading_rect.visible = true
|
loading_rect.show()
|
||||||
await _get_request("login", {"type":type, "device":device, "mail": mail, "password": password})
|
await _get_request("login", {"type":type, "device":device, "mail": mail, "password": password})
|
||||||
return _response()
|
return _response()
|
||||||
|
|
||||||
|
|
||||||
|
func delete_account() -> Dictionary:
|
||||||
|
loading_rect.show()
|
||||||
|
await _delete_request("delete_account")
|
||||||
|
return _response()
|
||||||
|
|
||||||
|
|
||||||
func get_language_pack_url(locale: String) -> Dictionary:
|
func get_language_pack_url(locale: String) -> Dictionary:
|
||||||
await _get_request("language", {"locale": locale})
|
await _get_request("language", {"locale": locale})
|
||||||
return _response()
|
return _response()
|
||||||
@@ -83,6 +90,19 @@ func _post_json_request(URI: String, data: Dictionary) -> void:
|
|||||||
code = 500
|
code = 500
|
||||||
json = {message = "Internal Server Error"}
|
json = {message = "Internal Server Error"}
|
||||||
|
|
||||||
|
|
||||||
|
func _delete_request(URI: String) -> void:
|
||||||
|
code = 0
|
||||||
|
json = {}
|
||||||
|
|
||||||
|
var req: = URL + URI
|
||||||
|
var headers: = _create_request_headers()
|
||||||
|
if http_request.request(req, headers, HTTPClient.METHOD_DELETE) == 0:
|
||||||
|
await request_completed
|
||||||
|
else:
|
||||||
|
code = 500
|
||||||
|
json = {message = "Internal Server Error"}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
func _on_http_request_request_completed(_result: int, response_code: int, _headers: PackedStringArray, body: PackedByteArray) -> void:
|
func _on_http_request_request_completed(_result: int, response_code: int, _headers: PackedStringArray, body: PackedByteArray) -> void:
|
||||||
|
|||||||
@@ -4,21 +4,15 @@ extends Node
|
|||||||
|
|
||||||
var student: String = "" :
|
var student: String = "" :
|
||||||
set(student_name):
|
set(student_name):
|
||||||
if student_settings:
|
|
||||||
_save_student_settings()
|
|
||||||
|
|
||||||
student = student_name
|
student = student_name
|
||||||
student_settings = null
|
|
||||||
student_progression = null
|
student_progression = null
|
||||||
if student :
|
if student :
|
||||||
_load_student_settings()
|
|
||||||
_load_student_progression()
|
_load_student_progression()
|
||||||
_load_student_remediation()
|
_load_student_remediation()
|
||||||
_load_student_difficulty()
|
_load_student_difficulty()
|
||||||
|
|
||||||
var _device_settings: DeviceSettings
|
var _device_settings: DeviceSettings
|
||||||
var teacher_settings: TeacherSettings
|
var teacher_settings: TeacherSettings
|
||||||
var student_settings: UserSettings
|
|
||||||
var student_progression: UserProgression
|
var student_progression: UserProgression
|
||||||
var _student_remediation: UserRemediation
|
var _student_remediation: UserRemediation
|
||||||
var _student_difficulty: UserDifficulty
|
var _student_difficulty: UserDifficulty
|
||||||
@@ -99,6 +93,12 @@ func logout() -> void:
|
|||||||
if student:
|
if student:
|
||||||
student = ""
|
student = ""
|
||||||
|
|
||||||
|
|
||||||
|
func delete_teacher_data() -> void:
|
||||||
|
if DirAccess.dir_exists_absolute(get_teacher_folder()):
|
||||||
|
_delete_dir(get_teacher_folder())
|
||||||
|
|
||||||
|
|
||||||
func login_student(code : String) -> bool:
|
func login_student(code : String) -> bool:
|
||||||
if not _device_settings or not teacher_settings:
|
if not _device_settings or not teacher_settings:
|
||||||
return false
|
return false
|
||||||
@@ -116,16 +116,6 @@ func login_student(code : String) -> bool:
|
|||||||
|
|
||||||
#region Device settings
|
#region Device settings
|
||||||
|
|
||||||
func set_language(language : String) -> void:
|
|
||||||
if _device_settings:
|
|
||||||
_device_settings.language = language
|
|
||||||
_save_device_settings()
|
|
||||||
|
|
||||||
func set_language_version(language: String, version: Dictionary) -> void:
|
|
||||||
if _device_settings:
|
|
||||||
_device_settings.language_versions[language] = version
|
|
||||||
_save_device_settings()
|
|
||||||
|
|
||||||
func get_device_settings_path() -> String:
|
func get_device_settings_path() -> String:
|
||||||
return "user://device_settings.tres"
|
return "user://device_settings.tres"
|
||||||
|
|
||||||
@@ -147,6 +137,81 @@ func _load_device_settings() -> void:
|
|||||||
func _save_device_settings() -> void:
|
func _save_device_settings() -> void:
|
||||||
ResourceSaver.save(_device_settings, get_device_settings_path())
|
ResourceSaver.save(_device_settings, get_device_settings_path())
|
||||||
|
|
||||||
|
func set_language(language : String) -> void:
|
||||||
|
if _device_settings:
|
||||||
|
_device_settings.language = language
|
||||||
|
_save_device_settings()
|
||||||
|
|
||||||
|
func set_language_version(language: String, version: Dictionary) -> void:
|
||||||
|
if _device_settings:
|
||||||
|
_device_settings.language_versions[language] = version
|
||||||
|
_save_device_settings()
|
||||||
|
|
||||||
|
func set_master_volume(value: float) -> void:
|
||||||
|
if _device_settings:
|
||||||
|
var volume: = denormalize_volume(value)
|
||||||
|
_device_settings.master_volume = volume
|
||||||
|
_save_device_settings()
|
||||||
|
|
||||||
|
func set_music_volume(value: float) -> void:
|
||||||
|
if _device_settings:
|
||||||
|
var volume: = denormalize_volume(value)
|
||||||
|
_device_settings.music_volume = volume
|
||||||
|
_save_device_settings()
|
||||||
|
|
||||||
|
func set_voice_volume(value: float) -> void:
|
||||||
|
if _device_settings:
|
||||||
|
var volume: = denormalize_volume(value)
|
||||||
|
_device_settings.voice_volume = volume
|
||||||
|
_save_device_settings()
|
||||||
|
|
||||||
|
func set_effects_volume(value: float) -> void:
|
||||||
|
if _device_settings:
|
||||||
|
var volume: = denormalize_volume(value)
|
||||||
|
_device_settings.effects_volume = volume
|
||||||
|
_save_device_settings()
|
||||||
|
|
||||||
|
func get_master_volume() -> float:
|
||||||
|
var value: = 0.0
|
||||||
|
if _device_settings:
|
||||||
|
var volume: = _device_settings.master_volume
|
||||||
|
value = normalize_slider(volume)
|
||||||
|
|
||||||
|
return value
|
||||||
|
|
||||||
|
func get_music_volume() -> float:
|
||||||
|
var value: = 0.0
|
||||||
|
if _device_settings:
|
||||||
|
var volume: = _device_settings.music_volume
|
||||||
|
value = normalize_slider(volume)
|
||||||
|
|
||||||
|
return value
|
||||||
|
|
||||||
|
func get_voice_volume() -> float:
|
||||||
|
var value: = 0.0
|
||||||
|
if _device_settings:
|
||||||
|
var volume: = _device_settings.voice_volume
|
||||||
|
value = normalize_slider(volume)
|
||||||
|
|
||||||
|
return value
|
||||||
|
|
||||||
|
func get_effects_volume() -> float:
|
||||||
|
var value: = 0.0
|
||||||
|
if _device_settings:
|
||||||
|
var volume: = _device_settings.effects_volume
|
||||||
|
value = normalize_slider(volume)
|
||||||
|
|
||||||
|
return value
|
||||||
|
|
||||||
|
# Convert the volume from [-80, 6]db to [0, 100] and back
|
||||||
|
func normalize_slider(volume: float) -> float:
|
||||||
|
var value: = pow((volume + 80.0) / 86, 5.0) * 100.0
|
||||||
|
return value
|
||||||
|
|
||||||
|
func denormalize_volume(value: float) -> float:
|
||||||
|
var volume: = pow(float(value) / 100.0, 0.2) * 86 - 80
|
||||||
|
return volume
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Teacher settings
|
#region Teacher settings
|
||||||
@@ -257,23 +322,6 @@ func delete_student(device_id : int, code : String) -> bool:
|
|||||||
func get_student_folder() -> String:
|
func get_student_folder() -> String:
|
||||||
return _device_settings.get_folder_path().path_join(student)
|
return _device_settings.get_folder_path().path_join(student)
|
||||||
|
|
||||||
func get_student_settings_path() -> String:
|
|
||||||
return get_student_folder().path_join("settings.tres")
|
|
||||||
|
|
||||||
func _load_student_settings() -> void:
|
|
||||||
# Load User settings
|
|
||||||
if FileAccess.file_exists(get_student_settings_path()):
|
|
||||||
student_settings = load(get_student_settings_path())
|
|
||||||
|
|
||||||
if not student_settings:
|
|
||||||
student_settings = UserSettings.new()
|
|
||||||
DirAccess.make_dir_recursive_absolute(get_student_folder())
|
|
||||||
_save_student_settings()
|
|
||||||
|
|
||||||
func _save_student_settings() -> void:
|
|
||||||
ResourceSaver.save(student_settings, get_student_settings_path())
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Student progression
|
#region Student progression
|
||||||
@@ -393,71 +441,10 @@ func update_difficulty_for_minigame(minigame_name: String, minigame_won: bool) -
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Sound settings
|
func _delete_dir(path: String) -> void:
|
||||||
|
var dir: = DirAccess.open(path)
|
||||||
func set_master_volume(value: float) -> void:
|
for file in dir.get_files():
|
||||||
if student_settings:
|
dir.remove(file)
|
||||||
var volume: = denormalize_volume(value)
|
for subfolder in dir.get_directories():
|
||||||
student_settings.master_volume = volume
|
_delete_dir(path.path_join(subfolder))
|
||||||
_save_student_settings()
|
dir.remove(subfolder)
|
||||||
|
|
||||||
func set_music_volume(value: float) -> void:
|
|
||||||
if student_settings:
|
|
||||||
var volume: = denormalize_volume(value)
|
|
||||||
student_settings.music_volume = volume
|
|
||||||
_save_student_settings()
|
|
||||||
|
|
||||||
func set_voice_volume(value: float) -> void:
|
|
||||||
if student_settings:
|
|
||||||
var volume: = denormalize_volume(value)
|
|
||||||
student_settings.voice_volume = volume
|
|
||||||
_save_student_settings()
|
|
||||||
|
|
||||||
func set_effects_volume(value: float) -> void:
|
|
||||||
if student_settings:
|
|
||||||
var volume: = denormalize_volume(value)
|
|
||||||
student_settings.effects_volume = volume
|
|
||||||
_save_student_settings()
|
|
||||||
|
|
||||||
func get_master_volume() -> float:
|
|
||||||
var value: = 0.0
|
|
||||||
if student_settings:
|
|
||||||
var volume: = student_settings.master_volume
|
|
||||||
value = normalize_slider(volume)
|
|
||||||
|
|
||||||
return value
|
|
||||||
|
|
||||||
func get_music_volume() -> float:
|
|
||||||
var value: = 0.0
|
|
||||||
if student_settings:
|
|
||||||
var volume: = student_settings.music_volume
|
|
||||||
value = normalize_slider(volume)
|
|
||||||
|
|
||||||
return value
|
|
||||||
|
|
||||||
func get_voice_volume() -> float:
|
|
||||||
var value: = 0.0
|
|
||||||
if student_settings:
|
|
||||||
var volume: = student_settings.voice_volume
|
|
||||||
value = normalize_slider(volume)
|
|
||||||
|
|
||||||
return value
|
|
||||||
|
|
||||||
func get_effects_volume() -> float:
|
|
||||||
var value: = 0.0
|
|
||||||
if student_settings:
|
|
||||||
var volume: = student_settings.effects_volume
|
|
||||||
value = normalize_slider(volume)
|
|
||||||
|
|
||||||
return value
|
|
||||||
|
|
||||||
# Convert the volume from [-80, 6]db to [0, 100] and back
|
|
||||||
func normalize_slider(volume: float) -> float:
|
|
||||||
var value: = pow((volume + 80.0) / 86, 5.0) * 100.0
|
|
||||||
return value
|
|
||||||
|
|
||||||
func denormalize_volume(value: float) -> float:
|
|
||||||
var volume: = pow(float(value) / 100.0, 0.2) * 86 - 80
|
|
||||||
return volume
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|||||||
Reference in New Issue
Block a user