Cleaning, typing, renaming
This commit is contained in:
@@ -68,12 +68,12 @@ func set_flowers(p_flowers: Array[GardenLayout.Flower], default_size: FlowerSize
|
||||
|
||||
|
||||
func update_flowers() -> void:
|
||||
for i in flowers.size():
|
||||
if i >= flower_controls.size():
|
||||
for index: int in flowers.size():
|
||||
if index >= flower_controls.size():
|
||||
break
|
||||
var flower: = flowers[i]
|
||||
var flower_scene: = flower_controls[i]
|
||||
var flower_size: String = FlowerSizes.keys()[flowers_sizes[i]]
|
||||
var flower: = flowers[index]
|
||||
var flower_scene: = flower_controls[index]
|
||||
var flower_size: String = FlowerSizes.keys()[flowers_sizes[index]]
|
||||
|
||||
flower_scene.texture = load(flower_path_model % [flower.color+1, flower.type+1, flower_size])
|
||||
flower_scene.size = flower_scene.get_combined_minimum_size() * 3
|
||||
@@ -84,11 +84,11 @@ func update_flowers() -> void:
|
||||
func set_lesson_buttons(p_lesson_buttons: Array[GardenLayout.LessonButton]) -> void:
|
||||
for lesson_button_control in lesson_button_controls:
|
||||
lesson_button_control.visible = false
|
||||
for i in p_lesson_buttons.size():
|
||||
if i >= lesson_button_controls.size():
|
||||
for index: int in p_lesson_buttons.size():
|
||||
if index >= lesson_button_controls.size():
|
||||
break
|
||||
var lesson_button: = p_lesson_buttons[i]
|
||||
var lesson_button_control: = lesson_button_controls[i]
|
||||
var lesson_button: = p_lesson_buttons[index]
|
||||
var lesson_button_control: = lesson_button_controls[index]
|
||||
lesson_button_control.position = Vector2(lesson_button.position)
|
||||
lesson_button_control.visible = true
|
||||
lesson_button_control.pivot_offset = lesson_button_control.size / 2
|
||||
|
||||
@@ -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