diff --git a/audio/levelup1.mp3 b/audio/levelup1.mp3 new file mode 100644 index 0000000..1f456f7 Binary files /dev/null and b/audio/levelup1.mp3 differ diff --git a/audio/levelup2.mp3 b/audio/levelup2.mp3 new file mode 100644 index 0000000..cf7f672 Binary files /dev/null and b/audio/levelup2.mp3 differ diff --git a/help/documentation.md b/help/documentation.md index 7ae2c48..fdf998e 100644 --- a/help/documentation.md +++ b/help/documentation.md @@ -74,9 +74,18 @@ async function setUserData(CouchDB couchDB) -> bool; async function updateUserData(CouchDB couchDB, object userData) -> Map; ``` +##Other + +``` +//Spielt einen sound ab +//(Funktioniert nur, wenn vorher eine Nutzerinteraktion erfolgt ist (Button-Click etc.)) +async function playSound(string src) -> void; +``` + ##Nützliche CSS-Klassen - .profile = Runde Profilbox - overlay = Overlay - .header_bar_1 = Headerbar - .header_bar_1_placeholder = Platzhalter für Headerbar -- .add_button = Runder "Hinzufügen"-Knopf \ No newline at end of file +- .add_button = Runder "Hinzufügen"-Knopf + diff --git a/lib/basic.js b/lib/basic.js index 3b5b545..e74daef 100644 --- a/lib/basic.js +++ b/lib/basic.js @@ -468,4 +468,16 @@ async function _showProfileSave(elm) { updateAllProfiles(userData); hideOverlay("profile_overlay"); +} + +async function playSound(src) { + const elm = document.createElement("audio"); + elm.innerHTML = ` + + `; + try { + await elm.play(); + } catch(err) { + console.log("Error playing audio:", err); + } } \ No newline at end of file diff --git a/prof/auswertung.html b/prof/auswertung.html index 3a3508f..a8d0e27 100644 --- a/prof/auswertung.html +++ b/prof/auswertung.html @@ -9,7 +9,23 @@ - -

Beschreibung: diff --git a/student/skilltree.js b/student/skilltree.js index ff77311..292748d 100644 --- a/student/skilltree.js +++ b/student/skilltree.js @@ -1,4 +1,7 @@ //=> use showSkillTree() -> void; +//=> use playLevelSound() -> void; +//=> use playXPSound() -> void; + const getSkillTree = () => ({ id: "root", @@ -291,4 +294,11 @@ function generateSkillTree(skillTree, abilities) { drawNode(null, skillTree); return [svg, levelCount]; +} + +async function playLevelSound() { + await playSound("../audio/levelup2.mp3"); +} +async function playXPSound() { + await playSound("../audio/levelup1.mp3"); } \ No newline at end of file