Forráskód Böngészése

fix: continue end operation display refactor

lairaalmas 1 éve
szülő
commit
bbc77e8b70
3 módosított fájl, 20 hozzáadás és 65 törlés
  1. 9 31
      js/games/circleOne.js
  2. 8 31
      js/games/squareOne.js
  3. 3 3
      js/globals/globals_debug.js

+ 9 - 31
js/games/circleOne.js

@@ -652,38 +652,22 @@ const circleOne = {
       const result =
         ('' + resultAux).length > 4 ? resultAux.toFixed(2) : resultAux;
 
-      // let fracLine = '';
-      // const updatedNominatorsString = updatedNominators
-      //   .map((n) => {
-      //     const len = ('' + n).length;
-      //     for (let i = 0; i < len; i++) fracLine += '_';
-      //     fracLine = n < 0 ? fracLine : fracLine + '_';
-      //     return n >= 0 ? '+' + n : n;
-      //   })
-      //   .join('');
-      // const fractionMiddleX = widthOfChar * (fracLine.length / 2);
-
       // Fraction operation with least common multiple
       nextX = x0 + validCircles.length * offsetX + 20;
-      // renderList.push(game.add.text(nextX, y0 + 35, '=', font));
-
-      // nextX += offsetX / 2;
-      // renderList.push(game.add.text(nextX, y0, updatedNominatorsString, font));
-      // renderList.push(
-      //   game.add.text(nextX + fractionMiddleX, y0 + 70, mmc, font)
-      // );
-      // renderList.push(game.add.text(nextX, y0, fracLine, font));
 
       // Fraction result
-      //nextX += fractionMiddleX * 2 + 50;
       renderList.push(game.add.text(nextX, y0 + 35, '=', font));
 
       font.align = 'center';
-      nextX += offsetX + 40;
+      nextX += offsetX;
 
-      renderList.push(
-        game.add.text(nextX - 80, y0 + 35, result >= 0 ? '' : '-', font)
-      );
+      if (result < 0) {
+        nextX -= 30;
+
+        renderList.push(game.add.text(nextX, y0 + 35, '-', font));
+
+        nextX += 60;
+      }
 
       const fractionResult = game.add.text(
         nextX,
@@ -695,6 +679,7 @@ const circleOne = {
       );
       fractionResult.lineHeight = 70;
       renderList.push(fractionResult);
+
       const fractionLine = game.add.geom.line(
         nextX,
         y0 + 15,
@@ -737,13 +722,6 @@ const circleOne = {
       }
 
       // Decimal result
-      // nextX += offsetX;
-      // renderList.push(game.add.text(nextX, y0 + 35, '=', font));
-
-      // nextX += offsetX / 2;
-      // renderList.push(game.add.text(nextX, y0 + 35, result, font));
-
-      //let resultWidth = ('' + result).length * widthOfChar;
       let resultWidth = '_'.length * widthOfChar;
       const cardWidth = nextX - x0 + resultWidth + padding * 2;
       card.width = cardWidth;

+ 8 - 31
js/games/squareOne.js

@@ -592,38 +592,22 @@ const squareOne = {
       const result =
         ('' + resultAux).length > 4 ? resultAux.toFixed(2) : resultAux;
 
-      // let fracLine = '';
-      // const updatedNominatorsString = updatedNominators
-      //   .map((n) => {
-      //     const len = ('' + n).length;
-      //     for (let i = 0; i < len; i++) fracLine += '_';
-      //     fracLine = n < 0 ? fracLine : fracLine + '_';
-      //     return n >= 0 ? '+' + n : n;
-      //   })
-      //   .join('');
-      // const fractionMiddleX = widthOfChar * (fracLine.length / 2);
-
       // Fraction operation with least common multiple
       nextX = x0 + validBlocks.length * offsetX + 20;
-      // renderList.push(game.add.text(nextX, y0 + 35, '=', font));
-
-      // nextX += offsetX / 2;
-      // renderList.push(game.add.text(nextX, y0, updatedNominatorsString, font));
-      // renderList.push(
-      //   game.add.text(nextX + fractionMiddleX, y0 + 70, mmc, font)
-      // );
-      // renderList.push(game.add.text(nextX, y0, fracLine, font));
 
       // Fraction result
-      //nextX += fractionMiddleX * 2 + 50;
       renderList.push(game.add.text(nextX, y0 + 35, '=', font));
 
       font.align = 'center';
-      nextX += offsetX + 40;
+      nextX += offsetX;
 
-      renderList.push(
-        game.add.text(nextX - 80, y0 + 35, result >= 0 ? '' : '-', font)
-      );
+      if (result < 0) {
+        nextX += 60;
+
+        renderList.push(game.add.text(nextX - 80, y0 + 35, '-', font));
+
+        nextX -= 30;
+      }
 
       const fractionResult = game.add.text(
         nextX,
@@ -675,13 +659,6 @@ const squareOne = {
       }
 
       // Decimal result
-      // nextX += offsetX;
-      // renderList.push(game.add.text(nextX, y0 + 35, '=', font));
-
-      // nextX += offsetX / 2;
-      // renderList.push(game.add.text(nextX, y0 + 35, result, font));
-
-      //let resultWidth = ('' + result).length * widthOfChar;
       let resultWidth = '_'.length * widthOfChar;
       const cardWidth = nextX - x0 + resultWidth + padding * 2;
       card.width = cardWidth;

+ 3 - 3
js/globals/globals_debug.js

@@ -3,14 +3,14 @@ const isDebugMode = false;
 const debugState = {
   lang: { skip: true, lang: 'pt_BR' },
   name: { skip: true, name: 'Username' },
-  menu: { skip: true, id: 1, audioStatus: false },
+  menu: { skip: true, id: 0, audioStatus: false },
   customMenu: {
-    skip: false,
+    skip: true,
     getData: () => {
       return { mode: 'a', operation: 'plus', difficulty: 3, label: true };
     },
   },
-  map: { skip: false },
+  map: { skip: true },
   end: { skip: false, stop: false },
   moodle: {
     emulate: false,