Browse Source

add customMenu title as config in gameList

lairaalmas 1 year ago
parent
commit
8205b24ce1
3 changed files with 46 additions and 29 deletions
  1. 43 0
      src/js/globals/globals_control.js
  2. 2 2
      src/js/globals/globals_debug.js
  3. 1 27
      src/js/menus/menu_custom.js

+ 43 - 0
src/js/globals/globals_control.js

@@ -164,6 +164,20 @@ const gameList = [
       customMenu: {
         gameModeBtn: ['mode_0', 'mode_1'],
         gameOperationBtn: ['operation_plus', 'operation_minus'],
+        auxiliarTitle: (x, y, offsetW, offsetH) => {
+          game.add.text(
+            x + 5 * offsetW,
+            y + offsetH + 50,
+            game.lang.show,
+            textStyles.h4_
+          );
+          game.add.text(
+            x + 5 * offsetW,
+            y + offsetH + 80,
+            game.lang.title,
+            textStyles.h2_
+          );
+        },
         infoBox: () => ({
           gameMode: {
             title: game.lang.game_modes,
@@ -300,6 +314,20 @@ const gameList = [
           'operation_minus',
           'operation_mixed',
         ],
+        auxiliarTitle: (x, y, offsetW, offsetH) => {
+          game.add.text(
+            x + 5 * offsetW,
+            y + offsetH + 50,
+            game.lang.show,
+            textStyles.h4_
+          );
+          game.add.text(
+            x + 5 * offsetW,
+            y + offsetH + 80,
+            game.lang.title,
+            textStyles.h2_
+          );
+        },
         infoBox: () => ({
           gameMode: {
             title: game.lang.game_modes,
@@ -411,6 +439,20 @@ const gameList = [
       customMenu: {
         gameModeBtn: ['mode_4', 'mode_5'],
         gameOperationBtn: ['operation_equals'],
+        auxiliarTitle: (x, y, offsetW, offsetH) => {
+          game.add.text(
+            x + 5 * offsetW,
+            y + offsetH + 50,
+            game.lang.show,
+            textStyles.h4_
+          );
+          game.add.text(
+            x + 5 * offsetW + 10,
+            y + offsetH + 80,
+            game.lang.aux_rectangle,
+            textStyles.h4_
+          );
+        },
         infoBox: () => ({
           gameMode: {
             title: game.lang.game_modes,
@@ -508,6 +550,7 @@ const gameList = [
   //     customMenu: {
   //       gameModeBtn: ['mode_6'],
   //       gameOperationBtn: ['operation_equals'],
+  //       auxiliarTitle: (x, y, offsetW, offsetH) => {},
   //       // infoBox
   //     },
   //     map: {

+ 2 - 2
src/js/globals/globals_debug.js

@@ -5,12 +5,12 @@ const debugState = {
   name: { status: true, name: 'Username' },
   menu: { status: true, id: 1 },
   customMenu: {
-    status: true,
+    status: false,
     getData: () => {
       return { mode: 'b', operation: 'minus', difficulty: 5, label: true };
     },
   },
-  map: { status: true },
+  map: { status: false },
   end: { status: false, stop: false },
 };
 

+ 1 - 27
src/js/menus/menu_custom.js

@@ -271,33 +271,7 @@ const customMenuState = {
     infoIcon.id = 'gameDifficulty';
     self.menuIcons.push(infoIcon);
 
-    // Label 'Show Fractions / Auxiliar rectangles'
-    game.add.text(
-      x + 5 * offsetW,
-      y + offsetH + 50,
-      game.lang.show,
-      textStyles.h4_
-    );
-
-    self.auxText;
-
-    if (gameName == 'squareTwo') {
-      self.auxText = game.lang.aux_rectangle;
-      game.add.text(
-        x + 5 * offsetW + 10,
-        y + offsetH + 80,
-        self.auxText,
-        textStyles.h4_
-      );
-    } else {
-      self.auxText = game.lang.title;
-      game.add.text(
-        x + 5 * offsetW,
-        y + offsetH + 80,
-        self.auxText,
-        textStyles.h2_
-      );
-    }
+    gameList[gameId].assets.customMenu.auxiliarTitle(x, y, offsetW, offsetH);
   },
 
   renderCheckBox: function (x, y, offsetW, offsetH) {