Ensure proper initialization of all Arrays and Dictionaries
This commit is contained in:
@@ -24,7 +24,7 @@ const supported_locales: Array[String] = [
|
||||
print("DeviceSettings: language SET: " + TranslationServer.get_locale())
|
||||
@export var teacher : String
|
||||
@export var device_id : int
|
||||
@export var language_versions: Dictionary # locale : datetime
|
||||
@export var language_versions: Dictionary = {} # locale : datetime
|
||||
|
||||
@export var master_volume: float = 0.0 :
|
||||
set(volume):
|
||||
|
||||
@@ -4,7 +4,6 @@ class_name Garden
|
||||
|
||||
# Namespace
|
||||
const GardenFlower: = preload("res://resources/gardens/garden_flower.gd")
|
||||
const LessonButton: = preload("res://sources/lesson_screen/lesson_button.gd")
|
||||
|
||||
const flower_path_model: String = "res://assets/gardens/flowers/Plant_%02d_%02d_%s.png"
|
||||
const background_path_model: String = "res://assets/gardens/gardens/garden_%02d_open.png"
|
||||
@@ -12,7 +11,7 @@ const background_path_model: String = "res://assets/gardens/gardens/garden_%02d_
|
||||
@export var garden_layout: GardenLayout:
|
||||
set = set_garden_layout
|
||||
|
||||
@export var garden_colors: Array[Color]
|
||||
@export var garden_colors: Array[Color] = []
|
||||
|
||||
@onready var buttons: Control = $Buttons
|
||||
@onready var flower_controls: Array[TextureRect] = [
|
||||
@@ -37,8 +36,8 @@ enum FlowerSizes{
|
||||
Large
|
||||
}
|
||||
|
||||
var flowers: Array[GardenLayout.Flower]
|
||||
var flowers_sizes: Array[FlowerSizes]
|
||||
var flowers: Array[GardenLayout.Flower] = []
|
||||
var flowers_sizes: Array[FlowerSizes] = []
|
||||
var color: Color
|
||||
|
||||
var current_progression: float = 0.0
|
||||
@@ -81,13 +80,13 @@ func update_flowers() -> void:
|
||||
flower_scene.position = Vector2(flower.position.x - flower_scene.size.x / 2, flower.position.y - flower_scene.size.y)
|
||||
|
||||
|
||||
func set_lesson_buttons(p_lesson_buttons: Array[GardenLayout.LessonButton]) -> void:
|
||||
func set_lesson_buttons(p_lesson_buttons: Array[GardenLayout.GardenLayoutLessonButton]) -> void:
|
||||
for lesson_button_control: LessonButton in lesson_button_controls:
|
||||
lesson_button_control.visible = false
|
||||
for index: int in p_lesson_buttons.size():
|
||||
if index >= lesson_button_controls.size():
|
||||
break
|
||||
var lesson_button: GardenLayout.LessonButton = p_lesson_buttons[index]
|
||||
var lesson_button: GardenLayout.GardenLayoutLessonButton = p_lesson_buttons[index]
|
||||
var lesson_button_control: LessonButton = lesson_button_controls[index]
|
||||
lesson_button_control.position = Vector2(lesson_button.position)
|
||||
lesson_button_control.visible = true
|
||||
|
||||
@@ -24,7 +24,7 @@ class Flower:
|
||||
}
|
||||
|
||||
|
||||
class LessonButton:
|
||||
class GardenLayoutLessonButton:
|
||||
var position: Vector2i = Vector2i.ZERO
|
||||
var path_out_position: Vector2i = Vector2i.ZERO
|
||||
|
||||
@@ -32,8 +32,8 @@ class LessonButton:
|
||||
position = p_position
|
||||
path_out_position = p_path_out_position
|
||||
|
||||
static func from_dict(d: Dictionary) -> LessonButton:
|
||||
return LessonButton.new(d.position as Vector2i, d.path_out_position as Vector2i)
|
||||
static func from_dict(d: Dictionary) -> GardenLayoutLessonButton:
|
||||
return GardenLayoutLessonButton.new(d.position as Vector2i, d.path_out_position as Vector2i)
|
||||
|
||||
func to_dict() -> Dictionary:
|
||||
return {
|
||||
@@ -54,7 +54,7 @@ var flowers: Array[Flower] = []:
|
||||
set = set_flowers
|
||||
@export var flowers_export: Array[Dictionary] = []:
|
||||
set = set_flowers_export
|
||||
var lesson_buttons: Array[LessonButton] = []:
|
||||
var lesson_buttons: Array[GardenLayoutLessonButton] = []:
|
||||
set = set_lesson_buttons
|
||||
@export var lesson_buttons_export: Array[Dictionary] = []:
|
||||
set = set_lesson_buttons_export
|
||||
@@ -79,11 +79,11 @@ func set_lesson_buttons_export(p_lesson_buttons_export: Array[Dictionary]) -> vo
|
||||
lesson_buttons_export = p_lesson_buttons_export
|
||||
lesson_buttons.clear()
|
||||
for lesson_button_dict: Dictionary in lesson_buttons_export:
|
||||
lesson_buttons.append(LessonButton.from_dict(lesson_button_dict))
|
||||
lesson_buttons.append(GardenLayoutLessonButton.from_dict(lesson_button_dict))
|
||||
|
||||
|
||||
func set_lesson_buttons(p_lesson_buttons: Array[LessonButton]) -> void:
|
||||
func set_lesson_buttons(p_lesson_buttons: Array[GardenLayoutLessonButton]) -> void:
|
||||
lesson_buttons = p_lesson_buttons
|
||||
lesson_buttons_export.clear()
|
||||
for lesson_button: LessonButton in lesson_buttons:
|
||||
for lesson_button: GardenLayoutLessonButton in lesson_buttons:
|
||||
lesson_buttons_export.append(lesson_button.to_dict())
|
||||
|
||||
@@ -3,4 +3,4 @@ extends Resource
|
||||
class_name GardensLayout
|
||||
|
||||
|
||||
@export var gardens: Array[GardenLayout]
|
||||
@export var gardens: Array[GardenLayout] = []
|
||||
|
||||
@@ -17,7 +17,7 @@ enum EducationMethod {
|
||||
@export var account_type: AccountType
|
||||
@export var education_method: EducationMethod
|
||||
var devices_count: int
|
||||
@export var students: Dictionary # int : Array[StudentData]
|
||||
@export var students: Dictionary[int, Array] = {} # int : Array[StudentData]
|
||||
@export var email: String
|
||||
var password: String
|
||||
@export var token: String
|
||||
@@ -50,7 +50,7 @@ func update_from_dict(dict: Dictionary) -> void:
|
||||
students[int(device)] = device_students
|
||||
|
||||
func get_new_code() -> int :
|
||||
var used_codes: Array[int]
|
||||
var used_codes: Array[int] = []
|
||||
for student_array: Array[StudentData] in students.values():
|
||||
for student: StudentData in student_array:
|
||||
used_codes.append(student.code)
|
||||
|
||||
@@ -13,7 +13,7 @@ var consecutives_losses: int = 0
|
||||
@export
|
||||
var consecutives_wins: int = 0
|
||||
@export
|
||||
var history: Array[bool]
|
||||
var history: Array[bool] = []
|
||||
|
||||
func add_game(is_won: bool) -> void:
|
||||
history.append(is_won)
|
||||
|
||||
@@ -4,7 +4,7 @@ class_name UserSpeeches
|
||||
signal speeches_changed
|
||||
|
||||
# Contains the list of speeches already played
|
||||
@export var speeches_played: Array[String]
|
||||
@export var speeches_played: Array[String] = []
|
||||
|
||||
func add_speech(speech: String) -> void:
|
||||
if not speeches_played.has(speech):
|
||||
|
||||
@@ -3,7 +3,6 @@ signal minigame_layout_opened()
|
||||
|
||||
# Namespace
|
||||
const LookAndLearn: = preload("res://sources/look_and_learn/look_and_learn.gd")
|
||||
const LessonButton: = preload("res://sources/lesson_screen/lesson_button.gd")
|
||||
const MinigameLayout: = preload("res://sources/gardens/minigame_layout.gd")
|
||||
const Kalulu: = preload("res://sources/minigames/base/kalulu.gd")
|
||||
|
||||
@@ -23,8 +22,8 @@ const garden_size: int = 2400
|
||||
@export var locked_color: Color = Color("1d2229") #black
|
||||
|
||||
@export_group("Minigames")
|
||||
@export var minigames_scenes: Array[PackedScene]
|
||||
@export var minigames_icons: Array[Texture]
|
||||
@export var minigames_scenes: Array[PackedScene] = []
|
||||
@export var minigames_icons: Array[Texture] = []
|
||||
|
||||
@onready var garden_parent: HBoxContainer = %GardenParent
|
||||
@onready var locked_line: Line2D = $ScrollContainer/LockedLine
|
||||
@@ -54,8 +53,8 @@ const garden_size: int = 2400
|
||||
@onready var help_few_plants_speech: AudioStreamMP3 = Database.load_external_sound(Database.get_kalulu_speech_path("gardens_screen", "help_few_plants"))
|
||||
@onready var help_many_plants_speech: AudioStreamMP3 = Database.load_external_sound(Database.get_kalulu_speech_path("gardens_screen", "help_many_plants"))
|
||||
|
||||
var lessons: Dictionary
|
||||
var points: Array[Array]
|
||||
var lessons: Dictionary = {}
|
||||
var points: Array[Array] = []
|
||||
var is_scrolling: bool = false
|
||||
var scroll_beginning_garden: int = 0
|
||||
var scroll_tween: Tween
|
||||
@@ -67,7 +66,7 @@ var current_garden: Garden
|
||||
var current_button_global_position: Vector2 = Vector2.ZERO
|
||||
var current_button: LessonButton
|
||||
|
||||
static var transition_data: Dictionary
|
||||
static var transition_data: Dictionary = {}
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
@@ -602,7 +601,7 @@ func set_up_path() -> void:
|
||||
break
|
||||
var garden_layout: GardenLayout = gardens_layout.gardens[index]
|
||||
var garden_control: Garden = garden_parent.get_child(index)
|
||||
for button: GardenLayout.LessonButton in garden_layout.lesson_buttons:
|
||||
for button: GardenLayout.GardenLayoutLessonButton in garden_layout.lesson_buttons:
|
||||
var point_position: Vector2 = garden_parent.position + garden_control.position + Vector2(button.position)
|
||||
point_position += garden_control.get_button_size() / 2
|
||||
var point_in_position: Vector2 = Vector2.ZERO
|
||||
|
||||
@@ -53,7 +53,7 @@ func _init_gardens_layout() -> void:
|
||||
garden_layout = gardens_layout.gardens[-1]
|
||||
|
||||
# Add a new lesson button to the garden
|
||||
garden_layout.lesson_buttons.append(GardenLayout.LessonButton.new(Vector2i(0, 0), Vector2i(0, 0)))
|
||||
garden_layout.lesson_buttons.append(GardenLayout.GardenLayoutLessonButton.new(Vector2i(0, 0), Vector2i(0, 0)))
|
||||
garden_layout.lesson_buttons = garden_layout.lesson_buttons
|
||||
|
||||
# Save the configuration
|
||||
@@ -242,7 +242,7 @@ func _on_reset_garden_button_pressed() -> void:
|
||||
|
||||
var lesson_buttons: = gardens_layout.gardens[garden_ind].lesson_buttons
|
||||
for index: int in lesson_buttons.size():
|
||||
lesson_buttons[index] = GardenLayout.LessonButton.new()
|
||||
lesson_buttons[index] = GardenLayout.GardenLayoutLessonButton.new()
|
||||
gardens_layout.gardens[garden_ind].lesson_buttons = lesson_buttons
|
||||
garden.set_lesson_buttons(lesson_buttons)
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ const element_scene: PackedScene = preload("res://sources/language_tool/fish_wor
|
||||
|
||||
@onready var elements_container: VBoxContainer = %ElementsContainer
|
||||
|
||||
var word_list: Array
|
||||
var word_list: Array = []
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
|
||||
@@ -13,7 +13,7 @@ signal delete
|
||||
@onready var image_clear_button: MarginContainer = %ImageClearButton
|
||||
@onready var sound_clear_button: MarginContainer = %SoundClearButton
|
||||
|
||||
var gp: Dictionary
|
||||
var gp: Dictionary = {}
|
||||
var get_image_path: Callable = Database.get_gp_look_and_learn_image_path
|
||||
var get_sound_path: Callable = Database.get_gp_look_and_learn_sound_path
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ extends PanelContainer
|
||||
@onready var number_of_words: Label = %NumberOfWords
|
||||
@onready var number_of_sentences: Label = %NumberOfSentences
|
||||
|
||||
var sentences_by_lesson: Dictionary
|
||||
var sentences_by_lesson: Dictionary = {}
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
|
||||
@@ -490,9 +490,9 @@ func create_book() -> void:
|
||||
"sentence": "sentences_list.csv",
|
||||
}
|
||||
|
||||
var columns: Dictionary[String, PackedStringArray]
|
||||
var all_headers: Array[String]
|
||||
var headers_seen: Dictionary[String, bool]
|
||||
var columns: Dictionary[String, PackedStringArray] = {}
|
||||
var all_headers: Array[String] = []
|
||||
var headers_seen: Dictionary[String, bool] = {}
|
||||
|
||||
for category: String in file_names.keys():
|
||||
var file_path: String = lang_path.path_join(file_names[category])
|
||||
@@ -507,7 +507,7 @@ func create_book() -> void:
|
||||
|
||||
var headers_line: String = read_csv_record(file)
|
||||
var raw_headers: PackedStringArray = parse_csv_line(headers_line)
|
||||
var header_map: Dictionary[String, String] # Original -> Normalized
|
||||
var header_map: Dictionary[String, String] = {} # Original -> Normalized
|
||||
|
||||
# On mesure combien de lignes ont déjà été ajoutées
|
||||
var current_row_count: int = 0
|
||||
@@ -545,7 +545,7 @@ func create_book() -> void:
|
||||
Logger.warn("ProfToolMenu: Ligne malformée ignorée : %s" % values)
|
||||
continue
|
||||
|
||||
var row_dict: Dictionary[String, String]
|
||||
var row_dict: Dictionary[String, String] = {}
|
||||
for index: int in range(values.size()):
|
||||
var original: String = raw_headers[index]
|
||||
var normalized: String = header_map.get(original, original)
|
||||
|
||||
@@ -7,7 +7,7 @@ signal delete()
|
||||
@onready var number_of_points_labels: Label = %NumberOfPointsLabel
|
||||
@onready var color_rect: ColorRect = %ColorRect
|
||||
|
||||
var points: Array[Vector2]
|
||||
var points: Array[Vector2] = []
|
||||
|
||||
|
||||
func add_point(point: Vector2) -> void:
|
||||
@@ -15,7 +15,7 @@ func add_point(point: Vector2) -> void:
|
||||
|
||||
|
||||
func add_point_at(point: Vector2, ind: int) -> void:
|
||||
var pts: Array[Vector2]
|
||||
var pts: Array[Vector2] = []
|
||||
for index: int in range(ind):
|
||||
pts.append(points[index])
|
||||
pts.append(point)
|
||||
|
||||
@@ -18,7 +18,7 @@ var gradient: Gradient
|
||||
|
||||
var current_segment: SegmentBuild
|
||||
var current_button: SegmentPointButton
|
||||
var buttons: Array[SegmentPointButton]
|
||||
var buttons: Array[SegmentPointButton] = []
|
||||
|
||||
|
||||
func reset() -> void:
|
||||
|
||||
@@ -10,7 +10,7 @@ extends Control
|
||||
|
||||
const extension: String = ".csv"
|
||||
|
||||
var letters: Array[String]
|
||||
var letters: Array[String] = []
|
||||
var current_letter: int = -1
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ func _load_segments(segment_container: SegmentContainer, path: String) -> void:
|
||||
var file: FileAccess = FileAccess.open(real_path(path), FileAccess.READ)
|
||||
while not file.eof_reached():
|
||||
var line: PackedStringArray = file.get_csv_line()
|
||||
var points: Array[Vector2]
|
||||
var points: Array[Vector2] = []
|
||||
for element: String in line:
|
||||
if element == "":
|
||||
break
|
||||
|
||||
@@ -8,7 +8,7 @@ signal delete
|
||||
@onready var video_upload_button: = %VideoUploadButton
|
||||
@onready var file_dialog: = $FileDialog
|
||||
|
||||
var gp: Dictionary
|
||||
var gp: Dictionary = {}
|
||||
|
||||
|
||||
func _video_file_selected(file_path: String) -> void:
|
||||
|
||||
@@ -51,7 +51,7 @@ var reading: int = 0:
|
||||
set = set_reading
|
||||
var writing: int = 0:
|
||||
set = set_writing
|
||||
var sub_elements_list: Dictionary
|
||||
var sub_elements_list: Dictionary = {}
|
||||
|
||||
|
||||
func set_exception(p_exception: bool) -> void:
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
extends TextureButton
|
||||
class_name LessonButton
|
||||
|
||||
@export_color_no_alpha var base_color: Color:
|
||||
set = _set_base_color
|
||||
|
||||
@@ -15,16 +15,16 @@ const TracingManager: = preload("res://sources/look_and_learn/tracing_manager.gd
|
||||
@onready var grapheme_particles: GPUParticles2D = $GraphemeParticles
|
||||
|
||||
|
||||
var gp_list: Array[Dictionary]
|
||||
var gp_list: Array[Dictionary] = []
|
||||
var current_video: int = 0
|
||||
var videos: Array[VideoStream]
|
||||
var videos: Array[VideoStream] = []
|
||||
|
||||
var current_image_and_sound: int = 0
|
||||
var images: Array[Texture]
|
||||
var sounds: Array[AudioStream]
|
||||
var images: Array[Texture] = []
|
||||
var sounds: Array[AudioStream] = []
|
||||
|
||||
static var transition_data: Dictionary
|
||||
var gardens_data: Dictionary
|
||||
static var transition_data: Dictionary = {}
|
||||
var gardens_data: Dictionary = {}
|
||||
|
||||
|
||||
var current_tracing: int = 0
|
||||
|
||||
@@ -84,7 +84,7 @@ func _load_tracing(path: String) -> Array:
|
||||
var segments: Array = []
|
||||
var file: FileAccess = FileAccess.open(_real_path(path), FileAccess.READ)
|
||||
while not file.eof_reached():
|
||||
var points: Array[Vector2]
|
||||
var points: Array[Vector2] = []
|
||||
var line: PackedStringArray = file.get_csv_line()
|
||||
for element: String in line:
|
||||
if element == "":
|
||||
|
||||
@@ -21,7 +21,7 @@ var curve_points: PackedVector2Array
|
||||
|
||||
var is_playing: bool = false
|
||||
var is_in_demo: bool = false
|
||||
var touch_positions: Array[Vector2]
|
||||
var touch_positions: Array[Vector2] = []
|
||||
var should_play_effects: bool = false
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ const gardens_scene: PackedScene = preload("res://sources/gardens/gardens.tscn")
|
||||
const Kalulu: = preload("res://sources/minigames/base/kalulu.gd")
|
||||
|
||||
@export var locked_color: Color
|
||||
@export var unlocked_colors: Array[Color]
|
||||
@export var unlocked_colors: Array[Color] = []
|
||||
@export var gardens_layout: GardensLayout
|
||||
|
||||
@onready var kalulu: Kalulu = $Kalulu
|
||||
|
||||
@@ -22,7 +22,7 @@ const icons_textures: Dictionary = {
|
||||
password = value
|
||||
_draw_password()
|
||||
|
||||
@onready var icons: Array[TextureRect]
|
||||
@onready var icons: Array[TextureRect] = []
|
||||
|
||||
func _ready() -> void:
|
||||
_draw_password()
|
||||
|
||||
@@ -6,7 +6,7 @@ const device_button_scene: PackedScene = preload("res://sources/menus/main/devic
|
||||
|
||||
const login_scene_path: String = "res://sources/menus/login/login.tscn"
|
||||
|
||||
@export var colors: Array[Color]
|
||||
@export var colors: Array[Color] = []
|
||||
|
||||
@onready var container: GridContainer = %GridContainer
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ var current_language_path: String
|
||||
var mutex: Mutex
|
||||
var thread: Thread
|
||||
|
||||
var server_version: Dictionary
|
||||
var server_version: Dictionary = {}
|
||||
|
||||
func _ready() -> void:
|
||||
await get_tree().process_frame
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
extends OptionButton
|
||||
|
||||
var items : Array[String]
|
||||
var items : Array[String] = []
|
||||
|
||||
func _ready() -> void:
|
||||
# Adds the supported locales to the field
|
||||
|
||||
@@ -19,7 +19,7 @@ const next_scene_path: String = "res://sources/menus/settings/teacher_settings.t
|
||||
@onready var students_step: PackedScene = preload("res://sources/menus/register/steps/teacher/students_count_step.tscn")
|
||||
@onready var player_step: PackedScene = preload("res://sources/menus/register/steps/parent/player_step.tscn")
|
||||
|
||||
var current_steps: Array[Step]
|
||||
var current_steps: Array[Step] = []
|
||||
|
||||
@onready var register_data: TeacherSettings = TeacherSettings.new()
|
||||
@onready var progress_bar: RegisterProgressBar = %ProgressBar
|
||||
|
||||
@@ -5,7 +5,7 @@ const StudentPanel = preload("res://sources/menus/settings/student_panel.gd")
|
||||
const student_panel_scene: PackedScene = preload("res://sources/menus/settings/student_panel.tscn")
|
||||
|
||||
@export var title: String
|
||||
@export var students: Array[StudentData]
|
||||
@export var students: Array[StudentData] = []
|
||||
|
||||
@onready var title_label: Label = %Title
|
||||
@onready var students_container: GridContainer = %StudentsContainer
|
||||
|
||||
@@ -7,7 +7,7 @@ signal unlocks_changed
|
||||
@export var lesson_GPs: String:
|
||||
set = _set_lesson_GPs
|
||||
|
||||
@export var unlocks: Dictionary
|
||||
@export var unlocks: Dictionary = {}
|
||||
|
||||
@onready var lesson_label: Label = %LessonLabel
|
||||
@onready var gps_label: Label = %GPsLabel
|
||||
|
||||
@@ -18,9 +18,9 @@ const label_settings: LabelSettings = preload("res://resources/themes/minigames_
|
||||
@onready var ants: Node2D = %Ants
|
||||
@onready var words: Node2D = %Words
|
||||
|
||||
var current_sentence: Dictionary
|
||||
var answered: Array[bool]
|
||||
var answers: Array[bool]
|
||||
var current_sentence: Dictionary = {}
|
||||
var answered: Array[bool] = []
|
||||
var answers: Array[bool] = []
|
||||
|
||||
|
||||
func _find_stimuli_and_distractions() -> void:
|
||||
@@ -28,8 +28,8 @@ func _find_stimuli_and_distractions() -> void:
|
||||
if sentences_list.is_empty():
|
||||
return
|
||||
|
||||
var current_lesson_sentences: Array[Dictionary]
|
||||
var previous_lesson_sentences: Array[Dictionary]
|
||||
var current_lesson_sentences: Array[Dictionary] = []
|
||||
var previous_lesson_sentences: Array[Dictionary] = []
|
||||
|
||||
for sentence_in_list: Dictionary in sentences_list:
|
||||
if sentence_in_list.LessonNb == lesson_nb:
|
||||
@@ -98,7 +98,7 @@ func _get_new_sentence() -> void:
|
||||
|
||||
|
||||
func _next_sentence() -> void:
|
||||
var nodes: Array[Node]
|
||||
var nodes: Array[Node] = []
|
||||
nodes.append_array(sentence_container.get_children())
|
||||
nodes.append_array(words.get_children())
|
||||
for node: Node in nodes:
|
||||
@@ -118,7 +118,7 @@ func _next_sentence() -> void:
|
||||
|
||||
var current_words: PackedStringArray = (current_sentence.Sentence as String).replace("'", " ' ").replace("-", " - ").split(" ")
|
||||
|
||||
var inds_to_remove: Array[int]
|
||||
var inds_to_remove: Array[int] = []
|
||||
for index: int in range(1, current_words.size()):
|
||||
var word: String = current_words[index]
|
||||
if word in ["?", "!", ":"]:
|
||||
|
||||
@@ -103,8 +103,8 @@ var win_kalulu_speech: AudioStreamMP3
|
||||
var lose_kalulu_speech: AudioStreamMP3
|
||||
|
||||
# data to go back to the right place in gardens
|
||||
var gardens_data: Dictionary
|
||||
static var transition_data: Dictionary
|
||||
var gardens_data: Dictionary = {}
|
||||
static var transition_data: Dictionary = {}
|
||||
|
||||
#region Initialisation
|
||||
|
||||
|
||||
@@ -35,8 +35,8 @@ func _find_stimuli_and_distractions() -> void:
|
||||
if not all_syllables:
|
||||
return
|
||||
|
||||
var current_lesson_stimuli: Array[Dictionary]
|
||||
var previous_lesson_stimuli: Array[Dictionary]
|
||||
var current_lesson_stimuli: Array[Dictionary] = []
|
||||
var previous_lesson_stimuli: Array[Dictionary] = []
|
||||
|
||||
# Find the syllables for current lesson
|
||||
for syllable: Dictionary in all_syllables:
|
||||
@@ -203,7 +203,7 @@ func _on_stimulus_pressed(stimulus : Dictionary, _node : Node) -> bool:
|
||||
else:
|
||||
var right_answer_GPs: Array[Dictionary] = _get_current_stimulus().GPs
|
||||
|
||||
var stimulus_GPs: Array[Dictionary]
|
||||
var stimulus_GPs: Array[Dictionary] = []
|
||||
if stimulus.has("GPs"):
|
||||
stimulus_GPs = stimulus.GPs
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ class_name WordsMinigame
|
||||
var current_word_progression: int = 0: set = _set_current_word_progression
|
||||
var max_word_progression: int = 0
|
||||
|
||||
var current_gp_distractors_queue: Array[Dictionary]
|
||||
var current_gp_distractors_queue: Array[Dictionary] = []
|
||||
|
||||
# Find the stimuli and distractions of the minigame.
|
||||
func _find_stimuli_and_distractions() -> void:
|
||||
@@ -21,8 +21,8 @@ func _find_stimuli_and_distractions() -> void:
|
||||
if words_list.is_empty():
|
||||
return
|
||||
|
||||
var current_lesson_words: Array[Dictionary]
|
||||
var previous_lesson_words: Array[Dictionary]
|
||||
var current_lesson_words: Array[Dictionary] = []
|
||||
var previous_lesson_words: Array[Dictionary] = []
|
||||
|
||||
for word: Dictionary in words_list:
|
||||
if not FileAccess.file_exists(Database.get_word_sound_path(word)):
|
||||
@@ -82,7 +82,7 @@ func _find_stimuli_and_distractions() -> void:
|
||||
# Find the GPs and distractors for each word
|
||||
for stimulus: Dictionary in stimuli:
|
||||
stimulus.GPs = Database.get_GP_from_word(stimulus.ID as int)
|
||||
var grapheme_distractions: Array
|
||||
var grapheme_distractions: Array = []
|
||||
for GP: Dictionary in stimulus.GPs:
|
||||
grapheme_distractions.append(Database.get_distractors_for_grapheme(GP.ID as int, lesson_nb))
|
||||
distractions.append(grapheme_distractions)
|
||||
|
||||
@@ -8,7 +8,7 @@ signal pressed(gp: Dictionary)
|
||||
@onready var highlight_fx: HighlightFX = $HighlightFX
|
||||
@onready var wrong_fx: WrongFX = $WrongFX
|
||||
|
||||
var gp: Dictionary:
|
||||
var gp: Dictionary = {}:
|
||||
set(value):
|
||||
gp = value
|
||||
if gp.has("Grapheme"):
|
||||
|
||||
@@ -5,7 +5,7 @@ extends Node2D
|
||||
@onready var label: Label = $Label
|
||||
@onready var right_FX: RightFX = $RightFX
|
||||
|
||||
var gp: Dictionary:
|
||||
var gp: Dictionary = {}:
|
||||
set(value):
|
||||
gp = value
|
||||
if gp.has("Grapheme"):
|
||||
|
||||
@@ -125,7 +125,7 @@ func _on_berry_timer_timeout() -> void:
|
||||
var branch: Branch = branches[index]
|
||||
|
||||
# Define if the berry is a stimulus or a distraction
|
||||
var gp: Dictionary
|
||||
var gp: Dictionary = {}
|
||||
var is_stimulus: bool = randf() < _get_difficulty_settings().stimuli_ratio
|
||||
if is_stimulus:
|
||||
gp = _get_GP()
|
||||
|
||||
@@ -26,8 +26,8 @@ const fish_texture_rect_scene: PackedScene = preload("res://sources/minigames/fi
|
||||
@export var max_words_count: int = 15
|
||||
|
||||
var tween: Tween
|
||||
var words_to_present: Array[String]
|
||||
var words_to_present_next: Array[String]
|
||||
var words_to_present: Array[String] = []
|
||||
var words_to_present_next: Array[String] = []
|
||||
var progress_gauge_max_margin: float = 0.95
|
||||
var total_number_of_words: int = 30
|
||||
var tutorial_count: int = 0
|
||||
|
||||
@@ -10,7 +10,7 @@ signal disappeared()
|
||||
@onready var right_fx: RightFX = %RightFX
|
||||
@onready var wrong_fx: WrongFX = %WrongFX
|
||||
|
||||
var stimulus: Dictionary:
|
||||
var stimulus: Dictionary = {}:
|
||||
set = _set_stimulus
|
||||
var disabled: bool = false:
|
||||
set = _set_disabled
|
||||
|
||||
@@ -38,7 +38,7 @@ const scale_factor : float = 0.2
|
||||
@onready var right_fx: RightFX = %RightFX
|
||||
@onready var wrong_fx: WrongFX = %WrongFX
|
||||
|
||||
var stimulus: Dictionary :
|
||||
var stimulus: Dictionary = {}:
|
||||
set(value):
|
||||
stimulus = value
|
||||
if label:
|
||||
|
||||
@@ -24,7 +24,7 @@ var stunned: bool = false:
|
||||
locked = true
|
||||
|
||||
|
||||
var stimulus: Dictionary :
|
||||
var stimulus: Dictionary = {}:
|
||||
set(value):
|
||||
stimulus = value
|
||||
if value:
|
||||
|
||||
@@ -35,7 +35,7 @@ signal pressed()
|
||||
@onready var right_FX: RightFX = $RightFX
|
||||
@onready var wrong_FX: WrongFX = $WrongFX
|
||||
|
||||
var stimulus: Dictionary :
|
||||
var stimulus: Dictionary = {}:
|
||||
set(value):
|
||||
stimulus = value
|
||||
var grapheme: String = value.Grapheme as String
|
||||
|
||||
@@ -40,9 +40,9 @@ const audio_streams: Array[AudioStreamMP3] = [
|
||||
fly_away_position_2.global_position
|
||||
]
|
||||
|
||||
var possible_branch_positions: Array[Vector2]
|
||||
var parakeets: Array[Parakeet]
|
||||
var selected: Array[Parakeet]
|
||||
var possible_branch_positions: Array[Vector2] = []
|
||||
var parakeets: Array[Parakeet] = []
|
||||
var selected: Array[Parakeet] = []
|
||||
var state: State = State.Locked
|
||||
|
||||
const difficulty_settings: Dictionary[int, Dictionary] = {
|
||||
|
||||
@@ -6,7 +6,7 @@ signal pressed(pos: Vector2)
|
||||
@onready var wrong_fx: WrongFX = %WrongFX
|
||||
@onready var button: Button = $Button
|
||||
|
||||
var gp: Dictionary
|
||||
var gp: Dictionary = {}
|
||||
var capitalized: bool = false
|
||||
var is_pressed: bool = false
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@ func _find_stimuli_and_distractions() -> void:
|
||||
|
||||
if sentences_list.is_empty():
|
||||
return
|
||||
var current_lesson_sentences: Array[Dictionary]
|
||||
var previous_lesson_sentences: Array[Dictionary]
|
||||
var current_lesson_sentences: Array[Dictionary] = []
|
||||
var previous_lesson_sentences: Array[Dictionary] = []
|
||||
|
||||
for sentence: Dictionary in sentences_list:
|
||||
if sentence.LessonNb == lesson_nb:
|
||||
|
||||
@@ -3,7 +3,7 @@ extends Area2D
|
||||
@onready var label : Label = $Label
|
||||
@onready var collision: CollisionPolygon2D = $CollisionPolygon2D
|
||||
|
||||
var stimulus: Dictionary:
|
||||
var stimulus: Dictionary = {}:
|
||||
set(value):
|
||||
stimulus = value
|
||||
progress = 0
|
||||
|
||||
@@ -14,7 +14,7 @@ signal animation_changed(position: Vector2)
|
||||
@onready var delete_timer: Timer = $DeleteTimer
|
||||
@onready var audio_stream_player: AudioStreamPlayer2D = $AudioStreamPlayer2D
|
||||
|
||||
var gp: Dictionary:
|
||||
var gp: Dictionary = {}:
|
||||
set(value):
|
||||
gp = value
|
||||
if gp and gp.has("Grapheme"):
|
||||
|
||||
@@ -10,7 +10,7 @@ var is_completed: bool = false
|
||||
signal _join()
|
||||
var _ended_count: int = -1
|
||||
|
||||
var return_value: Array
|
||||
var return_value: Array = []
|
||||
|
||||
|
||||
func resumable_call(callable: Callable) -> void:
|
||||
|
||||
@@ -36,7 +36,7 @@ var db_path: String = base_path + language + "/language.db":
|
||||
connect_to_db()
|
||||
|
||||
var words_path: String = base_path + language + "/words/"
|
||||
var additional_word_list: Dictionary
|
||||
var additional_word_list: Dictionary = {}
|
||||
|
||||
@onready var db: SQLite = SQLite.new()
|
||||
var is_open: bool = false
|
||||
@@ -86,7 +86,7 @@ func get_exercice_for_lesson(lesson_nb: int) -> Array[int]:
|
||||
WHERE LessonNB == " + str(lesson_nb)
|
||||
db.query(query)
|
||||
|
||||
#var answer: Array[String]
|
||||
#var answer: Array[String] = []
|
||||
#for res in Database.db.query_result:
|
||||
# Database.db.query("Select Type FROM ExerciseTypes WHERE ID == " + str(res.Exercise1))
|
||||
# answer.append(Database.db.query_result[0].Type)
|
||||
@@ -96,7 +96,7 @@ func get_exercice_for_lesson(lesson_nb: int) -> Array[int]:
|
||||
# answer.append(Database.db.query_result[0].Type)
|
||||
#return answer
|
||||
|
||||
var result: Array[int]
|
||||
var result: Array[int] = []
|
||||
for element: Dictionary in db.query_result:
|
||||
result.append(element.Exercise1)
|
||||
result.append(element.Exercise2)
|
||||
@@ -578,7 +578,7 @@ func _phoneme_to_string(phoneme: String) -> String:
|
||||
# Returns an array containing an int followed by an array of int
|
||||
func _import_word_from_csv(ortho: String, gpmatch: String, is_word: bool = true) -> Array[Variant]:
|
||||
var gp_list: PackedStringArray = gpmatch.trim_prefix("(").trim_suffix(")").split(".")
|
||||
var gp_ids: Array[int]
|
||||
var gp_ids: Array[int] = []
|
||||
for gp: String in gp_list:
|
||||
var split: PackedStringArray = gp.split("-")
|
||||
var grapheme: String = split[0]
|
||||
|
||||
@@ -31,7 +31,7 @@ func submit_student_metrics(level: int, elapsed_time: int) -> void:
|
||||
|
||||
# Response from the last request
|
||||
var code: int
|
||||
var json: Dictionary
|
||||
var json: Dictionary = {}
|
||||
|
||||
|
||||
func check_email(email: String) -> Dictionary:
|
||||
|
||||
@@ -4,7 +4,7 @@ class_name FormBinder
|
||||
|
||||
@export var data : Resource
|
||||
|
||||
var _control_binder_map: Dictionary[Control, ControlBinder]
|
||||
var _control_binder_map: Dictionary[Control, ControlBinder] = {}
|
||||
|
||||
func _ready() -> void:
|
||||
_find_binders(self)
|
||||
|
||||
@@ -18,7 +18,7 @@ static func bezier_square_error(current_points: Array, ref_points: Array) -> flo
|
||||
|
||||
|
||||
static func bezier_sampling(points: Array, number_of_samples: int) -> Array[Vector2]:
|
||||
var sample_points: Array[Vector2]
|
||||
var sample_points: Array[Vector2] = []
|
||||
for index: int in range(number_of_samples + 1):
|
||||
var sample: Vector2 = bezier(float(index) / float(number_of_samples), points)
|
||||
sample_points.append(sample)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
extends Control
|
||||
class_name SpriteControl
|
||||
|
||||
@export var sprites: Array[CanvasItem]:
|
||||
@export var sprites: Array[CanvasItem] = []:
|
||||
set = set_sprites
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user