added in audio cues to the observation part - added appropriate attribution to Kenney

This commit is contained in:
Jaap Marsman 2025-04-18 17:08:44 +08:00
parent 73d4c9bbdb
commit ae27b96060
9 changed files with 71 additions and 4 deletions

View File

@ -24,6 +24,10 @@ Portions of this software are copyright © 2022 The FreeType Project (www.freety
The app uses the Noto Sans font family, for which <a href="https://github.com/notofonts/noto-fonts/blob/main/LICENSE" target="_blank">the full Open Font License is available here</a>. The app uses the Noto Sans font family, for which <a href="https://github.com/notofonts/noto-fonts/blob/main/LICENSE" target="_blank">the full Open Font License is available here</a>.
## Audio
The app uses <a href="https://kenney.nl/assets/digital-audio">Kenney's Digital Audio Pack</a>. Whilst distributed under CC0 and attribution is not required, I felt it only fair to mention it here.
## Internet module Mbed TLS (as part of Godot) ## Internet module Mbed TLS (as part of Godot)
Copyright The Mbed TLS Contributors Copyright The Mbed TLS Contributors

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -21,6 +21,10 @@ var time_lefts : int
var toggle_observation : bool = false var toggle_observation : bool = false
var observation_button_pressed : bool = false var observation_button_pressed : bool = false
var sound_scored = preload("res://Assets/audio/scored.ogg")
var sound_time_to_score = preload("res://Assets/audio/time_to_score.ogg")
var sound_no_score = preload("res://Assets/audio/no_score.ogg")
@onready var styleBox_highlight : StyleBoxFlat = $"%OneInstrPanel".get_theme_stylebox("panel").duplicate() @onready var styleBox_highlight : StyleBoxFlat = $"%OneInstrPanel".get_theme_stylebox("panel").duplicate()
@onready var styleBox_orig : StyleBoxFlat = $"%TwoNamesPanel".get_theme_stylebox("panel").duplicate() @onready var styleBox_orig : StyleBoxFlat = $"%TwoNamesPanel".get_theme_stylebox("panel").duplicate()
@ -74,6 +78,8 @@ func _process(_delta) -> void:
print("We're at the five second mark!") print("We're at the five second mark!")
toggle_observation = true toggle_observation = true
$"Panel/BehaviourButtons".show() $"Panel/BehaviourButtons".show()
$AudioPlayer.stream = sound_time_to_score
$AudioPlayer.play()
func calculate_percentages() -> void: func calculate_percentages() -> void:
@ -102,6 +108,8 @@ func on_interval_moment() -> void:
if observation_button_pressed == false: if observation_button_pressed == false:
global_ints.six_behaviour_score += 1 global_ints.six_behaviour_score += 1
global_ints.total_behaviours += 1 global_ints.total_behaviours += 1
$AudioPlayer.stream = sound_no_score
$AudioPlayer.play()
observation_button_pressed = false observation_button_pressed = false
@ -135,6 +143,8 @@ func _on_BehaviourOne_pressed() -> void:
global_ints.one_behaviour_score += 1 global_ints.one_behaviour_score += 1
global_ints.total_behaviours += 1 global_ints.total_behaviours += 1
observation_button_pressed = true observation_button_pressed = true
$AudioPlayer.stream = sound_scored
$AudioPlayer.play()
$"Panel/BehaviourButtons".hide() $"Panel/BehaviourButtons".hide()
print(str(global_ints.one_behaviour_score)) print(str(global_ints.one_behaviour_score))
@ -143,6 +153,8 @@ func _on_BehaviourTwo_pressed() -> void:
global_ints.two_behaviour_score += 1 global_ints.two_behaviour_score += 1
global_ints.total_behaviours += 1 global_ints.total_behaviours += 1
observation_button_pressed = true observation_button_pressed = true
$AudioPlayer.stream = sound_scored
$AudioPlayer.play()
$"Panel/BehaviourButtons".hide() $"Panel/BehaviourButtons".hide()
@ -150,6 +162,8 @@ func _on_BehaviourThree_pressed() -> void:
global_ints.three_behaviour_score += 1 global_ints.three_behaviour_score += 1
global_ints.total_behaviours += 1 global_ints.total_behaviours += 1
observation_button_pressed = true observation_button_pressed = true
$AudioPlayer.stream = sound_scored
$AudioPlayer.play()
$"Panel/BehaviourButtons".hide() $"Panel/BehaviourButtons".hide()
@ -157,6 +171,8 @@ func _on_BehaviourFour_pressed() -> void:
global_ints.four_behaviour_score += 1 global_ints.four_behaviour_score += 1
global_ints.total_behaviours += 1 global_ints.total_behaviours += 1
observation_button_pressed = true observation_button_pressed = true
$AudioPlayer.stream = sound_scored
$AudioPlayer.play()
$"Panel/BehaviourButtons".hide() $"Panel/BehaviourButtons".hide()
@ -164,6 +180,8 @@ func _on_BehaviourFive_pressed() -> void:
global_ints.five_behaviour_score += 1 global_ints.five_behaviour_score += 1
global_ints.total_behaviours += 1 global_ints.total_behaviours += 1
observation_button_pressed = true observation_button_pressed = true
$AudioPlayer.stream = sound_scored
$AudioPlayer.play()
$"Panel/BehaviourButtons".hide() $"Panel/BehaviourButtons".hide()

View File

@ -69,7 +69,7 @@ var four_behaviour_percent : float
var five_behaviour_percent : float var five_behaviour_percent : float
func reset_all_vars() -> void: func reset_all_vars() -> void:
observation_minutes = 15 observation_minutes = 10
generate_results = false generate_results = false

View File

@ -24,6 +24,8 @@ var update_text : String
var text_buffer : String var text_buffer : String
var os_list : Array = ["Linux", "Windows", "macOS", "OSX", "UWP", "X11", "FreeBSD", "NetBSD", "OpenBSD", "BSD"] var os_list : Array = ["Linux", "Windows", "macOS", "OSX", "UWP", "X11", "FreeBSD", "NetBSD", "OpenBSD", "BSD"]
var test_sound = preload("res://Assets/audio/time_to_score.ogg")
@onready var minute_label = $"StartScreen/InstructionPanel/MinuteBox/MinuteLabel" @onready var minute_label = $"StartScreen/InstructionPanel/MinuteBox/MinuteLabel"
@onready var styleBox_highlight : StyleBoxFlat = $"%OneInstrPanel".get_theme_stylebox("panel").duplicate() @onready var styleBox_highlight : StyleBoxFlat = $"%OneInstrPanel".get_theme_stylebox("panel").duplicate()
@onready var styleBox_orig : StyleBoxFlat = $"%TwoNamesPanel".get_theme_stylebox("panel").duplicate() @onready var styleBox_orig : StyleBoxFlat = $"%TwoNamesPanel".get_theme_stylebox("panel").duplicate()
@ -312,3 +314,18 @@ func _on_save_edit_pressed() -> void:
$"%EditPanel".hide() $"%EditPanel".hide()
$"%EditResult".hide() $"%EditResult".hide()
$"%EditMenu".hide() $"%EditMenu".hide()
func _on_test_menu_id_pressed(id: int) -> void:
# At some point, I'd like to add shortcuts such as Command-R or Command-Q
# https://github.com/godotengine/godot/issues/82854
if id == 0:
global_ints.reset_all_vars()
var _ignore = get_tree().reload_current_scene()
if id == 1:
get_tree().quit()
func _on_test_sound_pressed() -> void:
$StartScreen/AudioPlay.stream = test_sound
$StartScreen/AudioPlay.play()

View File

@ -1205,11 +1205,9 @@ unique_name_in_owner = true
unique_name_in_owner = true unique_name_in_owner = true
[node name="StartScreen" type="CanvasLayer" parent="."] [node name="StartScreen" type="CanvasLayer" parent="."]
visible = false
[node name="InstructionPanel" type="Panel" parent="StartScreen"] [node name="InstructionPanel" type="Panel" parent="StartScreen"]
unique_name_in_owner = true unique_name_in_owner = true
visible = false
anchors_preset = 8 anchors_preset = 8
anchor_left = 0.5 anchor_left = 0.5
anchor_top = 0.5 anchor_top = 0.5
@ -1336,6 +1334,12 @@ size_flags_horizontal = 3
theme = ExtResource("1") theme = ExtResource("1")
text = "BUT_EDIT_NM" text = "BUT_EDIT_NM"
[node name="TestSound" type="Button" parent="StartScreen/InstructionPanel/BottomButtons"]
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("1")
text = "BUT_TEST_SND"
[node name="Start" type="Button" parent="StartScreen/InstructionPanel/BottomButtons"] [node name="Start" type="Button" parent="StartScreen/InstructionPanel/BottomButtons"]
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
@ -1485,6 +1489,7 @@ text = "The pupil is otherwise distracted and not on task"
[node name="NameChangePanel" type="Panel" parent="StartScreen"] [node name="NameChangePanel" type="Panel" parent="StartScreen"]
unique_name_in_owner = true unique_name_in_owner = true
visible = false
anchors_preset = 8 anchors_preset = 8
anchor_left = 0.5 anchor_left = 0.5
anchor_top = 0.5 anchor_top = 0.5
@ -1694,6 +1699,8 @@ offset_bottom = 432.0
theme = ExtResource("1") theme = ExtResource("1")
text = "UPD_TEXT2" text = "UPD_TEXT2"
[node name="AudioPlay" type="AudioStreamPlayer2D" parent="StartScreen"]
[node name="EditScreen" type="CanvasLayer" parent="."] [node name="EditScreen" type="CanvasLayer" parent="."]
unique_name_in_owner = true unique_name_in_owner = true
visible = false visible = false
@ -1864,6 +1871,7 @@ text = "BUT_CLEAR"
[node name="ObservationWindow" type="CanvasLayer" parent="."] [node name="ObservationWindow" type="CanvasLayer" parent="."]
unique_name_in_owner = true unique_name_in_owner = true
visible = false
script = ExtResource("7") script = ExtResource("7")
[node name="Panel" type="Panel" parent="ObservationWindow"] [node name="Panel" type="Panel" parent="ObservationWindow"]
@ -2095,6 +2103,8 @@ script = ExtResource("11")
unique_name_in_owner = true unique_name_in_owner = true
wait_time = 20.0 wait_time = 20.0
[node name="AudioPlayer" type="AudioStreamPlayer2D" parent="ObservationWindow"]
[node name="Results" type="CanvasLayer" parent="."] [node name="Results" type="CanvasLayer" parent="."]
unique_name_in_owner = true unique_name_in_owner = true
visible = false visible = false
@ -2462,6 +2472,21 @@ theme_override_font_sizes/font_size = 14
text = "LAB_RESULTS" text = "LAB_RESULTS"
horizontal_alignment = 1 horizontal_alignment = 1
[node name="AppMenuBar" type="MenuBar" parent="."]
visible = false
offset_left = 130.0
offset_top = 68.0
offset_right = 1253.0
offset_bottom = 109.0
[node name="FileMenu" type="PopupMenu" parent="AppMenuBar"]
title = "File"
item_count = 2
item_0/text = "Reset"
item_0/id = 0
item_1/text = "Quit"
item_1/id = 1
[connection signal="request_completed" from="HTTPRequest" to="." method="_on_HTTPRequest_request_completed"] [connection signal="request_completed" from="HTTPRequest" to="." method="_on_HTTPRequest_request_completed"]
[connection signal="request_completed" from="HTTPRequest2" to="." method="_on_HTTPRequest2_request_completed"] [connection signal="request_completed" from="HTTPRequest2" to="." method="_on_HTTPRequest2_request_completed"]
[connection signal="button_down" from="StartScreen/InstructionPanel/MinuteBox/MinuteMinus" to="." method="_on_MinuteMinus_button_down"] [connection signal="button_down" from="StartScreen/InstructionPanel/MinuteBox/MinuteMinus" to="." method="_on_MinuteMinus_button_down"]
@ -2471,6 +2496,7 @@ horizontal_alignment = 1
[connection signal="pressed" from="StartScreen/InstructionPanel/BottomButtons/Manual" to="." method="_on_Manual_pressed"] [connection signal="pressed" from="StartScreen/InstructionPanel/BottomButtons/Manual" to="." method="_on_Manual_pressed"]
[connection signal="pressed" from="StartScreen/InstructionPanel/BottomButtons/ChangeItems" to="." method="_on_ChangeItems_pressed"] [connection signal="pressed" from="StartScreen/InstructionPanel/BottomButtons/ChangeItems" to="." method="_on_ChangeItems_pressed"]
[connection signal="pressed" from="StartScreen/InstructionPanel/BottomButtons/PupilName" to="." method="_on_PupilName_pressed"] [connection signal="pressed" from="StartScreen/InstructionPanel/BottomButtons/PupilName" to="." method="_on_PupilName_pressed"]
[connection signal="pressed" from="StartScreen/InstructionPanel/BottomButtons/TestSound" to="." method="_on_test_sound_pressed"]
[connection signal="pressed" from="StartScreen/InstructionPanel/BottomButtons/Start" to="." method="_on_Start_pressed"] [connection signal="pressed" from="StartScreen/InstructionPanel/BottomButtons/Start" to="." method="_on_Start_pressed"]
[connection signal="pressed" from="StartScreen/NameChangePanel/NameContainer/OkButton" to="." method="_on_ok_button_pressed"] [connection signal="pressed" from="StartScreen/NameChangePanel/NameContainer/OkButton" to="." method="_on_ok_button_pressed"]
[connection signal="pressed" from="StartScreen/InstructionScreen/InstructionContainer/InsOkButton" to="." method="_on_InsOkButton_pressed"] [connection signal="pressed" from="StartScreen/InstructionScreen/InstructionContainer/InsOkButton" to="." method="_on_InsOkButton_pressed"]
@ -2492,3 +2518,4 @@ horizontal_alignment = 1
[connection signal="pressed" from="Results/Panel/ResultMenu/SaveReport" to="Results" method="_on_SaveReport_pressed"] [connection signal="pressed" from="Results/Panel/ResultMenu/SaveReport" to="Results" method="_on_SaveReport_pressed"]
[connection signal="pressed" from="Results/Panel/EditMenu/CancelEdit" to="." method="_on_cancel_edit_pressed"] [connection signal="pressed" from="Results/Panel/EditMenu/CancelEdit" to="." method="_on_cancel_edit_pressed"]
[connection signal="pressed" from="Results/Panel/EditMenu/SaveEdit" to="." method="_on_save_edit_pressed"] [connection signal="pressed" from="Results/Panel/EditMenu/SaveEdit" to="." method="_on_save_edit_pressed"]
[connection signal="id_pressed" from="AppMenuBar/FileMenu" to="." method="_on_test_menu_id_pressed"]

View File

@ -34,3 +34,4 @@ LAB_NAMES,Names,x
LAB_CONFIG,Configure,x LAB_CONFIG,Configure,x
LAB_OBS,Observe,x LAB_OBS,Observe,x
LAB_RESULTS,Results,x LAB_RESULTS,Results,x
BUT_TEST_SND,Test Audio,
1 keys en nl
34 LAB_CONFIG Configure x
35 LAB_OBS Observe x
36 LAB_RESULTS Results x
37 BUT_TEST_SND Test Audio