Browse Source

now in moodle mode the student/professor can see information for a already played game
- new state "studentReport" (report page)
- new image
- new words in lang files
refactored /js/integrationFunctions.js

laira 3 years ago
parent
commit
c70de34989
16 changed files with 298 additions and 127 deletions
  1. BIN
      assets/img/scene/broken_sign.png
  2. 9 3
      assets/lang/en_US
  3. 9 3
      assets/lang/es_PE
  4. 9 3
      assets/lang/fr_FR
  5. 8 2
      assets/lang/it_IT
  6. 9 3
      assets/lang/pt_BR
  7. 4 1
      index.html
  8. 2 2
      js/circleOne.js
  9. 8 8
      js/customMenu.js
  10. 11 10
      js/globals.js
  11. 212 75
      js/integrationFunctions.js
  12. 2 2
      js/map.js
  13. 9 9
      js/menu.js
  14. 2 2
      js/preMenu.js
  15. 2 2
      js/squareOne.js
  16. 2 2
      js/squareTwo.js

BIN
assets/img/scene/broken_sign.png


+ 9 - 3
assets/lang/en_US

@@ -7,8 +7,9 @@ difficulties=Difficulties
 difficulty=Difficulty
 empty_name=You forgot to type your name
 equals=Equality
-game=GAME
-game_mode=Game Modes
+game=Game
+game_mode=Game Mode
+game_modes=Game Modes
 good_job=Good Job
 infoBox_circleOne=<li>Flight themed, in this game the character is a child who wants to fly in a balloon to get to school.</li><li>This game represents a fraction like portion of a circle (arc). Thus, the selected arcs must be proportional to the path to be traversed.</li><li>The mathematical operations with fractions represented in this game are: addition (child going to the right) and subtraction (child going to the left), besides of both operations at the same level.</li>
 infoBox_diff=Choose game difficulty. When <b>higher value</b>, <b>higher overall difficulty</b> of the levels in the level map.
@@ -35,7 +36,8 @@ nav_back=GO BACK
 nav_help=SEE SOLUTION
 nav_lang=LANGUAGE SELECTION
 nav_menu=MAIN MENU
-operation=Operations
+operation=Operation
+operations=Operations
 operation_math=Math Operations
 plus=Sum
 ready=READY
@@ -45,3 +47,7 @@ show=Show
 square=Quadrangles
 title=Fractions
 welcome=Hi
+hits=Hits
+errors=Errors
+time=Time
+results=RESULTS

File diff suppressed because it is too large
+ 9 - 3
assets/lang/es_PE


File diff suppressed because it is too large
+ 9 - 3
assets/lang/fr_FR


File diff suppressed because it is too large
+ 8 - 2
assets/lang/it_IT


File diff suppressed because it is too large
+ 9 - 3
assets/lang/pt_BR


+ 4 - 1
index.html

@@ -146,7 +146,7 @@ www.usp.br/line
     <script src="js/squareTwo.js"></script>
     <script src="js/gameMechanics.js"></script>
     <script src="js/globals.js"></script>
-    <!-- MOODLE MODIF. -->
+    <!-- MOODLE -->
     <script src="js/integrationFunctions.js"></script>
 
     <script>
@@ -176,6 +176,9 @@ www.usp.br/line
       game.state.add('circleOne', circleOne);
       game.state.add('squareTwo', squareTwo);
 
+      // MOODLE
+      game.state.add('studentReport', studentReport);
+
       // CALLING FIRST GAME STATE
       game.state.start('boot');
     </script>

+ 2 - 2
js/circleOne.js

@@ -81,7 +81,7 @@
 
     // Calls function that loads navigation icons
 
-    // MOODLE MODIF.
+    // MOODLE
     if (moodle) {
       navigationIcons.func_addIcons(
         false, false, false, // Left buttons
@@ -604,7 +604,7 @@
       + ' balloonX: ' + self.basket.x
       + ', selIndex: ' + self.fractionIndex;
 
-    // MOODLE MODIF.
+    // MOODLE
     if (moodle) sendToDB(data, self.result, game.timer.elapsed);
     else sendToDB(data);
   }

+ 8 - 8
js/customMenu.js

@@ -21,7 +21,7 @@ const customMenuState = {
    */
   create: function () {
 
-    // MOODLE MODIF.
+    // MOODLE
     if (moodle && iLMparameters.iLM_PARAM_SendAnswer == 'false') {
       game.state.start('map');
     } else {
@@ -36,7 +36,7 @@ const customMenuState = {
       for (let i = 0; i < defaultWidth / 100; i++) { game.add.image(i * 100, 501, 'floor'); }
 
       // Overtitle : Selected game
-      game.add.text(defaultWidth / 2, 40, game.lang.game + ": " + menuState.menuIcons, textStyles.h4_brown);
+      game.add.text(defaultWidth / 2, 40, game.lang.game.toUpperCase() + ": " + menuState.menuIcons, textStyles.h4_brown);
       // Title : Customize the selected game
       game.add.text(defaultWidth / 2, 80, game.lang.custom_game, textStyles.h1_green);
 
@@ -54,7 +54,7 @@ const customMenuState = {
       let offsetH, infoIcon;
 
       // Label 'Game Modes'
-      game.add.text(x + offsetW - 12, y, game.lang.game_mode, textStyles.h2_blue_2);
+      game.add.text(x + offsetW - 12, y, game.lang.game_modes, textStyles.h2_blue_2);
 
       infoIcon = game.add.image(x + 2 * offsetW - 30, y - 40, 'info', 0.5, 0.4);
       infoIcon.anchor(0.5, 0.5);
@@ -63,7 +63,7 @@ const customMenuState = {
       this.menuIcons.push(infoIcon);
 
       // Label 'Operations'
-      game.add.text(x + 3 * offsetW, y, game.lang.operation, textStyles.h2_blue_2);
+      game.add.text(x + 3 * offsetW, y, game.lang.operations, textStyles.h2_blue_2);
 
       infoIcon = game.add.image(x + 4 * offsetW - 30, y - 40, 'info', 0.5, 0.4);
       infoIcon.anchor(0.5, 0.5);
@@ -202,7 +202,7 @@ const customMenuState = {
 
       // --------------------------- ENTER ICON
 
-      // MOODLE MODIF.
+      // MOODLE
       if (!moodle) {
 
         x = defaultWidth - 100;
@@ -238,7 +238,7 @@ const customMenuState = {
 
         gameMode: {
           squareOne: {
-            title: '<b>' + game.lang.game_mode + '</b>',
+            title: '<b>' + game.lang.game_modes + '</b>',
             body: game.lang.infoBox_mode,
             img: '<table> <tr> <td> <b>A)</b> ' + game.lang.infoBox_mode_s1_A +
               ' </td> <td> <b>B)</b> ' + game.lang.infoBox_mode_s1_B +
@@ -246,7 +246,7 @@ const customMenuState = {
               ' </td> <td> <img width=100% src="'+game.image['s1-B-h'].src+'"> </td> </tr> <table>'
           },
           circleOne: {
-            title: '<b>' + game.lang.game_mode + '</b>',
+            title: '<b>' + game.lang.game_modes + '</b>',
             body: game.lang.infoBox_mode,
             img: '<table> <tr style="border-bottom: 5px solid white"> <td width=70%> <img width=100% src="'+game.image['c1-A-h'].src+'">' +
             ' </td> <td> &nbsp; <b>A)</b> ' + game.lang.infoBox_mode_c1_A +
@@ -254,7 +254,7 @@ const customMenuState = {
             ' </td> <td> &nbsp; <b>B)</b> ' + game.lang.infoBox_mode_c1_B +'</td> </tr> <table>'
           },
           squareTwo: {
-            title: '<b>' + game.lang.game_mode + '</b>',
+            title: '<b>' + game.lang.game_modes + '</b>',
             body: game.lang.infoBox_mode,
             img: '<center> <table> <tr> <td> <b>A)</b> ' + game.lang.infoBox_mode_s2_A +
             ' </td> <td> <b>B)</b> ' + game.lang.infoBox_mode_s2_B +

+ 11 - 10
js/globals.js

@@ -23,7 +23,7 @@
  * @type {boolean}
  */
 const debugMode = false;
-// MOODLE MODIF.
+// MOODLE
 /**
  * defines if the game is suposed to run online or on moodle <br>
  * - if true, on moodle <br>
@@ -282,6 +282,7 @@ const url = {
       // Scene
       ['bgimage', medSrc + 'scene/bg.jpg'],
       ['bgmap', medSrc + 'scene/bg_map.png'],
+      ['broken_sign', medSrc + 'scene/broken_sign.png'],
       ['bush', medSrc + 'scene/bush.png'],
       ['cloud', medSrc + 'scene/cloud.png'],
       ['floor', medSrc + 'scene/floor.png'],
@@ -570,7 +571,7 @@ const navigationIcons = {
  */
 const sendToDB = function (extraData) {
 
-  // MOODLE MODIF.
+  // MOODLE
   if (moodle) {
 
     if (self.result) moodleVar.hits[mapPosition - 1]++;
@@ -590,20 +591,20 @@ const sendToDB = function (extraData) {
 
     const url = 'php/save.php';
 
-    const hr = new XMLHttpRequest();
+    const xhr = new XMLHttpRequest();
 
-    hr.open('POST', url, true);
+    xhr.open('POST', url, true);
 
-    hr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
+    xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
 
-    hr.onreadystatechange = function () {
-      if (debugMode) console.log(hr);
-      if (hr.readyState == 4 && hr.status == 200) {
-        if (debugMode) console.log(hr.responseText);
+    xhr.onreadystatechange = function () {
+      if (debugMode) console.log(xhr);
+      if (xhr.readyState == 4 && xhr.status == 200) {
+        if (debugMode) console.log(xhr.responseText);
       }
     }
 
-    hr.send(data); // Actually execute the request
+    xhr.send(data); // Actually execute the request
 
     if (debugMode) {
       console.log('processing...');

+ 212 - 75
js/integrationFunctions.js

@@ -1,29 +1,56 @@
-// MOODLE MODIF.
-if (debugMode) console.log("(integrationFunctions.js start)");
+/* MOODLE
+ * 
+ * These functions are used exclusively when iFractions is runnign inside Moodle as an iAssign module. <br>
+ * In this case, the global variable 'moodle' must be 'true' (globals.js) <br> 
+ * More about iAssign functions and parameters : https://www.ime.usp.br/~igormf/ima-tutorial/ (pt-br)
+ */
 
-const moodleVar = {
-  hits: [0,0,0,0],
-  errors: [0,0,0,0],
-  time: [0,0,0,0]
-}
+const iLMparameters = {
+  /* Este parâmetro serve para distinguir a situação em que o iMA está sendo manuseado, 
+  * - Quando elaboração de atividade (professor), o valor é: true, 
+  * - Quando resolução do exercício (aluno), o valor é false. */
+  iLM_PARAM_SendAnswer: getParameterByName("iLM_PARAM_SendAnswer"), // Checks if you're student (false) or professor (true)
+  /* Este parâmetro é informado quando o usuário está abrindo uma atividade interativa para resolvê-la. 
+   * Tem como valor uma URL, que serve para acessar o exercício criado pelo professor.
+   * Exemplo de valor: http://myschool.edu/moodle/mod/iassign/ilm_security.php?id=3&token=b3660dd4de0b0e9bb01fea6cc8f02ccd&view=1
+   * Observe que o conteúdo do parâmetro token, presente na URL é acessível uma única vez, 
+   * ou seja, quando o iMA acessá-la (via AJAX), 
+   * obterá a informação a respeito da atividade, 
+   * não podendo acessá-la novamente, pois a token será destruída por razões de segurança. */
+  iLM_PARAM_Assignment: getParameterByName("iLM_PARAM_Assignment"),
+  /* Este parâmetro informa ao iMA em que idioma o Moodle está sendo utilizado, 
+   * permitindo a internacionalização. Exemplos de valores: en para inglês; pt para português.*/
+  lang: getParameterByName("lang"),
+  iLM_PARAM_ServerToGetAnswerURL: getParameterByName("iLM_PARAM_ServerToGetAnswerURL"),
+  iLM_PARAM_ServerToGetAnswerURL: getParameterByName("iLM_PARAM_ServerToGetAnswerURL")
+};
 
-function getParameterByName (name) {
+/* [iAssign function]
+ * The iLM will be included in the HTML page as an iFrame, 
+ * therefore some parameters are going to be passed by the iAssign to the iLM via URL.
+ * 
+ * This method is used to read the informed parameters.
+ */
+function getParameterByName(name) {
   var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
   return match ? decodeURIComponent(match[1].replace(/\+/g, ' ')) : null;
 }
 
-const iLMparameters = {
-  iLM_PARAM_ServerToGetAnswerURL: getParameterByName("iLM_PARAM_ServerToGetAnswerURL"),
-  iLM_PARAM_SendAnswer: getParameterByName("iLM_PARAM_SendAnswer"),
-  iLM_PARAM_AssignmentURL: getParameterByName("iLM_PARAM_AssignmentURL"),
-  iLM_PARAM_Assignment: getParameterByName("iLM_PARAM_Assignment"),
-  lang: getParameterByName("lang")
-};
-
+/* [iAssign function]
+ * Este método é invocado automaticamente pelo iTarefa, em dois diferentes momentos:
+ *
+ * - Quando o PROFESSOR está elaborando a atividade e a finaliza, clicando no botão "Salvar". 
+ *   Retorna: dados da atividade criada;
+ * 
+ * - Quando o ESTUDANTE está resolvendo um exercício e aciona o botão "Salvar", 
+ *   Retorna: resposta do estudante para a atividade.
+ * 
+ * Para ambos os casos, o retorno deste método será recebido pelo iTarefa e será armazenado no banco de dados.
+ */
 function getAnswer() {
   if (debugMode) console.log("(integrationFunctions.js) start getAnswer()");
   let str = '';
-  if (iLMparameters.iLM_PARAM_SendAnswer == 'false') { // student - sending results
+  if (iLMparameters.iLM_PARAM_SendAnswer == 'false') { // Student - sending results
     str += 'gameTypeString:' + gameTypeString
       + '\ngameShape:' + gameShape
       + '\ngameModeType:' + gameModeType
@@ -31,14 +58,14 @@ function getAnswer() {
       + '\ngameDifficulty:' + gameDifficulty
       + '\nfractionLabel:' + fractionLabel
       + '\nresults:';
-    for (let i = 0; i < moodleVar.hits.length; i++) { // professor - creating new assignment
-      str += '{level:' + (i + 1)
-        + ',hits:' + moodleVar.hits[i]
-        + ',errors:' + moodleVar.errors[i]
-        + ',timeElapsed:' + moodleVar.time[i]
+    for (let i = 0; i < moodleVar.hits.length; i++) {
+      str += '{level=' + (i + 1)
+        + ',hits=' + moodleVar.hits[i]
+        + ',errors=' + moodleVar.errors[i]
+        + ',timeElapsed=' + moodleVar.time[i]
         + '}';
     }
-  } else { // professor
+  } else { // Professor - creating new assignment
     if (!gameType) {
       alert("Erro: Você precisa escolher pelo menos um jogo");
       return x;
@@ -55,76 +82,186 @@ function getAnswer() {
   }
 
   if (debugMode) {
-    console.log(str); 
+    console.log(str);
     console.log("(integrationFunctions.js) end getAnswer()");
   }
 
   return str;
 }
 
+/* [iAssign function]
+ * Esta função deve estar presente nos iMA que possuem avaliador automático. 
+ * Esta função é invocada pelo iTarefa, quando o aluno submete sua solução para avaliação, 
+ * portanto, toda a avaliação deve ser realizada quando o método getEvaluation() é chamado. 
+ * O retorno deve ser um número real entre 0.0 e 1.0, que significa a nota atribuída ao aluno.
+ * Esta nota será armazenada no banco de dados.
+ */
 function getEvaluation() {
-  if (iLMparameters.iLM_PARAM_SendAnswer == 'false') { // student
-    // TODO - evaluation method
-    const nota = 1;
-    parent.getEvaluationCallback(nota);
-    return nota;
+  if (iLMparameters.iLM_PARAM_SendAnswer == 'false') { // Student
+    let i;
+    for (i = 0; i < moodleVar.hits.length && moodleVar.hits[i] == 1; i++);
+    const grade = i / 4;
+    parent.getEvaluationCallback(grade); // Sends grade to moodle database
+    return grade;
   }
 }
 
-function decodificaArquivo(text) {
-  let gameInfo = {};
-  let line = text.split('\n');
-  line.forEach(cur => {
-    try {
-      let newline = cur.split(':');
-      const chave = newline[0].replace(/^\s+|\s+$/g, '');
-      const valor = newline[1].replace(/^\s+|\s+$/g, '');
-      gameInfo[chave.trim()] = valor.trim();
-    } catch (Error) { console.error('Sintax error'); }
-  });
-  // update global variables
-  gameTypeString = gameInfo['gameTypeString'];
-  gameShape = gameInfo['gameShape'];
-  gameModeType = gameInfo['gameModeType'];
-  gameOperationType = gameInfo['gameOperationType'];
-  gameDifficulty = parseInt(gameInfo['gameDifficulty']);
-  fractionLabel = gameInfo['fractionLabel'];
-  if (debugMode) console.log("(integrationFunctions.js) decodificaArquivo() :", gameTypeString, gameShape, gameModeType, gameOperationType, gameDifficulty, fractionLabel);
-  // Reset global variables to default values
-  mapPosition = 0; 
+function getiLMContent() {
+
+  if (debugMode) console.log("(integrationFunctions.js) getiLMContent(): start.");
+
+  const url = iLMparameters.iLM_PARAM_Assignment;
+
+  if (url == null) {
+    console.error("Error: (integrationFunctions.js) getiLMContent(): NAO existe arquivo FRC para ser carregado (iLMparameters.iLM_PARAM_Assignment vazio), finalize.");
+    return;
+  } else {
+    if (debugMode) console.log("(integrationFunctions.js) getiLMContent(): try to get file in " + url);
+  }
+
+  let xhr = new XMLHttpRequest();
+  xhr.open("GET", url, true);
+  xhr.send();
+  xhr.responseType = "text";
+  xhr.onreadystatechange = function () {
+    if (xhr.readyState === 4 && xhr.status === 200) {
+      const txt = xhr.responseText;
+      breakString(txt);
+    }
+  }
+
+  if (debugMode) console.log("(integrationFunctions.js) getiLMContent(): end.");
+}
+
+function updateGlobalVariables(info, infoResults) {
+  // Update new values
+  gameTypeString = info['gameTypeString'];
+  gameShape = info['gameShape'];
+  gameModeType = info['gameModeType'];
+  gameOperationType = info['gameOperationType'];
+  gameDifficulty = parseInt(info['gameDifficulty']);
+  fractionLabel = info['fractionLabel'];
+
+  // Update default values
+  mapPosition = 0;
   mapMove = true;
   completedLevels = 0;
 
-  if (iLMparameters.iLM_PARAM_SendAnswer == 'false') { // student
-    iLMparameters.return_get_answer = 1;
-    iLMparameters.iLM_PARAM_ActivityEvaluation = ((mapPosition == 4) ? 1 : 0);
-    iLMparameters.iLM_PARAM_ArchiveContent = text;
-  } else { // professor
-    iLMparameters.iLM_PARAM_ActivityEvaluation = 0;
-    iLMparameters.iLM_PARAM_ArchiveContent = text;
+  // Calls custom menu after updating game variables 
+  if (infoResults) {
+    for (let i = 0; i < moodleVar.hits.length; i++) {
+      moodleVar.hits[i] = infoResults['l' + (i + 1)].hits;
+      moodleVar.errors[i] = infoResults['l' + (i + 1)].errors;
+      moodleVar.time[i] = infoResults['l' + (i + 1)].timeElapsed;
+    }
+    game.state.start('studentReport');
+  } else {
+    game.state.start('customMenu');
   }
 
-  game.state.start('customMenu'); // calls custom menu after updating game variables
 }
 
-function getiLMContent() {
-  const url = iLMparameters.iLM_PARAM_Assignment;
-  if (iLMparameters.iLM_PARAM_Assignment == null) {
-    console.log("(integrationFunctions.js) getiLMContent(): NAO existe arquivo FRC para ser carregado (iLMparameters.iLM_PARAM_Assignment vazio), finalize.");
-    return;
+function breakString(text) {
+  let gameInfo = {}, results;
+  let lines = text.split('\n'); // Break by line
+  lines.forEach(cur => {
+    try {
+      let line = cur.split(':'); // Break by key:value
+      if (line[0] != 'results') {
+        const key = line[0].replace(/^\s+|\s+$/g, ''); // Removes end character
+        const value = line[1].replace(/^\s+|\s+$/g, '');
+        gameInfo[key.trim()] = value.trim(); // Removes extra space
+      } else {
+        results = line[1].replace(/^\s+|\s+$/g, '');
+      }
+    } catch (Error) { console.error('Sintax error'); }
+  });
+  if (results) {
+    let curLevel = results.split('}');
+    results = { l1: {}, l2: {}, l3: {}, l4: {} };
+    let i = 1;
+    curLevel.forEach(cur => {
+      cur = cur.substring(1); // Remove {
+      cur = cur.split(','); // Break by line
+      cur.forEach(cur => {
+        try {
+          if (cur.length != 0) {
+            let line = cur.split('='); // Break by key=value
+            const key = line[0].replace(/^\s+|\s+$/g, ''); // Removes end char
+            const value = line[1].replace(/^\s+|\s+$/g, ''); // Removes end char
+            results['l' + i][key] = parseInt(value); // Removes extra space    
+          }
+        } catch (Error) { console.error('Sintax error'); }
+      });
+      i++;
+    });
   }
-  if (debugMode) console.log("(integrationFunctions.js) getiLMContent(): tenta pegar arquivo de " + url);
-  let gameFile = new XMLHttpRequest();
-  gameFile.open("GET", url, true);
-  gameFile.send();
-  gameFile.responseType = "text";
-  gameFile.onreadystatechange = function () {
-    if (gameFile.readyState === 4 && gameFile.status === 200) {
-      const text = gameFile.responseText;
-      decodificaArquivo(text);
-    }
+  updateGlobalVariables(gameInfo, results);
+}
+
+const moodleVar = {
+  hits: [0, 0, 0, 0],
+  errors: [0, 0, 0, 0],
+  time: [0, 0, 0, 0]
+}
+
+function convertTime(s) {
+  let h = 0, m = 0;
+
+  if (s > 1200) {
+    h = s / 1200;
+    s = s % 1200;
+  }
+
+  if (s > 60) {
+    m = s / 60;
+    s = s % 60;
   }
-  if (debugMode) console.log("(integrationFunctions.js) getiLMContent(): final");
+
+  h = '' + h;
+  m = '' + m;
+  s = '' + s;
+
+  if (h.length < 2) h = '0' + h;
+  if (m.length < 2) m = '0' + m;
+  if (s.length < 2) s = '0' + s;
+
+  return h + ':' + m + ':' + s;
+
 }
 
-if (debugMode) console.log("(integrationFunctions.js start)");
+const studentReport = {
+  create: function () {
+    const offsetW = defaultWidth / 4;
+    let x = offsetW / 2;
+    let y = defaultHeight/2 - 50;
+    game.add.graphic.rect(0, 0, 900, 600, undefined, 0, colors.blueBckg, 1);
+    game.add.image(300, 100, 'cloud');
+    game.add.image(660, 80, 'cloud');
+    game.add.image(110, 85, 'cloud', 0.8);
+    for (let i = 0; i < 9; i++) { game.add.image(i * 100, 501, 'floor'); }
+    game.add.text(defaultWidth / 2, 80, game.lang.results, textStyles.h1_green);
+    game.add.image(x - 40, y - 70, info[gameTypeString].gameTypeUrl, 0.8);
+    text = game.lang[gameShape].charAt(0).toUpperCase() + game.lang[gameShape].slice(1);
+    text = game.lang.game + ': ' + text + ((gameTypeString.substring(-3) == 'One') ? ' I' :' II');
+    game.add.text(190, y - 50, text, textStyles.h4_brown).align = 'left';
+    game.add.text(190, y - 25, game.lang.game_mode + ': ' + gameModeType, textStyles.h4_brown).align = 'left';
+    game.add.text(190, y, game.lang.operation + ': ' + gameOperationType, textStyles.h4_brown).align = 'left';
+    game.add.text(190, y + 25, game.lang.difficulty + ': ' + gameDifficulty, textStyles.h4_brown).align = 'left';
+    y = defaultHeight - 200;
+    for (let i = 0; i < 4; i++, x += offsetW) {
+      if (moodleVar.hits[i] == 0) {
+        const sign = game.add.image(x, defaultHeight - 100, 'broken_sign', 0.7);
+        sign.anchor(0.5, 0.5);
+        continue;
+      }
+      const sign = game.add.image(x, defaultHeight - 100, 'sign', 0.7);
+      sign.anchor(0.5, 0.5)
+      game.add.text(x, defaultHeight - 100, '' + (i + 1), textStyles.h2_white);
+      game.add.graphic.rect(x - 55, y - 40, 5, 135, undefined, 0, colors.blueMenuLine)//.anchor(0, 0.5);
+      game.add.text(x - 40, y - 25, game.lang.time + ': ' + convertTime(moodleVar.time[i]), textStyles.h4_brown).align = 'left';
+      game.add.text(x - 40, y, game.lang.hits + ': ' + moodleVar.hits[i], textStyles.h4_brown).align = 'left';
+      game.add.text(x - 40, y + 25, game.lang.errors + ': ' + moodleVar.errors[i], textStyles.h4_brown).align = 'left';
+    }
+  }
+}

+ 2 - 2
js/map.js

@@ -18,7 +18,7 @@ const mapState = {
 
     // Calls function that loads navigation icons
 
-    // MOODLE MODIF.
+    // MOODLE
     if (moodle) {
       navigationIcons.func_addIcons(
         false, false, false, // Left icons
@@ -353,7 +353,7 @@ const endState = {
         completedLevels = 0;
         game.animation.stop(self.character.animation[0]);
 
-        // MOODLE MODIF.
+        // MOODLE
         if (!moodle) game.state.start('menu');
 
       }

+ 9 - 9
js/menu.js

@@ -21,7 +21,7 @@ const menuState = {
    */
   create: function () {
 
-    // MOODLE MODIF.
+    // MOODLE
     if (moodle && iLMparameters.iLM_PARAM_SendAnswer == 'false') {
 
       playerName = 'Aluno'; // TODO pegar o nome do aluno no bd do moodle
@@ -29,7 +29,7 @@ const menuState = {
 
     } else {
 
-      // MOODLE MODIF.
+      // MOODLE
       if (moodle && iLMparameters.iLM_PARAM_SendAnswer == 'true') playerName = 'Professor';
 
       // Background color
@@ -97,19 +97,19 @@ const menuState = {
 
       this.infoBoxContent = {
         squareOne: {
-          title: '<b>' + game.lang.game.toLowerCase() + ':</b> ' + game.lang.square + ' I',
+          title: '<b>' + game.lang.game + ':</b> ' + game.lang.square + ' I',
           body: '<ul>' + game.lang.infoBox_squareOne + '</ul>',
-          img: '<center> <img width=60% src="'+game.image['s1-A'].src+'"./assets/img/info_box/s1-A.png"> </center>'
+          img: '<center> <img width=60% src="' + game.image['s1-A'].src + '"./assets/img/info_box/s1-A.png"> </center>'
         },
         circleOne: {
-          title: '<b>' + game.lang.game.toLowerCase() + ':</b> ' + game.lang.circle + ' I',
+          title: '<b>' + game.lang.game + ':</b> ' + game.lang.circle + ' I',
           body: '<ul>' + game.lang.infoBox_circleOne + '</ul>',
-          img: '<center> <img width=80% src="'+game.image['c1-A'].src+'"> </center>',
+          img: '<center> <img width=80% src="' + game.image['c1-A'].src + '"> </center>',
         },
         squareTwo: {
-          title: '<b>' + game.lang.game.toLowerCase() + ':</b> ' + game.lang.square + ' II',
+          title: '<b>' + game.lang.game + ':</b> ' + game.lang.square + ' II',
           body: '<ul>' + game.lang.infoBox_squareTwo + '</ul>',
-          img: '<center> <img width=80% src="'+game.image['s2'].src+'"> </center>',
+          img: '<center> <img width=80% src="' + game.image['s2'].src + '"> </center>',
         }
       };
 
@@ -172,7 +172,7 @@ const menuState = {
 
     let title = game.lang[icon.gameShape];
 
-    const type = icon.gameType.substring(icon.gameType.length - 3);
+    const type = icon.gameType.substring(-3);
 
     switch (type) {
       case 'One': title += ' I'; break;

+ 2 - 2
js/preMenu.js

@@ -21,7 +21,7 @@ const bootState = {
 
     // Calls first screen seen by the player
 
-    // MOODLE MODIF.
+    // MOODLE
     if (moodle) {
       loadLangState.firstTime = false;
       const moodleLang = iLMparameters.lang;
@@ -295,7 +295,7 @@ const nameState = {
     if (audioStatus) game.audio.beepSound.play();
     if (debugMode) console.log('Username: ' + playerName);
 
-    // MOODLE MODIF.
+    // MOODLE
     // Calls 'menu' state
     if (!moodle) game.state.start('menu');
   }

+ 2 - 2
js/squareOne.js

@@ -68,7 +68,7 @@ const squareOne = {
 
     // Calls function that loads navigation icons
 
-    // MOODLE MODIF.
+    // MOODLE
     if (moodle) {
       navigationIcons.func_addIcons(
         false, false, false, // Left icons
@@ -676,7 +676,7 @@ const squareOne = {
       + ' blockIndex: ' + self.stck.index
       + ', floorIndex: ' + self.floor.index;
 
-    // MOODLE MODIF.  
+    // MOODLE  
     if (moodle) sendToDB(data, self.result, game.timer.elapsed);
     else sendToDB(data);
   },

+ 2 - 2
js/squareTwo.js

@@ -72,7 +72,7 @@ const squareTwo = {
 
     // Calls function that loads navigation icons
 
-    // MOODLE MODIF.
+    // MOODLE
     if (moodle) {
       navigationIcons.func_addIcons(
         false, false, false, // Left buttons
@@ -471,7 +471,7 @@ const squareTwo = {
       + ', numBlocksB: ' + self.B.blocks.length
       + ', valueB: ' + self.B.selected;
 
-    // MOODLE MODIF.
+    // MOODLE
     if (moodle) sendToDB(data, self.result, game.timer.elapsed);
     else sendToDB(data);
   }