Cleaning, typing, renaming
This commit is contained in:
@@ -26,9 +26,9 @@ func init_unlocks() -> bool:
|
||||
# Verifiy the lessons
|
||||
var number_of_lessons: = Database.get_lessons_count()
|
||||
if unlocks.size() != number_of_lessons:
|
||||
for i in number_of_lessons:
|
||||
if not unlocks.has(i+1):
|
||||
unlocks[i + 1] = {
|
||||
for index: int in number_of_lessons:
|
||||
if not unlocks.has(index+1):
|
||||
unlocks[index + 1] = {
|
||||
"look_and_learn": Status.Locked,
|
||||
"games": [
|
||||
Status.Locked,
|
||||
@@ -51,10 +51,10 @@ func init_unlocks() -> bool:
|
||||
|
||||
|
||||
func get_max_unlocked_lesson() -> int:
|
||||
var max_unlocked_level: = 1
|
||||
for i in range(unlocks.size()):
|
||||
if unlocks[i + 1]["look_and_learn"] >= Status.Unlocked:
|
||||
max_unlocked_level = i
|
||||
var max_unlocked_level: int = 1
|
||||
for index: int in range(unlocks.size()):
|
||||
if unlocks[index + 1]["look_and_learn"] >= Status.Unlocked:
|
||||
max_unlocked_level = index
|
||||
else:
|
||||
break
|
||||
|
||||
@@ -72,8 +72,8 @@ func look_and_learn_completed(lesson_number: int) -> bool:
|
||||
|
||||
unlocks[lesson_number]["look_and_learn"] = Status.Completed
|
||||
|
||||
for i in range(3):
|
||||
unlocks[lesson_number]["games"][i] = Status.Unlocked
|
||||
for index: int in range(3):
|
||||
unlocks[lesson_number]["games"][index] = Status.Unlocked
|
||||
|
||||
unlocks_changed.emit()
|
||||
return true
|
||||
@@ -88,8 +88,8 @@ func game_completed(lesson_number: int, game_number: int) -> bool:
|
||||
unlocks[lesson_number]["games"][game_number] = Status.Completed
|
||||
|
||||
var all_completed: = true
|
||||
for i in range(3):
|
||||
all_completed = all_completed and unlocks[lesson_number]["games"][i] == Status.Completed
|
||||
for index: int in range(3):
|
||||
all_completed = all_completed and unlocks[lesson_number]["games"][index] == Status.Completed
|
||||
|
||||
if all_completed and unlocks.has(lesson_number + 1):
|
||||
unlocks[lesson_number + 1]["look_and_learn"] = Status.Unlocked
|
||||
|
||||
@@ -28,7 +28,7 @@ func update_scores(minigame_scores: Dictionary) -> void:
|
||||
if not minigame_scores:
|
||||
return
|
||||
|
||||
for ID : int in minigame_scores.keys():
|
||||
for ID: int in minigame_scores.keys():
|
||||
var new_score: = 0
|
||||
if gps_scores.has(ID):
|
||||
new_score += gps_scores[ID]
|
||||
|
||||
Reference in New Issue
Block a user