Minigame selection screen + wired everything + bug corrections
This commit is contained in:
@@ -3,6 +3,9 @@ extends Control
|
||||
const garden_scene: = preload("res://resources/gardens/garden.tscn")
|
||||
const garden_size: = 2400
|
||||
|
||||
const MinigameSelection: = preload("res://sources/lesson_screen/minigame_selection.gd")
|
||||
const minigame_selection_scene: = preload("res://sources/lesson_screen/minigame_selection.tscn")
|
||||
|
||||
@export var gardens_layout: GardensLayout:
|
||||
set = set_gardens_layout
|
||||
|
||||
@@ -20,6 +23,7 @@ var tween: Tween
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
OpeningCurtain.open()
|
||||
if not gardens_layout:
|
||||
gardens_layout = load("res://resources/gardens/gardens_layout.tres")
|
||||
else:
|
||||
@@ -98,8 +102,15 @@ func set_up_path() -> void:
|
||||
locked_line.points = curve.get_baked_points()
|
||||
|
||||
|
||||
func _on_garden_lesson_button_pressed(_lesson_ind: int) -> void:
|
||||
pass
|
||||
func _on_garden_lesson_button_pressed(lesson_ind: int) -> void:
|
||||
await OpeningCurtain.close()
|
||||
|
||||
var minigame_selection: MinigameSelection = minigame_selection_scene.instantiate()
|
||||
minigame_selection.lesson_number = lesson_ind
|
||||
|
||||
get_tree().root.add_child(minigame_selection)
|
||||
get_tree().current_scene = minigame_selection
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_progression_unlocks_changed() -> void:
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
extends TextureButton
|
||||
|
||||
@export var completed: = false:
|
||||
set = _set_completed
|
||||
|
||||
const completed_up: = preload("res://assets/lesson_screen/button_completed_up.png")
|
||||
const completed_down: = preload("res://assets/lesson_screen/button_completed_down.png")
|
||||
|
||||
const progress_up: = preload("res://assets/lesson_screen/button_progress_up.png")
|
||||
const progress_down: = preload("res://assets/lesson_screen/button_progress_down.png")
|
||||
|
||||
|
||||
func _set_completed(value: bool) -> void:
|
||||
completed = value
|
||||
|
||||
if completed:
|
||||
texture_normal = completed_up
|
||||
texture_pressed = completed_down
|
||||
else:
|
||||
texture_normal = progress_up
|
||||
texture_pressed = progress_down
|
||||
@@ -0,0 +1,17 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://delcgui3v0eek"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://s2plf17ct78u" path="res://assets/lesson_screen/button_progress_up.png" id="1_wosm1"]
|
||||
[ext_resource type="Texture2D" uid="uid://3yhvm8k8kabq" path="res://assets/lesson_screen/button_progress_down.png" id="2_jd62s"]
|
||||
[ext_resource type="Texture2D" uid="uid://u805kusykekd" path="res://assets/lesson_screen/button_locked.png" id="3_06y7k"]
|
||||
[ext_resource type="Script" path="res://sources/lesson_screen/lesson_button.gd" id="4_mbltp"]
|
||||
|
||||
[node name="LessonButton" type="TextureButton"]
|
||||
offset_right = 256.0
|
||||
offset_bottom = 256.0
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 4
|
||||
texture_normal = ExtResource("1_wosm1")
|
||||
texture_pressed = ExtResource("2_jd62s")
|
||||
texture_disabled = ExtResource("3_06y7k")
|
||||
stretch_mode = 3
|
||||
script = ExtResource("4_mbltp")
|
||||
@@ -0,0 +1,16 @@
|
||||
extends "res://sources/lesson_screen/lesson_button.gd"
|
||||
|
||||
@export var text: = "":
|
||||
set = _set_text
|
||||
|
||||
@onready var label: Label = $Label
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_set_text(text)
|
||||
|
||||
|
||||
func _set_text(value: String) -> void:
|
||||
text = value
|
||||
if label:
|
||||
label.text = text
|
||||
@@ -0,0 +1,19 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://bw820nbyowrqy"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://delcgui3v0eek" path="res://sources/lesson_screen/lesson_button.tscn" id="1_ngos0"]
|
||||
[ext_resource type="Script" path="res://sources/lesson_screen/lesson_label_button.gd" id="2_vgde5"]
|
||||
|
||||
[node name="LessonLabelButton" instance=ExtResource("1_ngos0")]
|
||||
script = ExtResource("2_vgde5")
|
||||
text = ""
|
||||
|
||||
[node name="Label" type="Label" parent="." index="0"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_font_sizes/font_size = 64
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
@@ -0,0 +1,17 @@
|
||||
@tool
|
||||
extends "res://sources/lesson_screen/lesson_button.gd"
|
||||
|
||||
@export var texture: Texture:
|
||||
set = _set_texture
|
||||
|
||||
@onready var texture_rect: TextureRect = $TextureRect
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_set_texture(texture)
|
||||
|
||||
|
||||
func _set_texture(value: Texture) -> void:
|
||||
texture = value
|
||||
if texture_rect:
|
||||
texture_rect.texture = texture
|
||||
@@ -0,0 +1,17 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://btx8xh83urtuj"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://delcgui3v0eek" path="res://sources/lesson_screen/lesson_button.tscn" id="1_s27fs"]
|
||||
[ext_resource type="Script" path="res://sources/lesson_screen/lesson_texture_button.gd" id="2_8xu3x"]
|
||||
|
||||
[node name="LessonTextureButton" instance=ExtResource("1_s27fs")]
|
||||
script = ExtResource("2_8xu3x")
|
||||
texture = null
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="." index="0"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
@@ -0,0 +1,171 @@
|
||||
extends Control
|
||||
|
||||
const LessonLabelButton: = preload("res://sources/lesson_screen/lesson_label_button.gd")
|
||||
const LessonTextureButton: = preload("res://sources/lesson_screen/lesson_texture_button.gd")
|
||||
const LookAndLearn: = preload("res://sources/look_and_learn/look_and_learn.gd")
|
||||
|
||||
const lesson_texture_button_scene: = preload("res://sources/lesson_screen/lesson_texture_button.tscn")
|
||||
const look_and_learn_scene: = preload("res://sources/look_and_learn/look_and_learn.tscn")
|
||||
|
||||
@export var lesson_number: = 1:
|
||||
set = _set_lesson_number
|
||||
|
||||
@export_group("Grapheme")
|
||||
@export var grapheme_minigames: Array[PackedScene]
|
||||
@export var grapheme_minigames_icons: Array[Texture]
|
||||
|
||||
@export_group("Syllable")
|
||||
@export var syllable_minigames: Array[PackedScene]
|
||||
@export var syllable_minigames_icons: Array[Texture]
|
||||
|
||||
@export_group("Words")
|
||||
@export var words_minigames: Array[PackedScene]
|
||||
@export var words_minigames_icons: Array[Texture]
|
||||
|
||||
@export_group("Sentences")
|
||||
@export var sentences_minigames: Array[PackedScene]
|
||||
@export var sentences_minigames_icons: Array[Texture]
|
||||
|
||||
@onready var lesson_button: LessonLabelButton = $Buttons/LessonButton
|
||||
@onready var exercise_button_1: LessonLabelButton = $Buttons/ExerciseButton1
|
||||
@onready var exercise_button_2: LessonLabelButton = $Buttons/ExerciseButton2
|
||||
@onready var exercise_button_3: LessonLabelButton = $Buttons/ExerciseButton3
|
||||
@onready var minigame_choice_container: PanelContainer = %MinigameChoiceContainer
|
||||
@onready var minigame_button_container: HBoxContainer = %MinigameButtonContainer
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_set_lesson_number(lesson_number)
|
||||
OpeningCurtain.open()
|
||||
|
||||
|
||||
func _set_lesson_number(value: int) -> void:
|
||||
lesson_number = value
|
||||
|
||||
var query: = "Select Grapheme, Phoneme, Exercise1, Exercise2, Exercise3 FROM Lessons
|
||||
INNER JOIN GPsInLessons ON GPsInLessons.LessonID = Lessons.ID
|
||||
INNER JOIN GPs ON GPsInLessons.GPID = GPs.ID
|
||||
INNER JOIN LessonsExercises ON Lessons.ID = LessonsExercises.LessonID
|
||||
WHERE LessonNB == %o" % lesson_number
|
||||
Database.db.query(query)
|
||||
var lesson_dict: = Database.db.query_result[0]
|
||||
Database.db.query("Select Type FROM ExerciseTypes
|
||||
WHERE ID == %o" % lesson_dict.Exercise1)
|
||||
var exercise1: String = Database.db.query_result[0].Type
|
||||
Database.db.query("Select Type FROM ExerciseTypes
|
||||
WHERE ID == %o" % lesson_dict.Exercise2)
|
||||
var exercise2: String = Database.db.query_result[0].Type
|
||||
Database.db.query("Select Type FROM ExerciseTypes
|
||||
WHERE ID == %o" % lesson_dict.Exercise3)
|
||||
var exercise3: String = Database.db.query_result[0].Type
|
||||
|
||||
if lesson_button:
|
||||
lesson_button.text = "%s-%s" % [lesson_dict.Grapheme, lesson_dict.Phoneme]
|
||||
if exercise_button_1:
|
||||
exercise_button_1.text = exercise1
|
||||
if exercise_button_2:
|
||||
exercise_button_2.text = exercise2
|
||||
if exercise_button_3:
|
||||
exercise_button_3.text = exercise3
|
||||
|
||||
if UserDataManager.student_progression :
|
||||
var lesson_unlocks: Dictionary = UserDataManager.student_progression.unlocks[lesson_number]
|
||||
if lesson_button:
|
||||
if lesson_unlocks["look_and_learn"] == UserProgression.Status.Locked:
|
||||
lesson_button.disabled = true
|
||||
else:
|
||||
lesson_button.completed = lesson_unlocks["look_and_learn"] == UserProgression.Status.Completed
|
||||
|
||||
if exercise_button_1:
|
||||
if lesson_unlocks["games"][0] == UserProgression.Status.Locked:
|
||||
exercise_button_1.disabled = true
|
||||
else:
|
||||
exercise_button_1.completed = lesson_unlocks["games"][0] == UserProgression.Status.Completed
|
||||
|
||||
if exercise_button_2:
|
||||
if lesson_unlocks["games"][0] == UserProgression.Status.Locked:
|
||||
exercise_button_2.disabled = true
|
||||
else:
|
||||
exercise_button_2.completed = lesson_unlocks["games"][1] == UserProgression.Status.Completed
|
||||
|
||||
if exercise_button_3:
|
||||
if lesson_unlocks["games"][0] == UserProgression.Status.Locked:
|
||||
exercise_button_3.disabled = true
|
||||
else:
|
||||
exercise_button_3.completed = lesson_unlocks["games"][2] == UserProgression.Status.Completed
|
||||
|
||||
|
||||
func _fill_minigame_choice(exercise_type: String, is_completed: bool, minigame_number: int) -> void:
|
||||
for button in minigame_button_container.get_children():
|
||||
button.queue_free()
|
||||
|
||||
var exercise_scenes: Array[PackedScene]
|
||||
var exercise_icons: Array[Texture]
|
||||
if exercise_type == "Grapheme":
|
||||
exercise_scenes = grapheme_minigames
|
||||
exercise_icons = grapheme_minigames_icons
|
||||
elif exercise_type == "Syllable":
|
||||
exercise_scenes = syllable_minigames
|
||||
exercise_icons = syllable_minigames_icons
|
||||
elif exercise_type == "Words":
|
||||
exercise_scenes = words_minigames
|
||||
exercise_icons = words_minigames_icons
|
||||
elif exercise_type == "Sentences":
|
||||
exercise_scenes = sentences_minigames
|
||||
exercise_icons = sentences_minigames_icons
|
||||
|
||||
for i in range(exercise_scenes.size()):
|
||||
var button: LessonTextureButton = lesson_texture_button_scene.instantiate()
|
||||
minigame_button_container.add_child(button)
|
||||
button.completed = is_completed
|
||||
button.texture = exercise_icons[i]
|
||||
|
||||
button.pressed.connect(_on_minigame_button_pressed.bind(exercise_scenes[i], minigame_number))
|
||||
|
||||
|
||||
func _on_lesson_button_pressed() -> void:
|
||||
await OpeningCurtain.close()
|
||||
|
||||
var look_and_learn: LookAndLearn = look_and_learn_scene.instantiate()
|
||||
look_and_learn.lesson_nb = lesson_number
|
||||
|
||||
get_tree().root.add_child(look_and_learn)
|
||||
get_tree().current_scene = look_and_learn
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_exercise_button_1_pressed() -> void:
|
||||
_fill_minigame_choice(exercise_button_1.text, exercise_button_1.completed, 0)
|
||||
minigame_choice_container.visible = true
|
||||
|
||||
|
||||
func _on_exercise_button_2_pressed() -> void:
|
||||
_fill_minigame_choice(exercise_button_2.text, exercise_button_2.completed, 1)
|
||||
minigame_choice_container.visible = true
|
||||
|
||||
|
||||
func _on_exercise_button_3_pressed() -> void:
|
||||
_fill_minigame_choice(exercise_button_3.text, exercise_button_3.completed, 2)
|
||||
minigame_choice_container.visible = true
|
||||
|
||||
|
||||
func _on_minigame_button_pressed(minigame_scene: PackedScene, minigame_number: int) -> void:
|
||||
await OpeningCurtain.close()
|
||||
|
||||
var minigame: Minigame = minigame_scene.instantiate()
|
||||
minigame.lesson_nb = lesson_number
|
||||
minigame.minigame_number = minigame_number
|
||||
|
||||
get_tree().root.add_child(minigame)
|
||||
get_tree().current_scene = minigame
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_minigame_choice_back_button_pressed() -> void:
|
||||
minigame_choice_container.visible = false
|
||||
|
||||
|
||||
func _on_back_button_pressed() -> void:
|
||||
await OpeningCurtain.close()
|
||||
|
||||
get_tree().change_scene_to_file("res://sources/gardens/gardens.tscn")
|
||||
@@ -0,0 +1,284 @@
|
||||
[gd_scene load_steps=23 format=3 uid="uid://c8ni7hyi07s5k"]
|
||||
|
||||
[ext_resource type="Script" path="res://sources/lesson_screen/minigame_selection.gd" id="1_hxnuv"]
|
||||
[ext_resource type="PackedScene" uid="uid://bxh1torc05k7p" path="res://sources/minigames/crabs/crabs_minigame.tscn" id="2_um8sp"]
|
||||
[ext_resource type="PackedScene" uid="uid://dtcgj6ee8jt2t" path="res://sources/minigames/jellyfish/jellyfish_minigame.tscn" id="3_lhigl"]
|
||||
[ext_resource type="Texture2D" uid="uid://cq5wwf7y1msh7" path="res://assets/minigames/crabs/graphic/gauge_icon_crab_full.png" id="4_fy7i7"]
|
||||
[ext_resource type="Texture2D" uid="uid://cq87j1xw4c31r" path="res://assets/minigames/jellyfish/graphic/gauge_icon_jellyfish_full.png" id="5_dbnyn"]
|
||||
[ext_resource type="PackedScene" uid="uid://c20bhtvqds4p6" path="res://sources/minigames/monkeys/monkeys_minigame.tscn" id="5_ffxjw"]
|
||||
[ext_resource type="PackedScene" uid="uid://8cbihh6410yp" path="res://sources/minigames/parakeets/parakeets_minigame.tscn" id="6_yxpg8"]
|
||||
[ext_resource type="Texture2D" uid="uid://di2qcv6jw8wh0" path="res://assets/minigames/parakeets/graphic/gauge_icon_parakeet_full.png" id="7_6uj2l"]
|
||||
[ext_resource type="Texture2D" uid="uid://c3okdxpi317x5" path="res://assets/minigames/monkeys/graphic/gauge_icon_monkey_full.png" id="9_n17tn"]
|
||||
[ext_resource type="PackedScene" uid="uid://df5oba70wj13y" path="res://sources/minigames/ants/ants_minigame.tscn" id="10_t0lb8"]
|
||||
[ext_resource type="Texture2D" uid="uid://nwbekpbuu472" path="res://assets/minigames/ants/graphics/gauge_icon_ant_full.png" id="11_ou387"]
|
||||
[ext_resource type="Texture2D" uid="uid://2ernt4f1aqmy" path="res://assets/gardens/gardens/garden_01_locked.png" id="12_f4imk"]
|
||||
[ext_resource type="Texture2D" uid="uid://c8hth11pvcilr" path="res://assets/gardens/flowers/Plant_01_01_Large.png" id="13_fa1bn"]
|
||||
[ext_resource type="Texture2D" uid="uid://c4n80pwuotwh1" path="res://assets/gardens/flowers/Plant_01_02_Large.png" id="14_86pa0"]
|
||||
[ext_resource type="Texture2D" uid="uid://dhp4eusoopbhn" path="res://assets/gardens/flowers/Plant_01_03_Large.png" id="15_r2cwu"]
|
||||
[ext_resource type="Texture2D" uid="uid://b1o4eemvfxy81" path="res://assets/gardens/flowers/Plant_01_04_Large.png" id="16_iobvh"]
|
||||
[ext_resource type="Texture2D" uid="uid://vmhtniwsv524" path="res://assets/gardens/flowers/Plant_01_05_Large.png" id="17_wmwk3"]
|
||||
[ext_resource type="Texture2D" uid="uid://cffuqacgb1jra" path="res://assets/lesson_screen/branches.png" id="19_55sxo"]
|
||||
[ext_resource type="PackedScene" uid="uid://bw820nbyowrqy" path="res://sources/lesson_screen/lesson_label_button.tscn" id="19_omgl0"]
|
||||
[ext_resource type="PackedScene" uid="uid://btx8xh83urtuj" path="res://sources/lesson_screen/lesson_texture_button.tscn" id="20_44v85"]
|
||||
[ext_resource type="Texture2D" uid="uid://7sk0g1gcuu7d" path="res://assets/lesson_screen/back.png" id="21_hxufp"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_fk8rp"]
|
||||
bg_color = Color(0.34902, 0.133333, 0.74902, 1)
|
||||
corner_radius_top_left = 42
|
||||
corner_radius_top_right = 42
|
||||
corner_radius_bottom_right = 42
|
||||
corner_radius_bottom_left = 42
|
||||
|
||||
[node name="MinigameSelection" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_hxnuv")
|
||||
grapheme_minigames = Array[PackedScene]([ExtResource("2_um8sp"), ExtResource("3_lhigl")])
|
||||
grapheme_minigames_icons = Array[Texture]([ExtResource("4_fy7i7"), ExtResource("5_dbnyn")])
|
||||
syllable_minigames = Array[PackedScene]([ExtResource("6_yxpg8")])
|
||||
syllable_minigames_icons = Array[Texture]([ExtResource("7_6uj2l")])
|
||||
words_minigames = Array[PackedScene]([ExtResource("5_ffxjw")])
|
||||
words_minigames_icons = Array[Texture]([ExtResource("9_n17tn")])
|
||||
sentences_minigames = Array[PackedScene]([ExtResource("10_t0lb8")])
|
||||
sentences_minigames_icons = Array[Texture]([ExtResource("11_ou387")])
|
||||
|
||||
[node name="BackgroundRect" type="TextureRect" parent="."]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -640.0
|
||||
offset_top = -450.0
|
||||
offset_right = 640.0
|
||||
offset_bottom = 450.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("12_f4imk")
|
||||
|
||||
[node name="Plants" type="Control" parent="."]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="TextureRect1" type="TextureRect" parent="Plants"]
|
||||
layout_mode = 0
|
||||
offset_left = 390.0
|
||||
offset_top = 160.0
|
||||
offset_right = 484.0
|
||||
offset_bottom = 383.0
|
||||
texture = ExtResource("13_fa1bn")
|
||||
|
||||
[node name="TextureRect2" type="TextureRect" parent="Plants"]
|
||||
layout_mode = 0
|
||||
offset_left = 1992.0
|
||||
offset_top = 331.0
|
||||
offset_right = 2103.0
|
||||
offset_bottom = 559.0
|
||||
texture = ExtResource("14_86pa0")
|
||||
|
||||
[node name="TextureRect3" type="TextureRect" parent="Plants"]
|
||||
layout_mode = 0
|
||||
offset_left = 772.0
|
||||
offset_top = 1394.0
|
||||
offset_right = 866.0
|
||||
offset_bottom = 1617.0
|
||||
texture = ExtResource("13_fa1bn")
|
||||
|
||||
[node name="TextureRect4" type="TextureRect" parent="Plants"]
|
||||
layout_mode = 0
|
||||
offset_left = 694.0
|
||||
offset_top = 774.0
|
||||
offset_right = 805.0
|
||||
offset_bottom = 960.0
|
||||
texture = ExtResource("15_r2cwu")
|
||||
|
||||
[node name="TextureRect5" type="TextureRect" parent="Plants"]
|
||||
layout_mode = 0
|
||||
offset_left = 2045.0
|
||||
offset_top = 1073.0
|
||||
offset_right = 2130.0
|
||||
offset_bottom = 1209.0
|
||||
texture = ExtResource("16_iobvh")
|
||||
|
||||
[node name="TextureRect6" type="TextureRect" parent="Plants"]
|
||||
layout_mode = 0
|
||||
offset_left = 390.0
|
||||
offset_top = 1228.0
|
||||
offset_right = 437.0
|
||||
offset_bottom = 1353.0
|
||||
texture = ExtResource("17_wmwk3")
|
||||
|
||||
[node name="TextureRect7" type="TextureRect" parent="Plants"]
|
||||
layout_mode = 0
|
||||
offset_left = 2337.0
|
||||
offset_top = 1300.0
|
||||
offset_right = 2431.0
|
||||
offset_bottom = 1523.0
|
||||
texture = ExtResource("13_fa1bn")
|
||||
|
||||
[node name="TextureRect8" type="TextureRect" parent="Plants"]
|
||||
layout_mode = 0
|
||||
offset_left = 804.0
|
||||
offset_top = 53.0
|
||||
offset_right = 915.0
|
||||
offset_bottom = 281.0
|
||||
texture = ExtResource("14_86pa0")
|
||||
|
||||
[node name="TextureRect9" type="TextureRect" parent="Plants"]
|
||||
layout_mode = 0
|
||||
offset_left = 2278.0
|
||||
offset_top = 67.0
|
||||
offset_right = 2389.0
|
||||
offset_bottom = 253.0
|
||||
texture = ExtResource("15_r2cwu")
|
||||
|
||||
[node name="TextureRect10" type="TextureRect" parent="Plants"]
|
||||
layout_mode = 0
|
||||
offset_left = 1583.0
|
||||
offset_top = 1516.0
|
||||
offset_right = 1694.0
|
||||
offset_bottom = 1702.0
|
||||
texture = ExtResource("15_r2cwu")
|
||||
|
||||
[node name="TextureRect11" type="TextureRect" parent="Plants"]
|
||||
layout_mode = 0
|
||||
offset_left = 249.0
|
||||
offset_top = 646.0
|
||||
offset_right = 334.0
|
||||
offset_bottom = 782.0
|
||||
texture = ExtResource("16_iobvh")
|
||||
|
||||
[node name="TextureRect12" type="TextureRect" parent="Plants"]
|
||||
layout_mode = 0
|
||||
offset_left = 2195.0
|
||||
offset_top = 633.0
|
||||
offset_right = 2242.0
|
||||
offset_bottom = 758.0
|
||||
texture = ExtResource("17_wmwk3")
|
||||
|
||||
[node name="Buttons" type="Control" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="Buttons"]
|
||||
layout_mode = 2
|
||||
offset_left = 1024.0
|
||||
offset_top = 644.0
|
||||
offset_right = 1536.0
|
||||
offset_bottom = 1156.0
|
||||
texture = ExtResource("19_55sxo")
|
||||
|
||||
[node name="LessonButton" parent="Buttons" instance=ExtResource("19_omgl0")]
|
||||
layout_mode = 0
|
||||
offset_left = 1152.0
|
||||
offset_top = 772.0
|
||||
offset_right = 1408.0
|
||||
offset_bottom = 1028.0
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 1
|
||||
|
||||
[node name="ExerciseButton1" parent="Buttons" instance=ExtResource("19_omgl0")]
|
||||
layout_mode = 0
|
||||
offset_left = 1152.0
|
||||
offset_top = 388.0
|
||||
offset_right = 1408.0
|
||||
offset_bottom = 644.0
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 1
|
||||
|
||||
[node name="ExerciseButton2" parent="Buttons" instance=ExtResource("19_omgl0")]
|
||||
layout_mode = 0
|
||||
offset_left = 820.0
|
||||
offset_top = 972.0
|
||||
offset_right = 1076.0
|
||||
offset_bottom = 1228.0
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 1
|
||||
|
||||
[node name="ExerciseButton3" parent="Buttons" instance=ExtResource("19_omgl0")]
|
||||
layout_mode = 0
|
||||
offset_left = 1480.0
|
||||
offset_top = 972.0
|
||||
offset_right = 1736.0
|
||||
offset_bottom = 1228.0
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 1
|
||||
|
||||
[node name="MinigameChoiceContainer" type="PanelContainer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -20.0
|
||||
offset_top = -20.0
|
||||
offset_right = 20.0
|
||||
offset_bottom = 20.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_fk8rp")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="MinigameChoiceContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 300
|
||||
theme_override_constants/margin_top = 200
|
||||
theme_override_constants/margin_right = 300
|
||||
theme_override_constants/margin_bottom = 200
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MinigameChoiceContainer/MarginContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 150
|
||||
|
||||
[node name="MinigameButtonContainer" type="HBoxContainer" parent="MinigameChoiceContainer/MarginContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 4
|
||||
theme_override_constants/separation = 50
|
||||
|
||||
[node name="LessonTextureButton" parent="MinigameChoiceContainer/MarginContainer/VBoxContainer/MinigameButtonContainer" instance=ExtResource("20_44v85")]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 1
|
||||
|
||||
[node name="LessonTextureButton2" parent="MinigameChoiceContainer/MarginContainer/VBoxContainer/MinigameButtonContainer" instance=ExtResource("20_44v85")]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 1
|
||||
|
||||
[node name="MinigameChoiceBackButton" parent="MinigameChoiceContainer/MarginContainer/VBoxContainer" instance=ExtResource("20_44v85")]
|
||||
layout_mode = 2
|
||||
texture = ExtResource("21_hxufp")
|
||||
|
||||
[node name="BackButton" parent="." instance=ExtResource("20_44v85")]
|
||||
layout_mode = 2
|
||||
offset_left = 64.0
|
||||
offset_top = 64.0
|
||||
offset_right = 320.0
|
||||
offset_bottom = 320.0
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 1
|
||||
texture = ExtResource("21_hxufp")
|
||||
|
||||
[connection signal="pressed" from="Buttons/LessonButton" to="." method="_on_lesson_button_pressed"]
|
||||
[connection signal="pressed" from="Buttons/ExerciseButton1" to="." method="_on_exercise_button_1_pressed"]
|
||||
[connection signal="pressed" from="Buttons/ExerciseButton2" to="." method="_on_exercise_button_2_pressed"]
|
||||
[connection signal="pressed" from="Buttons/ExerciseButton3" to="." method="_on_exercise_button_3_pressed"]
|
||||
[connection signal="pressed" from="MinigameChoiceContainer/MarginContainer/VBoxContainer/MinigameChoiceBackButton" to="." method="_on_minigame_choice_back_button_pressed"]
|
||||
[connection signal="pressed" from="BackButton" to="." method="_on_back_button_pressed"]
|
||||
@@ -1,5 +1,8 @@
|
||||
extends Control
|
||||
|
||||
const MinigameSelection: = preload("res://sources/lesson_screen/minigame_selection.gd")
|
||||
const minigame_selection_scene: = preload("res://sources/lesson_screen/minigame_selection.tscn")
|
||||
|
||||
@export var lesson_nb: = 1
|
||||
@export var current_button_pressed: = 0
|
||||
|
||||
@@ -35,11 +38,16 @@ var current_tracing: = 0
|
||||
|
||||
func _ready() -> void:
|
||||
setup()
|
||||
OpeningCurtain.open()
|
||||
|
||||
|
||||
func setup() -> void:
|
||||
gp_list = Database.get_GP_for_lesson(lesson_nb, true)
|
||||
|
||||
grapheme_label.text = ""
|
||||
for gp in gp_list:
|
||||
grapheme_label.text += "%s-%s" % [gp.Grapheme, gp.Phoneme]
|
||||
|
||||
current_video = 0
|
||||
current_image_and_sound = 0
|
||||
current_tracing = 0
|
||||
@@ -116,4 +124,13 @@ func _on_tracing_manager_finished() -> void:
|
||||
tracing_manager.start()
|
||||
current_tracing += 1
|
||||
else:
|
||||
UserDataManager.student_progression.look_and_learn_completed(lesson_nb)
|
||||
animation_player.play("end_tracing")
|
||||
await animation_player.animation_finished
|
||||
|
||||
var minigame_selection: MinigameSelection = minigame_selection_scene.instantiate()
|
||||
minigame_selection.lesson_number = lesson_nb
|
||||
|
||||
get_tree().root.add_child(minigame_selection)
|
||||
get_tree().current_scene = minigame_selection
|
||||
queue_free()
|
||||
|
||||
@@ -83,13 +83,8 @@ func _is_grapheme_valid(grapheme: String) -> bool:
|
||||
|
||||
|
||||
func _get_letter_tracings(letter: String) -> Dictionary:
|
||||
Database.db.query("Select LowerTracingPath, UpperTracingPath FROM LettersTracingData WHERE Letter = '" + letter + "'")
|
||||
|
||||
var lower_path: String = Database.db.query_result[0]["LowerTracingPath"]
|
||||
var upper_path: String = Database.db.query_result[0]["UpperTracingPath"]
|
||||
|
||||
var lower_tracing: = _load_tracing(lower_path)
|
||||
var upper_tracing: = _load_tracing(upper_path)
|
||||
var lower_tracing: = _load_tracing(_lower_path(letter))
|
||||
var upper_tracing: = _load_tracing(_upper_path(letter))
|
||||
|
||||
return {"lower": lower_tracing, "upper": upper_tracing}
|
||||
|
||||
@@ -116,8 +111,17 @@ func _load_tracing(path: String) -> Array:
|
||||
return segments
|
||||
|
||||
|
||||
func _lower_path(letter: String) -> String:
|
||||
return letter + "_lower"
|
||||
|
||||
|
||||
func _upper_path(letter: String) -> String:
|
||||
return letter + "_upper"
|
||||
|
||||
|
||||
func _real_path(path: String) -> String:
|
||||
return resource_folder + language_folder + tracing_data_folder + path + extension
|
||||
return Database.base_path.path_join(Database.language).path_join(Database.tracing_data_folder).path_join(path) + extension
|
||||
|
||||
|
||||
|
||||
# --- Start ---
|
||||
|
||||
@@ -31,8 +31,9 @@ func _ready() -> void:
|
||||
|
||||
|
||||
func _exit_tree():
|
||||
if is_instance_valid(remaining_curve):
|
||||
remaining_curve.free()
|
||||
pass
|
||||
#if is_instance_valid(remaining_curve):
|
||||
#remaining_curve.free()
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
|
||||
@@ -2,7 +2,7 @@ extends Control
|
||||
|
||||
const teacher_password : String = "42"
|
||||
const back_scene_path: = "res://sources/menus/main/main_menu.tscn"
|
||||
const next_scene_path: = "res://sources/menus/minigame_selection.tscn"
|
||||
const next_scene_path: = "res://sources/gardens/gardens.tscn"
|
||||
const teacher_scene_path: = "res://sources/menus/settings/teacher_settings.tscn"
|
||||
const help_speech_path : String = "main_menu/audio/login_screen_help_code.mp3"
|
||||
const wrong_password_speech_path : String = "main_menu/audio/login_screen_feedback_wrong_password.mp3"
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
extends Minigame
|
||||
|
||||
@export var difficulty: = 3
|
||||
@export var lesson_nb: = 100
|
||||
|
||||
@onready var sentence: = %Sentence
|
||||
@onready var ants_spawn: = %AntsSpawn
|
||||
|
||||
@@ -4,6 +4,10 @@ class_name Minigame
|
||||
|
||||
@export var minigame_name: = "Minigame"
|
||||
|
||||
@export var lesson_nb: = 10
|
||||
@export var minigame_number: = 1
|
||||
|
||||
@export_group("Difficulty")
|
||||
@export var max_number_of_lives: = 0 :
|
||||
set(value):
|
||||
max_number_of_lives = value
|
||||
@@ -16,6 +20,7 @@ class_name Minigame
|
||||
if minigame_ui:
|
||||
minigame_ui.set_max_progression(value)
|
||||
|
||||
@export_group("Speechs")
|
||||
@export var intro_kalulu_speech: AudioStream
|
||||
@export var help_kalulu_speech: AudioStream
|
||||
@export var win_kalulu_speech: AudioStream
|
||||
@@ -29,12 +34,15 @@ class_name Minigame
|
||||
# This node is pausable unlike the others, so the pause button can stop the game but not other essential processes.
|
||||
@onready var game_root: = $GameRoot
|
||||
|
||||
# Minigame selection garden sub menu
|
||||
const MinigameSelection: = preload("res://sources/lesson_screen/minigame_selection.gd")
|
||||
const minigame_selection_scene: = preload("res://sources/lesson_screen/minigame_selection.tscn")
|
||||
|
||||
# Sounds
|
||||
const win_sound_fx: = preload("res://assets/sfx/sfx_game_over_win.mp3")
|
||||
const lose_sound_fx: = preload("res://assets/sfx/sfx_game_over_lose.mp3")
|
||||
|
||||
# Lesson
|
||||
var lesson: String
|
||||
var minigame_difficulty: int
|
||||
var lesson_difficulty: int
|
||||
|
||||
@@ -130,6 +138,8 @@ func _reset() -> void:
|
||||
|
||||
|
||||
func _win() -> void:
|
||||
UserDataManager.student_progression.game_completed(lesson_nb, minigame_number)
|
||||
|
||||
audio_player.stream = win_sound_fx
|
||||
audio_player.play()
|
||||
|
||||
@@ -139,7 +149,7 @@ func _win() -> void:
|
||||
minigame_ui.play_kalulu_speech(win_kalulu_speech)
|
||||
await minigame_ui.kalulu_speech_ended
|
||||
|
||||
_reset()
|
||||
_go_back_to_the_garden()
|
||||
|
||||
|
||||
func _lose() -> void:
|
||||
@@ -157,7 +167,7 @@ func _lose() -> void:
|
||||
|
||||
|
||||
func _save_logs() -> void:
|
||||
LessonLogger.save_logs(logs, UserDataManager.get_student_folder(), minigame_name, lesson, Time.get_time_string_from_system())
|
||||
LessonLogger.save_logs(logs, UserDataManager.get_student_folder(), minigame_name, lesson_nb, Time.get_time_string_from_system())
|
||||
_reset_logs()
|
||||
|
||||
|
||||
@@ -187,12 +197,17 @@ func _log_new_response(response: Dictionary, current_stimulus: Dictionary) -> vo
|
||||
|
||||
|
||||
func _go_back_to_the_garden() -> void:
|
||||
get_tree().paused = false
|
||||
await OpeningCurtain.close()
|
||||
|
||||
_save_logs()
|
||||
|
||||
get_tree().paused = false
|
||||
get_tree().change_scene_to_file("res://sources/menus/minigame_selection.tscn")
|
||||
var minigame_selection: MinigameSelection = minigame_selection_scene.instantiate()
|
||||
minigame_selection.lesson_number = lesson_nb
|
||||
|
||||
get_tree().root.add_child(minigame_selection)
|
||||
get_tree().current_scene = minigame_selection
|
||||
queue_free()
|
||||
|
||||
|
||||
func _play_stimulus() -> void:
|
||||
|
||||
@@ -13,6 +13,7 @@ anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_jdfsm")
|
||||
minigame_number = null
|
||||
|
||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||
bus = &"Effects"
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
extends Minigame
|
||||
|
||||
@export var difficulty: = 1
|
||||
@export var lesson_nb: = 15
|
||||
|
||||
const hole_class: = preload("res://sources/minigames/crabs/hole/hole.tscn")
|
||||
const difficulty_settings: = {
|
||||
@@ -102,7 +101,7 @@ func _on_hole_crab_despawned(stimulus: Dictionary) -> void:
|
||||
_on_hole_timer_timeout(stimulus)
|
||||
|
||||
|
||||
func _on_hole_timer_timeout(stimulus: Dictionary) -> void:
|
||||
func _on_hole_timer_timeout(_stimulus: Dictionary) -> void:
|
||||
var holes_range: = range(holes.size())
|
||||
holes_range.shuffle()
|
||||
|
||||
|
||||
@@ -11,14 +11,14 @@
|
||||
|
||||
[node name="Crabs" instance=ExtResource("1_lbq56")]
|
||||
script = ExtResource("2_gierf")
|
||||
difficulty = 2
|
||||
minigame_name = "Crabs"
|
||||
lesson_nb = 3
|
||||
max_number_of_lives = 5
|
||||
max_progression = 5
|
||||
intro_kalulu_speech = ExtResource("3_shwct")
|
||||
help_kalulu_speech = ExtResource("3_8pn05")
|
||||
win_kalulu_speech = ExtResource("4_bmrol")
|
||||
difficulty = 2
|
||||
lesson_nb = 3
|
||||
|
||||
[node name="MinigameUI" parent="." index="1"]
|
||||
empty_progression_icon = ExtResource("5_7vlrm")
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
extends Minigame
|
||||
|
||||
@export var difficulty: = 1
|
||||
@export var lesson_nb: = 10
|
||||
|
||||
@onready var start: = %Start
|
||||
@onready var end: = %End
|
||||
|
||||
@@ -21,7 +21,6 @@ var difficulty_settings: = {
|
||||
4: DifficultySettings.new(1, 0.2, 300),
|
||||
}
|
||||
|
||||
@export var lesson_nb: = 10
|
||||
@export var difficulty: = 0
|
||||
|
||||
var blocking_jellyfish: Array[Control] = []
|
||||
|
||||
@@ -24,7 +24,6 @@ enum Audio {
|
||||
}
|
||||
|
||||
@export var difficulty: = 1
|
||||
@export var lesson_nb: = 4
|
||||
@export var throw_to_king_duration: = 1.2
|
||||
@export var throw_to_monkey_duration: = 0.4
|
||||
@export var throw_to_planck_duration: = 0.8
|
||||
|
||||
@@ -25,7 +25,6 @@ const audio_streams: = [
|
||||
]
|
||||
|
||||
@export var difficulty: = 1
|
||||
@export var lesson_nb: = 4
|
||||
@export var fly_duration: = 3.0
|
||||
|
||||
@onready var branches: = $GameRoot/TreeTrunk/Branches
|
||||
|
||||
@@ -6,7 +6,7 @@ const log_resource_class: = preload("res://sources/utils/minigame_resources/log.
|
||||
var log_resources: = {}
|
||||
|
||||
|
||||
func save_logs(logs: Dictionary, folder_path: String, minigame_name: String, lesson: String, time: String) -> void:
|
||||
func save_logs(logs: Dictionary, folder_path: String, minigame_name: String, lesson_nb: int, time: String) -> void:
|
||||
var file_path: = folder_path + minigame_name + ".tres"
|
||||
|
||||
if not ResourceLoader.exists(file_path):
|
||||
@@ -17,15 +17,6 @@ func save_logs(logs: Dictionary, folder_path: String, minigame_name: String, les
|
||||
var log_resource: = ResourceLoader.load(file_path)
|
||||
log_resources[file_path] = log_resource
|
||||
|
||||
if not log_resources[file_path].has(lesson):
|
||||
log_resources[file_path][lesson] = {}
|
||||
|
||||
if not log_resources[file_path][lesson].has(time):
|
||||
log_resources[file_path][lesson][time] = logs
|
||||
else:
|
||||
var i: = 0
|
||||
while log_resources[file_path][lesson].has(time + "_" + str(i)):
|
||||
i += 1
|
||||
log_resources[file_path][lesson][time + "_" + str(i)] = logs
|
||||
log_resources[file_path].add_log(lesson_nb, logs, time)
|
||||
|
||||
ResourceSaver.save(log_resources[file_path], file_path, ResourceSaver.FLAG_COMPRESS)
|
||||
|
||||
@@ -263,7 +263,7 @@ func _load_student_progression() -> void:
|
||||
DirAccess.make_dir_recursive_absolute(get_student_folder())
|
||||
_save_student_progression()
|
||||
|
||||
student_progression.unlocks_changed.connect(_on_user_progression_unlocks_changed)
|
||||
student_progression.unlocks_changed.connect(_on_user_progression_unlocks_changed)
|
||||
|
||||
func _save_student_progression() -> void:
|
||||
ResourceSaver.save(student_progression, get_student_progression_path())
|
||||
|
||||
@@ -2,3 +2,16 @@ extends Resource
|
||||
class_name LogResource
|
||||
|
||||
@export var logs: = {}
|
||||
|
||||
|
||||
func add_log(lesson_nb: int, new_log: Dictionary, time: String) -> void:
|
||||
if not logs.has(lesson_nb):
|
||||
logs[lesson_nb] = {}
|
||||
|
||||
if not logs[lesson_nb].has(time):
|
||||
logs[lesson_nb][time] = new_log
|
||||
else:
|
||||
var i: = 2
|
||||
while logs[lesson_nb].has(time + "_" + str(i)):
|
||||
i += 1
|
||||
logs[lesson_nb][time + "_" + str(i)] = new_log
|
||||
|
||||
Reference in New Issue
Block a user