Browse Source

feature: get code from prisla branch

lairaalmas 5 months ago
parent
commit
90f190651c
3 changed files with 37 additions and 1 deletions
  1. 7 1
      assets/lang/pt_BR
  2. 3 0
      js/globals/globals_control.js
  3. 27 0
      js/menus/menu_custom.js

+ 7 - 1
assets/lang/pt_BR

@@ -63,4 +63,10 @@ results=RESULTADOS
 student=Aluno
 submit=Envie sua tarefa abaixo
 professor=Professor
-scale=Balança
+scale=Balança
+s1_a_description=Selecionando o solo
+s1_b_description=Selecionando os blocos
+s2_a_description=Retângulo superior com mais subdivisões
+s2_b_description=Retângulo inferior com mais subdivisões
+c1_a_description=Posicionando o balão
+c1_b_description=Posicionando os arcos

+ 3 - 0
js/globals/globals_control.js

@@ -170,6 +170,7 @@ const gameList = [
       customMenu: {
         gameModeBtn: ['mode_0', 'mode_1'],
         gameOperationBtn: ['operation_plus', 'operation_minus'],
+        gameModeDescription: ['s1_a_description', 's1_b_description'],
         auxiliarTitle: (x, y, offsetW, offsetH) => {
           game.add.text(
             x + 5 * offsetW,
@@ -312,6 +313,7 @@ const gameList = [
       },
       customMenu: {
         gameModeBtn: ['mode_2', 'mode_3'],
+        gameModeDescription: ['c1_a_description', 'c1_b_description'],
         gameOperationBtn: [
           'operation_plus',
           'operation_minus',
@@ -448,6 +450,7 @@ const gameList = [
       customMenu: {
         gameModeBtn: ['mode_4', 'mode_5'],
         gameOperationBtn: ['operation_equals'],
+        gameModeDescription: ['s2_a_description', 's2_b_description'],
         auxiliarTitle: (x, y, offsetW, offsetH) => {
           game.add.text(
             x + 5 * offsetW,

+ 27 - 0
js/menus/menu_custom.js

@@ -39,6 +39,13 @@ const customMenuState = {
         ...textStyles.h1_,
         fill: colors.green,
       });
+      // Subtitle : <game mode>
+      this.lbl_game = game.add.text(
+        context.canvas.width / 2,
+        170,
+        '...',
+        textStyles.h2_
+      );
 
       // Loads navigation icons
       navigation.add.left(['back'], 'menu');
@@ -213,6 +220,7 @@ const customMenuState = {
     if (overIcon) {
       // If pointer is over icon
       document.body.style.cursor = 'pointer';
+      self.showTitle(self.menuIcons[overIcon]);
       self.menuIcons.forEach((cur) => {
         if (cur.iconType == self.menuIcons[overIcon].iconType) {
           // If its in the same icon category
@@ -228,6 +236,7 @@ const customMenuState = {
       });
     } else {
       // If pointer is not over icon
+      self.clearTitle();
       if (self.enterText) self.enterText.style = textStyles.btn;
       self.menuIcons.forEach((cur) => {
         cur.scale = cur.initialScale;
@@ -312,6 +321,8 @@ const customMenuState = {
       );
       icon.anchor(0.5, 0.5);
 
+      icon.gameModeDescription =
+        curGame.assets.customMenu.gameModeDescription[i];
       icon.gameMode = curGame.gameMode[i];
       icon.iconType = 'gameMode';
 
@@ -462,4 +473,20 @@ const customMenuState = {
 
     document.querySelector('.ifr-modal__infobox').innerHTML = content;
   },
+
+  /**
+   * Display the description the game mode on screen
+   *
+   * @param {object} icon icon for the game mode
+   */
+  showTitle: function (icon) {
+    self.lbl_game.name = game.lang[icon.gameModeDescription];
+  },
+
+  /**
+   * Remove the description the game mode from screen
+   */
+  clearTitle: function () {
+    self.lbl_game.name = '';
+  },
 };