Clean code naming convention V3
This commit is contained in:
@@ -142,10 +142,10 @@ func get_GP_for_lesson(lesson_nb: int, distinct: bool, only_new: bool = false, o
|
||||
var result: Array[Dictionary] = db.query_result
|
||||
|
||||
if with_other_phonemes:
|
||||
for GP: Dictionary in result:
|
||||
if GP.OtherPhonemes:
|
||||
var phonemes: String = GP.OtherPhonemes
|
||||
GP.OtherPhonemes = phonemes.split(",")
|
||||
for gp: Dictionary in result:
|
||||
if gp.OtherPhonemes:
|
||||
var phonemes: String = gp.OtherPhonemes
|
||||
gp.OtherPhonemes = phonemes.split(",")
|
||||
|
||||
return result
|
||||
|
||||
@@ -155,7 +155,7 @@ func get_GPs_from_syllable(syllable_ID: int) -> Array[Dictionary]:
|
||||
return db.query_result
|
||||
|
||||
|
||||
func get_GP_from_word(ID: int) -> Array:
|
||||
func get_gp_from_word(ID: int) -> Array:
|
||||
db.query_with_bindings("SELECT GPs.* FROM Words INNER JOIN GPsInWords ON Words.ID = GPsInWords.WordID AND Words.ID=? INNER JOIN GPs WHERE GPs.ID = GPsInWords.GPID ORDER BY Position", [ID])
|
||||
return db.query_result
|
||||
|
||||
@@ -200,8 +200,8 @@ func get_syllables_for_lesson(lesson_nb: int, only_new: bool = false) -> Array[D
|
||||
for syllable: Dictionary in res:
|
||||
syllable.GPs = get_GPs_from_syllable(syllable.ID as int)
|
||||
var phonemes: Array[String] = []
|
||||
for GP: Dictionary in syllable.GPs:
|
||||
phonemes.append(GP.Phoneme)
|
||||
for gp: Dictionary in syllable.GPs:
|
||||
phonemes.append(gp.Phoneme)
|
||||
syllable.Phoneme = "-".join(phonemes)
|
||||
|
||||
return res
|
||||
@@ -469,11 +469,11 @@ func get_audio_stream_for_path(path: String) -> AudioStream:
|
||||
|
||||
|
||||
func get_audio_stream_for_word(ID: int) -> AudioStream:
|
||||
var GPs: Array = get_GP_from_word(ID)
|
||||
var file_name: String = _phoneme_to_string(GPs[0].Phoneme as String)
|
||||
for index: int in range(1, GPs.size()):
|
||||
var GP: Dictionary = GPs[index]
|
||||
file_name += "-" + _phoneme_to_string(GP.Phoneme as String)
|
||||
var gps: Array = get_gp_from_word(ID)
|
||||
var file_name: String = _phoneme_to_string(gps[0].Phoneme as String)
|
||||
for index: int in range(1, gps.size()):
|
||||
var gp: Dictionary = gps[index]
|
||||
file_name += "-" + _phoneme_to_string(gp.Phoneme as String)
|
||||
file_name += ".mp3"
|
||||
return load(words_path + file_name)
|
||||
|
||||
|
||||
@@ -221,7 +221,7 @@ func _load_device_settings() -> void:
|
||||
_save_device_settings()
|
||||
if not _device_settings:
|
||||
_device_settings = DeviceSettings.new()
|
||||
_device_settings.init_OS_language()
|
||||
_device_settings.init_os_language()
|
||||
_save_device_settings()
|
||||
|
||||
func _save_device_settings() -> void:
|
||||
@@ -489,11 +489,11 @@ func get_student_remediation_data(student_code: int) -> UserRemediation:
|
||||
func _save_student_remediation() -> void:
|
||||
ResourceSaver.save(_student_remediation, _get_student_remediation_path())
|
||||
|
||||
func get_GP_remediation_score(GPID: int) -> int:
|
||||
func get_gp_remediation_score(gp_id: int) -> int:
|
||||
if not _student_remediation:
|
||||
#push_warning("No student remediation data for " + str(student))
|
||||
return 0
|
||||
return _student_remediation.get_gp_score(GPID)
|
||||
return _student_remediation.get_gp_score(gp_id)
|
||||
|
||||
func update_remediation_scores(scores: Dictionary) -> void:
|
||||
if not _student_remediation:
|
||||
@@ -580,22 +580,22 @@ func _delete_dir(path: String) -> void:
|
||||
dir.remove(subfolder)
|
||||
|
||||
func move_user_device_folder(old_device: String, new_device: String, student_code: int) -> void:
|
||||
var parentDirPath: String = "user://".path_join(_device_settings.teacher)
|
||||
var parentDir: DirAccess = DirAccess.open(parentDirPath)
|
||||
var oldChildDir: String = old_device.path_join(_device_settings.language).path_join(str(student_code))
|
||||
var newChildDir: String = new_device.path_join(_device_settings.language).path_join(str(student_code))
|
||||
var newParentDir: String = newChildDir.get_base_dir() # = "2/fr_FR"
|
||||
if not parentDir.dir_exists(newParentDir):
|
||||
var err: Error = parentDir.make_dir_recursive(newParentDir)
|
||||
var parent_dir_path: String = "user://".path_join(_device_settings.teacher)
|
||||
var parent_dir: DirAccess = DirAccess.open(parent_dir_path)
|
||||
var old_child_dir: String = old_device.path_join(_device_settings.language).path_join(str(student_code))
|
||||
var new_child_dir: String = new_device.path_join(_device_settings.language).path_join(str(student_code))
|
||||
var new_parent_dir: String = new_child_dir.get_base_dir() # = "2/fr_FR"
|
||||
if not parent_dir.dir_exists(new_parent_dir):
|
||||
var err: Error = parent_dir.make_dir_recursive(new_parent_dir)
|
||||
if err != OK:
|
||||
push_error("UserDataManager: Cannot create parent folder: %s" % error_string(err))
|
||||
return
|
||||
if parentDir.dir_exists(str(oldChildDir)):
|
||||
var err: Error = parentDir.rename(oldChildDir, newChildDir)
|
||||
if parent_dir.dir_exists(str(old_child_dir)):
|
||||
var err: Error = parent_dir.rename(old_child_dir, new_child_dir)
|
||||
if err != OK:
|
||||
Logger.error("UserDataManager: Error while renaming folder: %s" % error_string(err))
|
||||
else:
|
||||
Logger.error("UserDataManager: The folder '%s' cannot be moved because it does no exists in %s." % [old_device, parentDirPath])
|
||||
Logger.error("UserDataManager: The folder '%s' cannot be moved because it does no exists in %s." % [old_device, parent_dir_path])
|
||||
return
|
||||
save_teacher_settings()
|
||||
|
||||
|
||||
@@ -71,17 +71,17 @@ func synchronize() -> void:
|
||||
set_loading_bar_text("SYNCHRONIZATION_ERROR")
|
||||
stop_sync()
|
||||
return
|
||||
var serverUnixTimeUser: int = Time.get_unix_time_from_datetime_string(user.last_modified as String)
|
||||
var localUserStringTime: String = UserDataManager.teacher_settings.last_modified
|
||||
var localUnixTimeUser: int = 0
|
||||
if localUserStringTime != "":
|
||||
localUnixTimeUser = Time.get_unix_time_from_datetime_string(localUserStringTime)
|
||||
var server_unix_time_user: int = Time.get_unix_time_from_datetime_string(user.last_modified as String)
|
||||
var local_user_string_time: String = UserDataManager.teacher_settings.last_modified
|
||||
var local_unix_time_user: int = 0
|
||||
if local_user_string_time != "":
|
||||
local_unix_time_user = Time.get_unix_time_from_datetime_string(local_user_string_time)
|
||||
var need_update_user: UpdateNeeded = UpdateNeeded.Nothing
|
||||
if localUnixTimeUser == serverUnixTimeUser:
|
||||
if local_unix_time_user == server_unix_time_user:
|
||||
Logger.trace("UserDataBaseSynchronizer: User data timestamp is the same in local and on server. No synchronization necessary")
|
||||
elif localUnixTimeUser > serverUnixTimeUser:
|
||||
elif local_unix_time_user > server_unix_time_user:
|
||||
need_update_user = UpdateNeeded.FromLocal
|
||||
else: # localUnixTimeUser < serverUnixTimeUser
|
||||
else: # local_unix_time_user < server_unix_time_user
|
||||
need_update_user = UpdateNeeded.FromServer
|
||||
|
||||
await set_loading_bar_progression(40.0)
|
||||
|
||||
@@ -18,10 +18,10 @@ var count: int = 0
|
||||
|
||||
func start() -> void:
|
||||
count = 0
|
||||
_on_FireDelayTimer_timeout()
|
||||
_on_fire_delay_timer_timeout()
|
||||
|
||||
|
||||
func _on_FireDelayTimer_timeout() -> void:
|
||||
func _on_fire_delay_timer_timeout() -> void:
|
||||
if count >= number_of_rockets:
|
||||
finished.emit()
|
||||
return
|
||||
|
||||
@@ -77,4 +77,4 @@ position = Vector2(2252, 492)
|
||||
|
||||
[node name="Rockets" type="Node2D" parent="."]
|
||||
|
||||
[connection signal="timeout" from="FireDelayTimer" to="." method="_on_FireDelayTimer_timeout"]
|
||||
[connection signal="timeout" from="FireDelayTimer" to="." method="_on_fire_delay_timer_timeout"]
|
||||
|
||||
@@ -82,7 +82,7 @@ func create_path(start_point: Vector2, end_point: Vector2) -> void:
|
||||
current = new
|
||||
|
||||
|
||||
func _on_TravelingTimer_timeout() -> void:
|
||||
func _on_traveling_timer_timeout() -> void:
|
||||
rocket.visible = false
|
||||
explosion_timer.start()
|
||||
blast_audio_player.play()
|
||||
@@ -90,5 +90,5 @@ func _on_TravelingTimer_timeout() -> void:
|
||||
particles.emitting = true
|
||||
|
||||
|
||||
func _on_ExplosionTimer_timeout() -> void:
|
||||
func _on_explosion_timer_timeout() -> void:
|
||||
queue_free()
|
||||
|
||||
@@ -155,38 +155,38 @@ region_rect = Rect2(0, 0, 113, 254)
|
||||
[node name="Trail" type="GPUParticles2D" parent="PathFollow2D/Rocket"]
|
||||
position = Vector2(12.9997, 110)
|
||||
amount = 16
|
||||
process_material = SubResource("9")
|
||||
texture = ExtResource("1")
|
||||
lifetime = 0.25
|
||||
process_material = SubResource("9")
|
||||
|
||||
[node name="ExplosionParticles" type="Node2D" parent="PathFollow2D"]
|
||||
|
||||
[node name="DustClouds" type="GPUParticles2D" parent="PathFollow2D/ExplosionParticles"]
|
||||
emitting = false
|
||||
amount = 32
|
||||
process_material = SubResource("ParticleProcessMaterial_a7mq3")
|
||||
texture = ExtResource("5")
|
||||
lifetime = 0.5
|
||||
one_shot = true
|
||||
explosiveness = 1.0
|
||||
process_material = SubResource("ParticleProcessMaterial_a7mq3")
|
||||
|
||||
[node name="Explosion" type="GPUParticles2D" parent="PathFollow2D/ExplosionParticles"]
|
||||
material = SubResource("24")
|
||||
emitting = false
|
||||
process_material = SubResource("27")
|
||||
texture = ExtResource("7")
|
||||
lifetime = 0.5
|
||||
one_shot = true
|
||||
explosiveness = 0.8
|
||||
process_material = SubResource("27")
|
||||
|
||||
[node name="Sparkles" type="GPUParticles2D" parent="PathFollow2D/ExplosionParticles"]
|
||||
material = SubResource("22")
|
||||
emitting = false
|
||||
amount = 64
|
||||
process_material = SubResource("23")
|
||||
texture = ExtResource("6")
|
||||
one_shot = true
|
||||
explosiveness = 1.0
|
||||
process_material = SubResource("23")
|
||||
|
||||
[connection signal="timeout" from="TravelingTimer" to="." method="_on_TravelingTimer_timeout"]
|
||||
[connection signal="timeout" from="ExplosionTimer" to="." method="_on_ExplosionTimer_timeout"]
|
||||
[connection signal="timeout" from="TravelingTimer" to="." method="_on_traveling_timer_timeout"]
|
||||
[connection signal="timeout" from="ExplosionTimer" to="." method="_on_explosion_timer_timeout"]
|
||||
|
||||
@@ -10,12 +10,12 @@ func set_sprites(p_sprites: Array[CanvasItem]) -> void:
|
||||
for p_sprite: CanvasItem in p_sprites:
|
||||
if p_sprite:
|
||||
if p_sprite is Sprite2D:
|
||||
var p_sprite_2D: Sprite2D = p_sprite
|
||||
if not p_sprite_2D.texture:
|
||||
var p_sprite_2d: Sprite2D = p_sprite
|
||||
if not p_sprite_2d.texture:
|
||||
return
|
||||
elif p_sprite is AnimatedSprite2D:
|
||||
var p_animated_sprite_2D: AnimatedSprite2D = p_sprite
|
||||
if not p_animated_sprite_2D.sprite_frames:
|
||||
var p_animated_sprite_2d: AnimatedSprite2D = p_sprite
|
||||
if not p_animated_sprite_2d.sprite_frames:
|
||||
return
|
||||
else:
|
||||
return
|
||||
@@ -30,16 +30,16 @@ func _on_resized() -> void:
|
||||
func _resize_sprites() -> void:
|
||||
for sprite: CanvasItem in sprites:
|
||||
if sprite is Sprite2D:
|
||||
var sprite_2D: Sprite2D = sprite
|
||||
if sprite_2D.texture:
|
||||
sprite_2D.centered = false
|
||||
sprite_2D.scale = size / sprite_2D.texture.get_size()
|
||||
var sprite_2d: Sprite2D = sprite
|
||||
if sprite_2d.texture:
|
||||
sprite_2d.centered = false
|
||||
sprite_2d.scale = size / sprite_2d.texture.get_size()
|
||||
elif sprite is AnimatedSprite2D:
|
||||
var animated_sprite_2D: AnimatedSprite2D = sprite
|
||||
if animated_sprite_2D.sprite_frames:
|
||||
var texture: Texture2D = animated_sprite_2D.sprite_frames.get_frame_texture(animated_sprite_2D.animation, animated_sprite_2D.frame)
|
||||
animated_sprite_2D.centered = false
|
||||
animated_sprite_2D.scale = size / texture.get_size()
|
||||
var animated_sprite_2d: AnimatedSprite2D = sprite
|
||||
if animated_sprite_2d.sprite_frames:
|
||||
var texture: Texture2D = animated_sprite_2d.sprite_frames.get_frame_texture(animated_sprite_2d.animation, animated_sprite_2d.frame)
|
||||
animated_sprite_2d.centered = false
|
||||
animated_sprite_2d.scale = size / texture.get_size()
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
|
||||
Reference in New Issue
Block a user