Auto sync every 5 minutes of play

This commit is contained in:
Adrien Ufferte
2025-06-06 16:07:37 +02:00
parent 298a2bf863
commit 24d094d01b
6 changed files with 43 additions and 11 deletions
+2
View File
@@ -68,6 +68,8 @@ const Kalulu: = preload("res://sources/minigames/base/kalulu.gd")
@onready var help_speech: AudioStream = Database.load_external_sound(Database.get_kalulu_speech_path("brain_screen", "help"))
func _ready() -> void:
UserDataManager.start_synchronization_timer()
for index: int in range(garden_buttons.size()):
garden_buttons[index].pressed.connect(_on_garden_button_pressed.bind(index))
@@ -58,8 +58,6 @@ func _ready() -> void:
_show_error(1)
return
# TODO WE REMOVED CONFIGURATION AT LAUNCH, BUT WE DID NOT TEST REGISTER / LOGIN
# Gets the info of the language pack on the server
var res: Dictionary = await ServerManager.get_language_pack_url(device_language)
if res.code == 200:
+3 -1
View File
@@ -21,6 +21,8 @@ var wrong_password_speech: AudioStream
var right_password_speech: AudioStream
func _ready() -> void:
UserDataManager.stop_synchronization_timer()
# Check if the database is connected, if not go to loader
if not Database.is_open:
await get_tree().process_frame
@@ -44,7 +46,7 @@ func _ready() -> void:
func _on_code_keyboard_password_entered(password: String) -> void:
if UserDataManager.login_student(password):
UserDataManager.user_database_synchronizer.on_synchronize_button_pressed()
UserDataManager.user_database_synchronizer.synchronize()
kalulu_button.hide()
await kalulu.play_kalulu_speech(right_password_speech)
await OpeningCurtain.close()
+1 -1
View File
@@ -189,7 +189,7 @@ func update_student_name(student_code: int, student_name: String) -> void:
#region Synchronization
func _on_synchronize_button_pressed() -> void:
UserDataManager.user_database_synchronizer.on_synchronize_button_pressed()
UserDataManager.user_database_synchronizer.synchronize()
func _on_loading_popup_ok() -> void: