Merge pull request #1 from h5p/master

update to current version
pull/11/head
vsext 2016-10-26 15:18:33 +02:00 committed by GitHub
commit 62375690ff
5 changed files with 82 additions and 15 deletions

13
card.js
View File

@ -99,4 +99,17 @@
MemoryGame.Card.prototype = Object.create(EventDispatcher.prototype);
MemoryGame.Card.prototype.constructor = MemoryGame.Card;
/**
* Check to see if the given object corresponds with the semantics for
* a memory game card.
*
* @param {object} params
* @returns {boolean}
*/
MemoryGame.Card.isValid = function (params) {
return (params !== undefined &&
params.image !== undefined &&
params.image.path !== undefined);
};
})(H5P.MemoryGame, H5P.EventDispatcher, H5P.jQuery);

View File

@ -2,7 +2,7 @@
"semantics": [
{
"label": "Cartes",
"entity": "une carte",
"entity": "carte",
"field": {
"label": "Carte",
"fields": [
@ -17,19 +17,19 @@
}
},
{
"label": "Localisation",
"label": "Interface",
"fields": [
{
"label": "Texte pour une carte à retourner",
"default": "Retourner"
"label": "Texte pour le nombre de cartes retournées",
"default": "Cartes retournées :"
},
{
"label": "Texte pour le temps passé",
"default": "Durée écoulée"
"default": "Temps écoulé :"
},
{
"label": "Texte de feedback",
"default": "Bon travail!"
"label": "Texte de l'appréciation finale",
"default": "Bien joué !"
}
]
}

50
language/nb.json Normal file
View File

@ -0,0 +1,50 @@
{
"semantics": [
{
"englishLabel": "Cards",
"label": "Kort",
"englishEntity": "card",
"entity": "kort",
"field": {
"englishLabel": "Card",
"label": "Kort",
"fields": [
{
"englishLabel": "Image",
"label": "Bilde"
},
{
"englishLabel": "Description",
"label": "Beskrivelse",
"englishDescription": "A short text that is displayed once the two equal cards are found.",
"description": "En kort tekst som vises hver gang et kort-par er funnet."
}
]
}
},
{
"englishLabel": "Localization",
"label": "Oversettelser",
"fields": [
{
"englishLabel": "Card turns text",
"label": "Etikett for antall vendte kort",
"englishDefault": "Card turns",
"default": "Kort vendt"
},
{
"englishLabel": "Time spent text",
"label": "Etikett for tid brukt",
"englishDefault": "Time spent",
"default": "Tid brukt"
},
{
"englishLabel": "Feedback text",
"label": "Tilbakemeldingstekst",
"englishDefault": "Good work!",
"default": "Godt jobbet!"
}
]
}
]
}

View File

@ -3,7 +3,7 @@
"description": "See how many cards you can remember!",
"majorVersion": 1,
"minorVersion": 1,
"patchVersion": 6,
"patchVersion": 10,
"runnable": 1,
"author": "Amendor AS",
"license": "MIT",

View File

@ -36,12 +36,15 @@ H5P.MemoryGame = (function (EventDispatcher, $) {
var finished = (removed === cards.length);
var desc = card.getDescription();
if (finished) {
self.triggerXAPIScored(1, 1, 'completed');
}
if (desc !== undefined) {
// Pause timer and show desciption.
timer.stop();
popup.show(desc, card.getImage(), function () {
if (finished) {
self.triggerXAPIScored(1, 1, 'completed');
// Game has finished
$feedback.addClass('h5p-show');
}
@ -52,7 +55,6 @@ H5P.MemoryGame = (function (EventDispatcher, $) {
});
}
else if (finished) {
self.triggerXAPIScored(1, 1, 'completed');
// Game has finished
timer.stop();
$feedback.addClass('h5p-show');
@ -101,12 +103,14 @@ H5P.MemoryGame = (function (EventDispatcher, $) {
// Initialize cards.
for (var i = 0; i < parameters.cards.length; i++) {
if (MemoryGame.Card.isValid(parameters.cards[i])) {
// Add two of each card
var cardOne = new MemoryGame.Card(parameters.cards[i], id);
var cardTwo = new MemoryGame.Card(parameters.cards[i], id);
addCard(cardOne, cardTwo);
addCard(cardTwo, cardOne);
}
}
H5P.shuffleArray(cards);
/**