Skip to content

Commit

Permalink
Merge pull request #47 from otacke/fix-full-score-zero-lifes
Browse files Browse the repository at this point in the history
Fix full score with zero lifes
  • Loading branch information
otacke authored Nov 14, 2023
2 parents 1528940 + bb90d13 commit 1a787bf
Show file tree
Hide file tree
Showing 15 changed files with 108 additions and 14 deletions.
8 changes: 8 additions & 0 deletions language/.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,10 @@
"label": "Completed the map",
"default": "You have completed the map!"
},
{
"label": "Full score, but no lives left",
"default": "You have achieved full score, but lost all your lifes!"
},
{
"label": "Dialog header finish map",
"default": "Finish map?"
Expand Down Expand Up @@ -478,6 +482,10 @@
"label": "Dialog text full score",
"default": "You have collected enough points to finish this map with a full score, but you are free to explore the rest if you wish to."
},
{
"label": "Dialog text full score (amendment, if lives are set)",
"default": "But beware! You may still lose lives!"
},
{
"label": "OK",
"default": "OK"
Expand Down
8 changes: 8 additions & 0 deletions language/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,10 @@
"label": "Karte abgeschlossen",
"default": "Du hast die Karte abgeschlossen!"
},
{
"label": "Volle Punktzahl, aber keine Leben mehr",
"default": "Du hast die volle Punktzahl erreicht, aber alle deine Leben verloren!"
},
{
"label": "Dialogüberschrift Karte abgeschlossen",
"default": "Karte beenden?"
Expand Down Expand Up @@ -478,6 +482,10 @@
"label": "Dialogtext Volle Punktzahl",
"default": "Du hast genügend Punkte gesammelt, um die Karte mit voller Punktzahl abzuschließen, aber du darfst gerne den Rest der Karte erkunden, wenn du möchtest."
},
{
"label": "Dialogtext Volle Punktzahl (Erweiterung, falls Leben eingestellt sind)",
"default": "Aber Vorsicht! Du kannst immer noch Leben verlieren!"
},
{
"label": "OK",
"default": "OK"
Expand Down
10 changes: 9 additions & 1 deletion language/es-mx.json
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,10 @@
"label": "Completado el mapa",
"default": "¡Usted ha completado el mapa!"
},
{
"label": "Full score, but no lives left",
"default": "You have achieved full score, but lost all your lifes!"
},
{
"label": "Encabezado de diálogo de mapa terminado",
"default": "¿Terminar mapa?"
Expand Down Expand Up @@ -478,6 +482,10 @@
"label": "Texto de diálogo puntaje completo",
"default": "Usted ha reunido suficientes puntos para terminar este mapa con un puntaje completo, pero usted es libre de explorar el resto si así lo desea."
},
{
"label": "Dialog text full score (amendment, if lives are set)",
"default": "But beware! You may still lose lives!"
},
{
"label": "OK",
"default": "OK"
Expand Down Expand Up @@ -588,4 +596,4 @@
]
}
]
}
}
10 changes: 9 additions & 1 deletion language/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,10 @@
"label": "Completó el mapa",
"default": "¡Has completado el mapa!"
},
{
"label": "Full score, but no lives left",
"default": "You have achieved full score, but lost all your lifes!"
},
{
"label": "Encabezado del cuadro de diálogo de finalización de mapa",
"default": "¿Terminar mapa?"
Expand Down Expand Up @@ -478,6 +482,10 @@
"label": "Texto del diálogo de puntuación completa",
"default": "Has acumulado suficientes puntos para terminar este mapa con la puntuación completa, pero eres libre de explorar el resto si lo deseas."
},
{
"label": "Dialog text full score (amendment, if lives are set)",
"default": "But beware! You may still lose lives!"
},
{
"label": "OK",
"default": "OK"
Expand Down Expand Up @@ -588,4 +596,4 @@
]
}
]
}
}
8 changes: 8 additions & 0 deletions language/eu.json
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,10 @@
"label": "Completed the map",
"default": "You have completed the map!"
},
{
"label": "Full score, but no lives left",
"default": "You have achieved full score, but lost all your lifes!"
},
{
"label": "Dialog header finish map",
"default": "Finish map?"
Expand Down Expand Up @@ -478,6 +482,10 @@
"label": "Dialog text full score",
"default": "You have collected enough points to finish this map with a full score, but you are free to explore the rest if you wish to."
},
{
"label": "Dialog text full score (amendment, if lives are set)",
"default": "But beware! You may still lose lives!"
},
{
"label": "OK",
"default": "OK"
Expand Down
10 changes: 9 additions & 1 deletion language/gl.json
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,10 @@
"label": "Completado o mapa",
"default": "Completaches o mapa!"
},
{
"label": "Full score, but no lives left",
"default": "You have achieved full score, but lost all your lifes!"
},
{
"label": "Cabeceira do diálogo do mapa de finalización",
"default": "Rematar o mapa?"
Expand Down Expand Up @@ -478,6 +482,10 @@
"label": "Texto do diálogo de puntuación completa",
"default": "Acumulaches puntos suficientes para rematar este mapa cunha puntuación completa, pero podes explorar o resto se queres."
},
{
"label": "Dialog text full score (amendment, if lives are set)",
"default": "But beware! You may still lose lives!"
},
{
"label": "OK",
"default": "OK"
Expand Down Expand Up @@ -588,4 +596,4 @@
]
}
]
}
}
10 changes: 9 additions & 1 deletion language/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,10 @@
"label": "完成地图",
"default": "您已完成地图!"
},
{
"label": "Full score, but no lives left",
"default": "You have achieved full score, but lost all your lifes!"
},
{
"label": "完成地图对话框标题",
"default": "完成地图?"
Expand Down Expand Up @@ -478,6 +482,10 @@
"label": "满分对话框文本",
"default": "您已经得到了足够的分数,以满分完成了这张地图。如果您愿意,您可以自由探索其余部分。"
},
{
"label": "Dialog text full score (amendment, if lives are set)",
"default": "But beware! You may still lose lives!"
},
{
"label": "OK",
"default": "OK"
Expand Down Expand Up @@ -588,4 +596,4 @@
]
}
]
}
}
10 changes: 9 additions & 1 deletion language/zh-hans.json
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,10 @@
"label": "完成地图",
"default": "您已完成地图!"
},
{
"label": "Full score, but no lives left",
"default": "You have achieved full score, but lost all your lifes!"
},
{
"label": "完成地图对话框标题",
"default": "完成地图?"
Expand Down Expand Up @@ -478,6 +482,10 @@
"label": "满分对话框文本",
"default": "您已经得到了足够的分数,以满分完成了这张地图。如果您愿意,您可以自由探索其余部分。"
},
{
"label": "Dialog text full score (amendment, if lives are set)",
"default": "But beware! You may still lose lives!"
},
{
"label": "OK",
"default": "OK"
Expand Down Expand Up @@ -588,4 +596,4 @@
]
}
]
}
}
10 changes: 9 additions & 1 deletion language/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,10 @@
"label": "完成地图",
"default": "您已完成地图!"
},
{
"label": "Full score, but no lives left",
"default": "You have achieved full score, but lost all your lifes!"
},
{
"label": "完成地图对话框标题",
"default": "完成地图?"
Expand Down Expand Up @@ -478,6 +482,10 @@
"label": "满分对话框文本",
"default": "您已经得到了足够的分数,以满分完成了这张地图。如果您愿意,您可以自由探索其余部分。"
},
{
"label": "Dialog text full score (amendment, if lives are set)",
"default": "But beware! You may still lose lives!"
},
{
"label": "OK",
"default": "OK"
Expand Down Expand Up @@ -588,4 +596,4 @@
]
}
]
}
}
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Let your students choose their exercises on a game map.",
"majorVersion": 1,
"minorVersion": 1,
"patchVersion": 1,
"patchVersion": 2,
"runnable": 1,
"author": "Oliver Tacke",
"license": "MIT",
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "h5p-game-map",
"version": "1.1.1",
"version": "1.1.2",
"description": "Let your students choose their exercises on a game map.",
"private": true,
"scripts": {
Expand Down
14 changes: 13 additions & 1 deletion semantics.json
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,12 @@
"label": "Completed the map",
"default": "You have completed the map!"
},
{
"name": "fullScoreButnoLivesLeft",
"type": "text",
"label": "Full score, but no lives left",
"default": "You have achieved full score, but lost all your lifes!"
},
{
"name": "confirmFinishHeader",
"type": "text",
Expand Down Expand Up @@ -1022,6 +1028,12 @@
"label": "Dialog text full score",
"default": "You have collected enough points to finish this map with a full score, but you are free to explore the rest if you wish to."
},
{
"name": "confirmFullScoreDialogLoseLivesAmendmend",
"type": "text",
"label": "Dialog text full score (amendment, if lives are set)",
"default": "But beware! You may still lose lives!"
},
{
"name": "ok",
"type": "text",
Expand Down Expand Up @@ -1199,4 +1211,4 @@
}
]
}
]
]
8 changes: 6 additions & 2 deletions src/scripts/components/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ export default class Main {

const defaultTitle = `<p style="text-align: center;">${this.params.dictionary.get('l10n.completedMap')}</p>`;

if (score === maxScore) {
if (score >= maxScore && this.livesLeft > 0) {
const success = endscreenParams.success;
this.endScreen.setMedium(success.endScreenMediumSuccess);

Expand All @@ -266,10 +266,14 @@ export default class Main {
const noSuccess = endscreenParams.noSuccess;
this.endScreen.setMedium(noSuccess.endScreenMediumNoSuccess);

const html = Util.isHTMLWidgetFilled(noSuccess.endScreenTextNoSuccess) ?
let html = Util.isHTMLWidgetFilled(noSuccess.endScreenTextNoSuccess) ?
noSuccess.endScreenTextNoSuccess :
defaultTitle;

if (this.livesLeft === 0 && score >= maxScore) {
html = `${html}<p style="text-align: center;">${this.params.dictionary.get('l10n.fullScoreButnoLivesLeft')}</p>`;
}

this.endScreen.setIntroduction(html);
if (!this.isShowingSolutions) {
this.params.jukebox.play('endscreenNoSuccess');
Expand Down
8 changes: 7 additions & 1 deletion src/scripts/components/mixins/main-user-confirmation.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,16 @@ export default class MainUserConfirmation {
showFullScoreConfirmation() {
this.toolbar.disableButton('finish');

let dialogText = this.params.dictionary.get('l10n.confirmFullScoreDialog');

if (this.livesLeft !== Infinity) {
dialogText = `${dialogText} ${this.params.dictionary.get('l10n.confirmFullScoreDialogLoseLivesAmendmend')}`;
}

this.confirmationDialog.update(
{
headerText: this.params.dictionary.get('l10n.confirmFullScoreHeader'),
dialogText: this.params.dictionary.get('l10n.confirmFullScoreDialog'),
dialogText: dialogText,
confirmText: this.params.dictionary.get('l10n.ok'),
hideCancel: true
}, {
Expand Down

0 comments on commit 1a787bf

Please sign in to comment.