Updates the LookAndLearn scene to show the GP on top instead of inside the button. Fixes a bug that would try to play an image/sound without sound.

This commit is contained in:
Dylan Sarrazyn
2024-11-19 17:13:45 +01:00
parent b184e4abe3
commit fb3867102e
5 changed files with 76 additions and 45 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ config_version=5
config/name="Kalulu" config/name="Kalulu"
config/version="2.0.7" config/version="2.0.7"
run/main_scene="res://sources/language_tool/prof_tool_menu.tscn" run/main_scene="res://sources/menus/splash_screen/splash_screen.tscn"
config/features=PackedStringArray("4.3", "Forward Plus") config/features=PackedStringArray("4.3", "Forward Plus")
boot_splash/bg_color=Color(0.141176, 0.141176, 0.141176, 1) boot_splash/bg_color=Color(0.141176, 0.141176, 0.141176, 1)
config/icon="res://assets/kalulu_icon.png" config/icon="res://assets/kalulu_icon.png"
File diff suppressed because one or more lines are too long
+15 -10
View File
@@ -15,9 +15,7 @@ const TracingManager: = preload("res://sources/look_and_learn/tracing_manager.gd
@onready var grapheme_particles: GPUParticles2D = $GraphemeParticles @onready var grapheme_particles: GPUParticles2D = $GraphemeParticles
var gp_list: Array[Dictionary] var gp_list: Array[Dictionary]
var current_video: = 0 var current_video: = 0
var videos: = [] var videos: = []
@@ -39,7 +37,7 @@ func _ready() -> void:
transition_data = {} transition_data = {}
lesson_nb = gardens_data.get("current_lesson_number", lesson_nb) lesson_nb = gardens_data.get("current_lesson_number", lesson_nb)
setup() setup()
OpeningCurtain.open() await OpeningCurtain.open()
func setup() -> void: func setup() -> void:
@@ -59,11 +57,18 @@ func setup() -> void:
var gp_sound: = Database.get_gp_look_and_learn_sound(gp) var gp_sound: = Database.get_gp_look_and_learn_sound(gp)
var gp_video: = Database.get_gp_look_and_learn_video(gp) var gp_video: = Database.get_gp_look_and_learn_video(gp)
if gp_image and gp_sound and gp_video: var used: = false
if gp_video:
videos.append(gp_video)
used = true
if gp_image and gp_sound:
images.append(gp_image) images.append(gp_image)
sounds.append(gp_sound) sounds.append(gp_sound)
videos.append(gp_video) used = true
if used:
gp_display.append(gp) gp_display.append(gp)
if gp_display.is_empty(): if gp_display.is_empty():
@@ -71,6 +76,8 @@ func setup() -> void:
grapheme_label.text = "" grapheme_label.text = ""
for gp: Dictionary in gp_display: for gp: Dictionary in gp_display:
if grapheme_label.text:
grapheme_label.text += " - "
grapheme_label.text += "%s" % gp.Grapheme grapheme_label.text += "%s" % gp.Grapheme
@@ -129,10 +136,12 @@ func _on_grapheme_button_pressed() -> void:
func _on_video_stream_player_finished() -> void: func _on_video_stream_player_finished() -> void:
await get_tree().create_timer(1).timeout
play_videos() play_videos()
func _on_audio_stream_player_finished() -> void: func _on_audio_stream_player_finished() -> void:
await get_tree().create_timer(1).timeout
play_images_and_sounds() play_images_and_sounds()
@@ -144,11 +153,7 @@ func _on_tracing_manager_finished() -> void:
else: else:
UserDataManager.student_progression.look_and_learn_completed(lesson_nb) UserDataManager.student_progression.look_and_learn_completed(lesson_nb)
animation_player.play("end_tracing") animation_player.play("end_tracing")
# await animation_player.animation_finished
gardens_data.look_and_learn_completed = true gardens_data.look_and_learn_completed = true
_back_to_gardens() _back_to_gardens()
+47 -21
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=31 format=3 uid="uid://mnvxfhi70bx5"] [gd_scene load_steps=33 format=3 uid="uid://mnvxfhi70bx5"]
[ext_resource type="Script" path="res://sources/look_and_learn/look_and_learn.gd" id="1_12st1"] [ext_resource type="Script" path="res://sources/look_and_learn/look_and_learn.gd" id="1_12st1"]
[ext_resource type="PackedScene" uid="uid://wdjp1sv55q4f" path="res://sources/menus/components/night_sky/night_sky.tscn" id="2_2efp5"] [ext_resource type="PackedScene" uid="uid://wdjp1sv55q4f" path="res://sources/menus/components/night_sky/night_sky.tscn" id="2_2efp5"]
@@ -8,6 +8,7 @@
[ext_resource type="PackedScene" uid="uid://nwur175781jf" path="res://sources/menus/main/plants/large_flower.tscn" id="5_bxvlx"] [ext_resource type="PackedScene" uid="uid://nwur175781jf" path="res://sources/menus/main/plants/large_flower.tscn" id="5_bxvlx"]
[ext_resource type="Texture2D" uid="uid://bnvx1mujmy3vf" path="res://assets/minigames/minigame_ui/graphic/button_back_to_menu_disabled.png" id="5_j5vhb"] [ext_resource type="Texture2D" uid="uid://bnvx1mujmy3vf" path="res://assets/minigames/minigame_ui/graphic/button_back_to_menu_disabled.png" id="5_j5vhb"]
[ext_resource type="Texture2D" uid="uid://c1i3kqeg7ifoo" path="res://assets/look_and_learn/video_foreground.png" id="6_8san1"] [ext_resource type="Texture2D" uid="uid://c1i3kqeg7ifoo" path="res://assets/look_and_learn/video_foreground.png" id="6_8san1"]
[ext_resource type="Theme" uid="uid://dqjvrt5nrtwn1" path="res://resources/themes/kalulu_theme.tres" id="6_e2avu"]
[ext_resource type="PackedScene" uid="uid://dqtclljq6bvtg" path="res://sources/menus/main/plants/bush.tscn" id="6_ohnh6"] [ext_resource type="PackedScene" uid="uid://dqtclljq6bvtg" path="res://sources/menus/main/plants/bush.tscn" id="6_ohnh6"]
[ext_resource type="Texture2D" uid="uid://c72ebvussuekg" path="res://assets/look_and_learn/video_mask.png" id="7_8pmth"] [ext_resource type="Texture2D" uid="uid://c72ebvussuekg" path="res://assets/look_and_learn/video_mask.png" id="7_8pmth"]
[ext_resource type="Texture2D" uid="uid://dnh4dct8pgcj5" path="res://assets/minigames/minigame_ui/graphic/bush.png" id="8_xb5ul"] [ext_resource type="Texture2D" uid="uid://dnh4dct8pgcj5" path="res://assets/minigames/minigame_ui/graphic/bush.png" id="8_xb5ul"]
@@ -17,6 +18,7 @@
[ext_resource type="Texture2D" uid="uid://bdu7wcc3netlc" path="res://assets/look_and_learn/button_off.png" id="12_1yr4y"] [ext_resource type="Texture2D" uid="uid://bdu7wcc3netlc" path="res://assets/look_and_learn/button_off.png" id="12_1yr4y"]
[ext_resource type="PackedScene" uid="uid://cboa82q0bjlvc" path="res://sources/look_and_learn/tracing_manager.tscn" id="12_fkd0b"] [ext_resource type="PackedScene" uid="uid://cboa82q0bjlvc" path="res://sources/look_and_learn/tracing_manager.tscn" id="12_fkd0b"]
[ext_resource type="Texture2D" uid="uid://cyx6rau3sgwed" path="res://assets/look_and_learn/fx_03.png" id="13_rp6w3"] [ext_resource type="Texture2D" uid="uid://cyx6rau3sgwed" path="res://assets/look_and_learn/fx_03.png" id="13_rp6w3"]
[ext_resource type="Texture2D" uid="uid://b1227jts6lw67" path="res://assets/theme/play.svg" id="17_dhida"]
[sub_resource type="Animation" id="Animation_6mi26"] [sub_resource type="Animation" id="Animation_6mi26"]
length = 0.001 length = 0.001
@@ -786,6 +788,7 @@ anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
script = ExtResource("1_12st1") script = ExtResource("1_12st1")
lesson_nb = 24
[node name="AnimationPlayer" type="AnimationPlayer" parent="."] [node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = { libraries = {
@@ -819,6 +822,38 @@ anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
[node name="Panel" type="PanelContainer" parent="."]
layout_mode = 1
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
offset_left = -88.0
offset_top = 25.0
offset_right = 90.0
offset_bottom = 289.0
grow_horizontal = 2
theme = ExtResource("6_e2avu")
theme_type_variation = &"PanelKalulu"
[node name="MarginContainer" type="MarginContainer" parent="Panel"]
layout_mode = 2
mouse_filter = 2
theme_override_constants/margin_left = 35
theme_override_constants/margin_top = 20
theme_override_constants/margin_right = 25
theme_override_constants/margin_bottom = 5
[node name="GraphemeLabel" type="Label" parent="Panel/MarginContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 4
theme_override_constants/outline_size = 10
theme_override_font_sizes/font_size = 175
text = "o"
horizontal_alignment = 1
vertical_alignment = 1
uppercase = true
[node name="LeftContainer" type="VBoxContainer" parent="."] [node name="LeftContainer" type="VBoxContainer" parent="."]
layout_mode = 1 layout_mode = 1
anchors_preset = 9 anchors_preset = 9
@@ -939,29 +974,20 @@ texture_hover = ExtResource("11_trjsl")
texture_disabled = ExtResource("12_1yr4y") texture_disabled = ExtResource("12_1yr4y")
stretch_mode = 0 stretch_mode = 0
[node name="MarginContainer" type="MarginContainer" parent="GraphemeButton"] [node name="TextureRect" type="TextureRect" parent="GraphemeButton"]
layout_mode = 1 layout_mode = 1
anchors_preset = 15 anchors_preset = 8
anchor_right = 1.0 anchor_left = 0.5
anchor_bottom = 1.0 anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -65.0
offset_top = -75.0
offset_right = 85.0
offset_bottom = 75.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
mouse_filter = 2 texture = ExtResource("17_dhida")
theme_override_constants/margin_left = 15
theme_override_constants/margin_top = 20
theme_override_constants/margin_right = 5
theme_override_constants/margin_bottom = 5
[node name="GraphemeLabel" type="Label" parent="GraphemeButton/MarginContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 1
theme_override_constants/outline_size = 10
theme_override_font_sizes/font_size = 175
text = "o"
horizontal_alignment = 1
vertical_alignment = 1
uppercase = true
[node name="GraphemeParticles" type="GPUParticles2D" parent="."] [node name="GraphemeParticles" type="GPUParticles2D" parent="."]
position = Vector2(1280, 1558) position = Vector2(1280, 1558)
+1 -1
View File
@@ -506,7 +506,7 @@ func get_gp_look_and_learn_sound(gp: Dictionary) -> AudioStream:
sound.data = file.get_buffer(file.get_length()) sound.data = file.get_buffer(file.get_length())
return sound return sound
return AudioStream.new() return null
func get_gp_look_and_learn_video(gp: Dictionary) -> VideoStream: func get_gp_look_and_learn_video(gp: Dictionary) -> VideoStream: