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

refactor: add text with paragraph to game c1

lairaalmas 1 éve
szülő
commit
c3d1bb0241
1 módosított fájl, 18 hozzáadás és 31 törlés
  1. 18 31
      src/js/games/circleOne.js

+ 18 - 31
src/js/games/circleOne.js

@@ -338,11 +338,6 @@ const circleOne = {
               y: curCircleY - 2,
               text: '',
             },
-            {
-              x: fractionX,
-              y: curCircleY - 2,
-              text: '',
-            },
             {
               x: fractionX - 25,
               y: curCircleY + 10,
@@ -368,15 +363,10 @@ const circleOne = {
           curCircleInfo.angleDegree = curAngleDegree;
 
           curFractionItems = [
-            {
-              x: fractionX,
-              y: curCircleY + 34,
-              text: curDivisor,
-            },
             {
               x: fractionX,
               y: curCircleY - 2,
-              text: '1',
+              text: `1\n${curDivisor}`,
             },
             {
               x: fractionX,
@@ -393,14 +383,14 @@ const circleOne = {
 
         if (showFractions) {
           for (let cur in curFractionItems) {
-            curCircleInfo.fraction.labels.push(
-              game.add.text(
-                curFractionItems[cur].x,
-                curFractionItems[cur].y,
-                curFractionItems[cur].text,
-                font
-              )
+            const fraction = game.add.text(
+              curFractionItems[cur].x,
+              curFractionItems[cur].y,
+              curFractionItems[cur].text,
+              font
             );
+            fraction.lineHeight = 37;
+            curCircleInfo.fraction.labels.push(fraction);
           }
           curCircleInfo.fraction.nominator = curCircleInfo.direc;
           curCircleInfo.fraction.denominator = curDivisor;
@@ -600,28 +590,26 @@ const circleOne = {
       for (let i in validCircles) {
         const curFraction = validCircles[i].info.fraction;
         let curFractionSign = '+';
-        if (curFraction.labels[3].name === '-') {
+        if (curFraction.labels[2].name === '-') {
           curFractionSign = '-';
           font.fill = colors.red;
         }
 
-        renderList.push(
-          game.add.text(x0 + i * offsetX, y0 + 35, curFractionSign, font)
+        const fraction = game.add.text(
+          x0 + i * offsetX + offsetX / 2,
+          y0,
+          curFraction.labels[0].name,
+          font
         );
+        fraction.lineHeight = 70;
+
         renderList.push(
-          game.add.text(x0 + i * offsetX + offsetX / 2, y0, '1', font)
+          game.add.text(x0 + i * offsetX, y0 + 35, curFractionSign, font)
         );
+        renderList.push(fraction);
         renderList.push(
           game.add.text(x0 + offsetX / 2 + i * offsetX, y0, '_', font)
         );
-        renderList.push(
-          game.add.text(
-            x0 + i * offsetX + offsetX / 2,
-            y0 + 70,
-            curFraction.labels[0].name,
-            font
-          )
-        );
 
         nominators.push(curFraction.nominator);
         denominators.push(curFraction.denominator);
@@ -934,7 +922,6 @@ const circleOne = {
         if (self.ui.help != undefined) self.ui.help.alpha = 0;
 
         self.ui.message[0].alpha = 0;
-        self.ui.message[1].alpha = 0;
 
         navigation.disableIcon(navigation.showAnswerIcon);