Browse Source

Merge branch 'refactor' of LInE/Ifractions-web into master

laira 1 year ago
parent
commit
3aa4881545
100 changed files with 125 additions and 618 deletions
  1. 23 0
      .prettierrc
  2. 9 8
      README.md
  3. BIN
      assets/audio/pop.wav
  4. 0 0
      assets/img/NOT-USED/close.png
  5. 0 0
      assets/img/characters/balloon/balloon.png
  6. 0 0
      assets/img/characters/balloon/balloon_basket.png
  7. 0 0
      assets/img/characters/kid/lost.png
  8. 0 0
      assets/img/characters/kid/running.png
  9. 0 0
      assets/img/characters/kid/walking.png
  10. BIN
      assets/img/characters/scale/scale_arm.png
  11. BIN
      assets/img/characters/scale/scale_base.png
  12. BIN
      assets/img/characters/scale/scale_plate.png
  13. 0 0
      assets/img/characters/tractor/tractor.png
  14. BIN
      assets/img/fallback.png
  15. BIN
      assets/img/flag/BRAZ.jpg
  16. BIN
      assets/img/flag/FRAN.jpg
  17. BIN
      assets/img/flag/ITAL.png
  18. BIN
      assets/img/flag/PERU.jpg
  19. BIN
      assets/img/flag/UNST.jpg
  20. BIN
      assets/img/flags/br.png
  21. BIN
      assets/img/flags/es.png
  22. BIN
      assets/img/flags/fr.png
  23. BIN
      assets/img/flags/it.png
  24. BIN
      assets/img/flags/us.png
  25. 0 0
      assets/img/icons_interactive/answer_correct.png
  26. 0 0
      assets/img/icons_interactive/answer_wrong.png
  27. BIN
      assets/img/icons_interactive/arrow_down.png
  28. BIN
      assets/img/icons_interactive/btn_square.png
  29. BIN
      assets/img/icons_interactive/info.png
  30. BIN
      assets/img/icons_interactive/pointer.png
  31. BIN
      assets/img/icons_interactive/select_input.png
  32. 0 0
      assets/img/icons_menu/circleOne.png
  33. 0 0
      assets/img/icons_menu/circleOne_1.png
  34. 0 0
      assets/img/icons_menu/circleOne_2.png
  35. 0 0
      assets/img/icons_menu/operation_equals.png
  36. 0 0
      assets/img/icons_menu/operation_minus.png
  37. 0 0
      assets/img/icons_menu/operation_mixed.png
  38. 0 0
      assets/img/icons_menu/operation_plus.png
  39. BIN
      assets/img/icons_menu/scaleOne.png
  40. BIN
      assets/img/icons_menu/scaleOne_1.png
  41. 0 0
      assets/img/icons_menu/squareOne.png
  42. 0 0
      assets/img/icons_menu/squareOne_1.png
  43. 0 0
      assets/img/icons_menu/squareOne_2.png
  44. 0 0
      assets/img/icons_menu/squareTwo.png
  45. 0 0
      assets/img/icons_menu/squareTwo_1.png
  46. 0 0
      assets/img/icons_menu/squareTwo_2.png
  47. BIN
      assets/img/icons_navigation/audio.png
  48. BIN
      assets/img/icons_navigation/back.png
  49. BIN
      assets/img/icons_navigation/home.png
  50. BIN
      assets/img/icons_navigation/language.png
  51. BIN
      assets/img/icons_navigation/menu.png
  52. BIN
      assets/img/icons_navigation/show_solution.png
  53. 0 0
      assets/img/info_box/op_eq.png
  54. 0 0
      assets/img/info_box/op_min.png
  55. 0 0
      assets/img/info_box/op_mix.png
  56. 0 0
      assets/img/info_box/op_plus.png
  57. BIN
      assets/img/interac_icon/down.png
  58. BIN
      assets/img/interac_icon/info.png
  59. BIN
      assets/img/interac_icon/pointer.png
  60. BIN
      assets/img/interac_icon/selectionBox.png
  61. BIN
      assets/img/navig_icon/audio.png
  62. BIN
      assets/img/navig_icon/back.png
  63. BIN
      assets/img/navig_icon/help.png
  64. BIN
      assets/img/navig_icon/home.png
  65. BIN
      assets/img/navig_icon/language.png
  66. BIN
      assets/img/navig_icon/menu.png
  67. BIN
      assets/img/scene/.png
  68. 0 0
      assets/img/scene/bg_default.jpg
  69. BIN
      assets/img/scene/block_grass.png
  70. 0 0
      assets/img/scene/building_farm.png
  71. 0 0
      assets/img/scene/building_garage.png
  72. 0 0
      assets/img/scene/building_house.png
  73. 0 0
      assets/img/scene/building_school.png
  74. 0 0
      assets/img/scene/floor_grass.png
  75. BIN
      assets/img/scene/floor_road.png
  76. BIN
      assets/img/scene/map_place.png
  77. BIN
      assets/img/scene/new_level/bg_snow.png
  78. BIN
      assets/img/scene/new_level/floor_snow.png
  79. BIN
      assets/img/scene/new_level/floor_stone.png
  80. BIN
      assets/img/scene/new_level/floor_stone_left.png
  81. BIN
      assets/img/scene/new_level/floor_stone_right.png
  82. BIN
      assets/img/scene/new_level/stone_shelf.png
  83. BIN
      assets/img/scene/new_level/wood_shelf.png
  84. BIN
      assets/img/scene/place_off.png
  85. BIN
      assets/img/scene/place_on.png
  86. BIN
      assets/img/scene/progress_bar_tile.png
  87. BIN
      assets/img/scene/road.png
  88. 0 0
      assets/img/scene/sign_broken.png
  89. 0 0
      assets/img/scene/tree_1.png
  90. 0 0
      assets/img/scene/tree_2.png
  91. 0 0
      assets/img/scene/tree_3.png
  92. 0 0
      assets/img/scene/tree_4.png
  93. 11 2
      assets/lang/en_US
  94. 10 1
      assets/lang/es_PE
  95. 11 2
      assets/lang/fr_FR
  96. 11 2
      assets/lang/it_IT
  97. 10 1
      assets/lang/pt_BR
  98. 40 122
      index.html
  99. 0 480
      js/customMenu.js
  100. 0 0
      js/gameMechanics.js

+ 23 - 0
.prettierrc

@@ -0,0 +1,23 @@
+{
+  "arrowParens": "always",
+  "bracketSpacing": true,
+  "endOfLine": "lf",
+  "htmlWhitespaceSensitivity": "css",
+  "insertPragma": false,
+  "singleAttributePerLine": false,
+  "bracketSameLine": false,
+  "jsxBracketSameLine": false,
+  "jsxSingleQuote": false,
+  "printWidth": 80,
+  "proseWrap": "preserve",
+  "quoteProps": "as-needed",
+  "requirePragma": false,
+  "semi": true,
+  "singleQuote": true,
+  "tabWidth": 2,
+  "trailingComma": "es5",
+  "useTabs": false,
+  "vueIndentScriptAndStyle": false,
+  "filepath": "/var/www/html/Ifractions-web/js/",
+  "parser": "babel"
+}

+ 9 - 8
README.md

@@ -4,7 +4,7 @@
 
 **iFractions** is an online collection of games for teaching fractions currently being developed by LInE (Laboratório de Informática na Educação).
 
-It can be used both on a server or as an activity inside Moodle.
+It can be used both on a server or as an activity inside [Moodle](https://moodle.org/).
 
 Play iFractions online: http://www.usp.br/line/ifractions/
 
@@ -14,9 +14,9 @@ Follow the description below based on in which platform you want to run iFractio
 
 #### 1) on a server
 
-* Extract the content of **Ifraction-web.zip** inside the server directory
+* Extract the content of `Ifraction-web.zip` inside the server directory
 
-* Check that the variable **moodle** is set to **false** inside **/js/globals.js**
+* Check that the variable `moodle` is set to **false** inside `./js/globals/globals_control.js`
 
 * It can now be accessed through the **browser** (e.g http://localhost/Ifractions-web)
 
@@ -24,22 +24,23 @@ Follow the description below based on in which platform you want to run iFractio
 
   * you'll need to have **PHP** and **MySQL** installed on the machine
 
-  * follow the steps on **/php/README.md** to setup the database and variables
+  * follow the steps on `./php/README.md` to setup the database and variables
 
 * Otherwise you're good to go.
 
 #### 2) on Moodle
 
-iFractions is one of the iLM (Interactive Learning Modules) provided by the iAssign package for Moodle. 
+**iFractions** is one of the iLM (Interactive Learning Modules) provided by the **iAssign** package for **Moodle**. 
 
-* To download and setup iAssign access: http://200.144.254.107/git/LInE/iassign
+* To download and setup **iAssign** access: http://200.144.254.107/git/LInE/iassign
 
-* Be sure to check that the variable **moodle** is set to **true** inside **/js/globals.js**
+* Be sure to check that the variable `moodle` is set to **true** inside `./js/globals/globals_control.js`
 
-* With iAssign installed, as a Moodle professor on you'll be able to:
+* With **iAssign** installed, as a Moodle professor on you'll be able to:
   
   * create activities for your course that are customizable iFractions games
   
   * analyze the student's progress on the activities
 
   * get the automatic evaluation for the activities
+

BIN
assets/audio/pop.wav


assets/img/interac_icon/close.png → assets/img/NOT-USED/close.png


assets/img/character/balloon/airballoon_upper.png → assets/img/characters/balloon/balloon.png


assets/img/character/balloon/airballoon_base.png → assets/img/characters/balloon/balloon_basket.png


assets/img/character/kid/lost.png → assets/img/characters/kid/lost.png


assets/img/character/kid/run.png → assets/img/characters/kid/running.png


assets/img/character/kid/walk.png → assets/img/characters/kid/walking.png


BIN
assets/img/characters/scale/scale_arm.png


BIN
assets/img/characters/scale/scale_base.png


BIN
assets/img/characters/scale/scale_plate.png


assets/img/character/tractor/tractor.png → assets/img/characters/tractor/tractor.png


BIN
assets/img/fallback.png


BIN
assets/img/flag/BRAZ.jpg


BIN
assets/img/flag/FRAN.jpg


BIN
assets/img/flag/ITAL.png


BIN
assets/img/flag/PERU.jpg


BIN
assets/img/flag/UNST.jpg


BIN
assets/img/flags/br.png


BIN
assets/img/flags/es.png


BIN
assets/img/flags/fr.png


BIN
assets/img/flags/it.png


BIN
assets/img/flags/us.png


assets/img/interac_icon/ok.png → assets/img/icons_interactive/answer_correct.png


assets/img/interac_icon/error.png → assets/img/icons_interactive/answer_wrong.png


BIN
assets/img/icons_interactive/arrow_down.png


BIN
assets/img/icons_interactive/btn_square.png


BIN
assets/img/icons_interactive/info.png


BIN
assets/img/icons_interactive/pointer.png


BIN
assets/img/icons_interactive/select_input.png


assets/img/levels/circleOne.png → assets/img/icons_menu/circleOne.png


assets/img/levels/circleOne_1.png → assets/img/icons_menu/circleOne_1.png


assets/img/levels/circleOne_2.png → assets/img/icons_menu/circleOne_2.png


assets/img/levels/operation_equals.png → assets/img/icons_menu/operation_equals.png


assets/img/levels/operation_minus.png → assets/img/icons_menu/operation_minus.png


assets/img/levels/operation_mixed.png → assets/img/icons_menu/operation_mixed.png


assets/img/levels/operation_plus.png → assets/img/icons_menu/operation_plus.png


BIN
assets/img/icons_menu/scaleOne.png


BIN
assets/img/icons_menu/scaleOne_1.png


assets/img/levels/squareOne.png → assets/img/icons_menu/squareOne.png


assets/img/levels/squareOne_1.png → assets/img/icons_menu/squareOne_1.png


assets/img/levels/squareOne_2.png → assets/img/icons_menu/squareOne_2.png


assets/img/levels/squareTwo.png → assets/img/icons_menu/squareTwo.png


assets/img/levels/squareTwo_1.png → assets/img/icons_menu/squareTwo_1.png


assets/img/levels/squareTwo_2.png → assets/img/icons_menu/squareTwo_2.png


BIN
assets/img/icons_navigation/audio.png


BIN
assets/img/icons_navigation/back.png


BIN
assets/img/icons_navigation/home.png


BIN
assets/img/icons_navigation/language.png


BIN
assets/img/icons_navigation/menu.png


BIN
assets/img/icons_navigation/show_solution.png


assets/img/info_box/operation_equals.png → assets/img/info_box/op_eq.png


assets/img/info_box/operation_minus.png → assets/img/info_box/op_min.png


assets/img/info_box/operation_mixed.png → assets/img/info_box/op_mix.png


assets/img/info_box/operation_plus.png → assets/img/info_box/op_plus.png


BIN
assets/img/interac_icon/down.png


BIN
assets/img/interac_icon/info.png


BIN
assets/img/interac_icon/pointer.png


BIN
assets/img/interac_icon/selectionBox.png


BIN
assets/img/navig_icon/audio.png


BIN
assets/img/navig_icon/back.png


BIN
assets/img/navig_icon/help.png


BIN
assets/img/navig_icon/home.png


BIN
assets/img/navig_icon/language.png


BIN
assets/img/navig_icon/menu.png


BIN
assets/img/scene/.png


assets/img/scene/bg.jpg → assets/img/scene/bg_default.jpg


BIN
assets/img/scene/block_grass.png


assets/img/scene/farm.png → assets/img/scene/building_farm.png


assets/img/scene/garage.png → assets/img/scene/building_garage.png


assets/img/scene/house.png → assets/img/scene/building_house.png


assets/img/scene/school.png → assets/img/scene/building_school.png


assets/img/scene/floor.png → assets/img/scene/floor_grass.png


BIN
assets/img/scene/floor_road.png


BIN
assets/img/scene/map_place.png


BIN
assets/img/scene/new_level/bg_snow.png


BIN
assets/img/scene/new_level/floor_snow.png


BIN
assets/img/scene/new_level/floor_stone.png


BIN
assets/img/scene/new_level/floor_stone_left.png


BIN
assets/img/scene/new_level/floor_stone_right.png


BIN
assets/img/scene/new_level/stone_shelf.png


BIN
assets/img/scene/new_level/wood_shelf.png


BIN
assets/img/scene/place_off.png


BIN
assets/img/scene/place_on.png


BIN
assets/img/scene/progress_bar_tile.png


BIN
assets/img/scene/road.png


assets/img/scene/broken_sign.png → assets/img/scene/sign_broken.png


assets/img/scene/tree.png → assets/img/scene/tree_1.png


assets/img/scene/tree2.png → assets/img/scene/tree_2.png


assets/img/scene/tree3.png → assets/img/scene/tree_3.png


assets/img/scene/tree4.png → assets/img/scene/tree_4.png


+ 11 - 2
assets/lang/en_US

@@ -1,6 +1,13 @@
 audio=AUDIO
 aux_rectangle=Auxiliar Rectangles
+back_to_menu=Go back to main menu
 circle=Circles
+circleOne_intro_a=Where should the balloon be placed so the boy\ncan get to it?
+circleOne_intro_b=How many arcs must we select so that\nthe boy can reach the balloon?
+squareOne_intro_a=What size hole must be opened in the ground so that\nall the blocks that the tractor will take can fit?
+squareOne_intro_b=How many blocks must the tractor push to\nfill the hole in the ground?
+squareTwo_intro=Select portions in the two figures so that\none is equivalent to the other
+congratulations=congratulations!
 continue=Continue
 custom_game=CUSTOMIZE THE CURRENT GAME
 difficulties=Difficulties
@@ -32,6 +39,7 @@ insert_name=ENTER YOUR NAME
 loading=LOADING
 menu_title=SELECT GAME
 minus=Subtraction
+mode=Mode
 mixed=Sum and Subtraction
 nav_back=GO BACK
 nav_help=SEE SOLUTION
@@ -45,7 +53,7 @@ ready=READY
 retry=Try again
 s2_error_msg=You should select a smaller portion than it's full size
 show=Show
-square=Quadrangles
+square=Quadrilaterals
 title=Fractions
 welcome=Hi
 hits=Hits
@@ -53,4 +61,5 @@ errors=Errors
 time=Time
 results=RESULTS
 student=Student
-professor=Professor
+professor=Professor
+scale=Scale

+ 10 - 1
assets/lang/es_PE

@@ -1,6 +1,13 @@
 audio=AUDIO
 aux_rectangle=Rectángulos Auxiliares
+back_to_menu=Volver al menú principal
 circle=Circulos
+circleOne_intro_a=¿Dónde debe estar el globo para que el niño\npueda alcanzarlo?
+circleOne_intro_b=¿Cuántos aros debemos seleccionar para que\nel niño pueda llegar al globo?
+squareOne_intro_a=¿Qué tamaño de agujero hay que abrir en el suelo para que\nquepan todos los bloques que llevará el tractor?
+squareOne_intro_b=¿Cuántos bloques debe empujar la excavadora para llenar\nel agujero en el suelo?
+squareTwo_intro=Seleccione porciones en las dos figuras para que\nuna sea equivalente a la otra
+congratulations=¡Felicidades!
 continue=Continúa
 custom_game=PERSONALIZAR EL JUEGO ACTUAL
 difficulties=Dificultades
@@ -33,6 +40,7 @@ loading=CARGANDO
 menu_title=SELECCIONE UN JUEGO
 minus=Resta
 mixed=Suma y Resta
+mode=Modo
 nav_back=REGRESAR
 nav_help=VER SOLUCION
 nav_lang=SELECCION DE IDIOMA
@@ -53,4 +61,5 @@ errors=Errores
 time=Tiempo
 results=RESULTADOS
 student=Estudiante
-professor=Professor
+professor=Professor
+scale=Escala

+ 11 - 2
assets/lang/fr_FR

@@ -1,6 +1,13 @@
 audio=AUDIO
 aux_rectangle=Rectangles Auxiliaires
+back_to_menu=Retour au menu principal
 circle=Cercles
+circleOne_intro_a=Où doit être le ballon pour que le garçon\npuisse l'atteindre ?
+circleOne_intro_b=Combien de cerceaux devons-nous choisir pour que\nle garçon puisse atteindre le ballon ?
+squareOne_intro_a=Quelle taille de trou faut-il ouvrir dans le sol pour que tous les blocs\nque prendra le tracteur puissent y rentrer ?
+squareOne_intro_b=Combien de blocs le bulldozer doit-il pousser\npour combler le trou dans le sol ?
+squareTwo_intro=Sélectionnez des parties dans les deux figures afin\nque l'une soit équivalente à l'autre
+congratulations=Toutes nos félicitations!
 continue=Continuez
 custom_game=PERSONNALISER LE JEU ACTUEL
 difficulties=Difficultés
@@ -33,6 +40,7 @@ loading=CHARGEMENT
 menu_title=SÉLECTIONNEZ UN JEU
 minus=Soustraction
 mixed=Somme et soustraction
+mode=Mode
 nav_back=REVENIR
 nav_help=VOIR LA SOLUTION
 nav_lang=SÉLECTIONNEZ UNE LANGUE
@@ -45,7 +53,7 @@ ready=PRÊT
 retry=Réessayer
 s2_error_msg=Vous devriez choisir une portion plus petite que sa taille totale
 show=Afficher les
-square=Quadrangles
+square=Quadrilatères
 title=Fractions
 welcome=Salut
 hits=Réussites
@@ -53,4 +61,5 @@ errors=Erreurs
 time=Temps
 results=RÉSULTATS
 student=Étudiant
-professor=Professeur
+professor=Professeur
+scale=Balance

+ 11 - 2
assets/lang/it_IT

@@ -1,6 +1,13 @@
 audio=AUDIO
 aux_rectangle=Rettangoli Ausiliari
+back_to_menu=Torna al menu principale
 circle=Cerchi
+circleOne_intro_a=Dove dovrebbe essere il pallone in modo che il\nragazzo possa raggiungerlo?
+circleOne_intro_b=Quanti cerchi dobbiamo selezionare affinché\nil ragazzo possa raggiungere il pallone?
+squareOne_intro_a=Di che dimensione deve essere aperto il buco nel terreno in modo\nche nentrino tutti i blocchi che prenderà il trattore?
+squareOne_intro_b=Quanti blocchi deve spingere il bulldozer\nper riempire il buco nel terreno?
+squareTwo_intro=Seleziona le porzioni nelle due figure in modo\nche una sia equivalente all'altra
+congratulations=Congratulazioni!
 continue=Continua
 custom_game=PERSONALIZZA IL GIOCO ATTUALE
 difficulties=Difficoltà
@@ -33,6 +40,7 @@ loading=CARICANDO
 menu_title=SELEZIONA UN GRIOCO
 minus=Sottrazione
 mixed=Somma e Sottrazione
+mode=Modalità
 nav_back=INDIETRO
 nav_help=GUARDA SOLUZIONE
 nav_lang=SELEZIONARE IDIOMA
@@ -41,7 +49,7 @@ operation=Operazione
 operations=Operazioni
 operation_math=Operazioni Matematiche
 plus=somma
-ready=OK
+ready=PRONTO
 retry=Tenta di nuovo
 s2_error_msg=Devi scegliere una porzione minore della grandezza totale
 show=Mostra le
@@ -53,4 +61,5 @@ errors=Errori
 time=Tempo
 results=RISULTATI
 student=Alunno
-professor=Professore
+professor=Professore
+scale=Bilancia

+ 10 - 1
assets/lang/pt_BR

@@ -1,7 +1,14 @@
 audio=ÁUDIO
 aux_rectangle=Retângulos Auxiliares
+back_to_menu=Voltar ao menu principal
 circle=Círculos
+circleOne_intro_a=Onde o balão deve ficar para que o menino\nconsiga chegar até ele?
+circleOne_intro_b=Quantos arcos devemos selecionar para que\no menino consiga chegar até o balão?
+squareOne_intro_a=Qual o tamanho do buraco que deve ser aberto no chão para que\ncaibam todos blocos que o trator vai levar?
+squareOne_intro_b=Quantos blocos o trator deve empurrar para conseguir\npreencher o buraco no chão?
+squareTwo_intro=Selecione porções nas duas figuras de forma \nque uma seja equivalente à outra
 continue=Continue
+congratulations=Parabéns!
 custom_game=PERSONALIZE O JOGO ATUAL
 difficulties=Dificuldades
 difficulty=Dificuldade
@@ -33,6 +40,7 @@ loading=CARREGANDO
 menu_title=SELECIONE UM JOGO
 minus=Subtração
 mixed=Soma e Subtração
+mode=Modo
 nav_back=VOLTAR
 nav_help=VER SOLUÇÃO
 nav_lang=SELECIONAR IDIOMA
@@ -53,4 +61,5 @@ errors=Erros
 time=Tempo
 results=RESULTADOS
 student=Aluno
-professor=Professor
+professor=Professor
+scale=Balança

+ 40 - 122
index.html

@@ -1,103 +1,18 @@
 <!DOCTYPE html>
 <!-- LInE - Free Education, Private Data - http://www.usp.br/line -->
 
-<html>
+<html lang="pt-br">
 
 <head>
 
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+  <meta name="viewport" content="width=device-width, initial-scale=1">
   <meta name="description" content="Educational game for teaching fractions" />
   <meta name="keywords" content="ifractions, fraction, game, private data" />
-  <link rel="shortcut icon" href="assets/img/scene/flag.png">
-  <title>iFractions</title>
-  <link rel="stylesheet" href="css/bootstrap.min.css">
-
-  <style>
-    /*
-    body, .panel-body {
-      background-color: #313857;
-    }
-    */
-    #iFractions-canvas {
-      padding: 0 auto 0 auto;
-      margin-left: auto;
-      margin-right: auto;
-      display: block;
-    }
-
-    #textbox {
-      position: absolute;
-      margin-left: auto;
-      margin-right: auto;
-      top: 300px;
-      left: 0;
-      right: 0;
-      text-align: center;
-      visibility: hidden;
-    }
-
-    input[type=text] {
-      background-color: #fff;
-      padding: 15px 40px;
-      box-sizing: border-box;
-      border: 3px solid #ccc;
-      font-size: 44px;
-      font-family: Arial;
-      color: #000;
-      text-align: center;
-    }
-
-    input:focus {
-      outline: 3px solid #85accc;
-    }
-
-    /* The Modal (background) */
-    .modal {
-      display: none;
-      /* Hidden by default */
-      position: fixed;
-      /* Stay in place */
-      z-index: 1;
-      /* Sit on top */
-      padding-top: 155px;
-      /* Location of the box */
-      left: 0;
-      top: 0;
-      width: 100%;
-      /* Full width */
-      height: 100%;
-      /* Full height */
-      overflow: auto;
-      /* Enable scroll if needed */
-      background-color: rgb(0, 0, 0);
-      /* Fallback color */
-      background-color: rgba(0, 0, 0, 0.4);
-      /* Black w/ opacity */
-    }
-
-    /* Modal Content */
-    .modal-content {
-      background-color: #fefefe;
-      margin: auto;
-      padding: 20px;
-      border: 1px solid #888;
-      width: 50%;
-    }
-
-    /* The Close Button */
-    .close {
-      color: #aaaaaa;
-      float: right;
-      font-size: 28px;
-      font-weight: bold;
-    }
-
-    .close:hover, .close:focus {
-      color: #000;
-      text-decoration: none;
-      cursor: pointer;
-    }
-  </style>
+  <link rel="shortcut icon" href="./assets/img/scene/flag.png">
+  <link rel="stylesheet" href="./style/bootstrap/bootstrap.min.css">
+  <link rel="stylesheet" href="./style/IFractions.css">
+  <title>iFractions/iFra&ccedil;&otilde;es</title>
 
 </head>
 
@@ -105,25 +20,22 @@
 
   <div class="container">
 
-    <div class="clearfix">
-    </div>
-
     <div class="panel panel-primary">
 
       <div class="panel-heading">iFractions game :: by LInE</div>
 
       <div class="panel-body">
 
-        <canvas id="iFractions-canvas"></canvas> <!-- iFractions game -->
-        
-        <div id="textbox" onsubmit="return false">
-          <input type="text" id="textbox-content" value="" size="13" maxlength="36"> <!-- Textbox to get player name -->
+        <canvas class="ifr-canvas"></canvas>
+
+        <div class="ifr-input__container">
+          <input class="ifr-input" type="text" value="" size="13" maxlength="36">
         </div>
-               
-        <div id="myModal" class="modal">  <!-- Modal -->
-          <div class="modal-content">
-            <span class="close">&times;</span>
-            <div id='infobox-content'></div> <!-- Modal content -->
+
+        <div class="ifr-modal">
+          <div class="ifr-modal__content">
+            <span class="ifr-modal__closeButton">&times;</span>
+            <div class='ifr-modal__infobox'></div>
           </div>
         </div>
 
@@ -132,28 +44,33 @@
     </div>
 
     <!-- Load all js files -->
-    <script src="js/preMenu.js"></script>
-    <script src="js/menu.js"></script>
-    <script src="js/customMenu.js"></script>
-    <script src="js/map.js"></script>
-    <script src="js/games/circleOne.js"></script>
-    <script src="js/games/squareOne.js"></script>
-    <script src="js/games/squareTwo.js"></script>
-    <script src="js/studentReport.js"></script> <!-- FOR MOODLE -->
-    <script src="js/integrationFunctions.js"></script> <!-- FOR MOODLE -->
-    <script src="js/gameMechanics.js"></script>
-    <script src="js/globals.js"></script>
-    
-    <script>
+    <script src="./js/menus/preMenu_boot.js"></script>
+    <script src="./js/menus/preMenu_lang.js"></script>
+    <script src="./js/menus/preMenu_name.js"></script>
+    <script src="./js/menus/menu_main.js"></script>
+    <script src="./js/menus/menu_custom.js"></script>
+    <script src="./js/screens/map.js"></script>
+    <script src="./js/screens/end.js"></script>
+    <script src="./js/games/circleOne.js"></script>
+    <script src="./js/games/squareOne.js"></script>
+    <script src="./js/games/squareTwo.js"></script>
+    <!-- <script src="./js/games/scaleOne.js"></script> -->
+    <script src="./js/moodle/studentReport.js"></script> <!-- FOR MOODLE -->
+    <script src="./js/moodle/integrationFunctions.js"></script> <!-- FOR MOODLE -->
+    <script src="./js/gameMechanics.js"></script>
+    <script src="./js/globals/globals_control.js"></script>
+    <script src="./js/globals/globals_tokens.js"></script>
+    <script src="./js/globals/globals_functions.js"></script>
+    <script src="./js/globals/globals_debug.js"></script>
 
-      const defaultWidth = 900; // Default width for the Canvas
-      const defaultHeight = 600; // Default height for the Canvas
+    <script>
 
-      canvas = document.getElementById("iFractions-canvas");
-      canvas.width = defaultWidth;
-      canvas.height = defaultHeight;
+      const defaultWidth = 1920; // Default width for the Canvas
+      const defaultHeight = 1080; // Default height for the Canvas
 
-      const context = canvas.getContext("2d");
+      const context = document.querySelector('.ifr-canvas').getContext("2d");
+      context.canvas.width = defaultWidth;
+      context.canvas.height = defaultHeight;
 
       // CREATING GAME STATES
       game.state.add('boot', bootState);
@@ -170,6 +87,7 @@
       game.state.add('squareOne', squareOne);
       game.state.add('circleOne', circleOne);
       game.state.add('squareTwo', squareTwo);
+      // game.state.add('scaleOne', scaleOne);
 
       game.state.add('studentReport', studentReport); // FOR MOODLE
 

+ 0 - 480
js/customMenu.js

@@ -1,480 +0,0 @@
-/******************************
- * This file holds game states.
- ******************************/
-
-/** [CUSTOM MENU STATE] Screen where the user can customise the selected game - game mode, math operation, level of difficulty.
- * 
- * @namespace
- */
-const customMenuState = {
-
-  /**
-   * Preloads media for current state
-   */
-  preload: function () {
-
-    // LOADING MEDIA
-    game.load.sprite(url[gameType].sprite);
-    game.load.image(url[gameType].image);
-
-  },
-
-  /**
-   * Main code
-   */
-  create: function () {
-
-    // FOR MOODLE
-    if (moodle && iLMparameters.iLM_PARAM_SendAnswer == 'false') { // Student role
-
-      game.state.start('map');
-
-    } else {
-
-      const iconScale = 0.7;
-      const baseY = 270 - 40;
-      this.menuIcons = [];
-
-      // Background color
-      game.add.geom.rect(0, 0, defaultWidth, defaultHeight, undefined, 0, colors.blueBckg, 1);
-      // Floor
-      for (let i = 0; i < defaultWidth / 100; i++) { game.add.image(i * 100, defaultHeight - 100, 'floor'); }
-
-      // Overtitle : Selected game
-      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);
-
-      // Loads navigation icons
-      navigationIcons.add(
-        true, false, false,
-        true, true,
-        'menu', false);
-
-      const curGame = info.all[gameType];
-      let x = 150;
-      let y = 200 - 40;
-      let width = 5;
-      let height = 280 + 80;
-      let offsetW = 600 / 6;
-      let offsetH, infoIcon;
-
-      // Label 'Game Modes'
-      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);
-      infoIcon.iconType = 'infoIcon';
-      infoIcon.id = 'gameMode';
-      this.menuIcons.push(infoIcon);
-
-      // Label 'Operations'
-      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);
-      infoIcon.iconType = 'infoIcon';
-      infoIcon.id = 'gameOperation';
-      this.menuIcons.push(infoIcon);
-
-      // Label 'Difficulties'
-      game.add.text(x + 5 * offsetW, y, game.lang.difficulties, textStyles.h2_blue_2);
-
-      infoIcon = game.add.image(x + 6 * offsetW - 30, y - 40, 'info', 0.5, 0.4);
-      infoIcon.anchor(0.5, 0.5);
-      infoIcon.iconType = 'infoIcon';
-      infoIcon.id = 'gameDifficulty';
-      this.menuIcons.push(infoIcon);
-
-      // Horizontal line
-      game.add.geom.rect(x - 25, y + 10, 600 + 50, width, undefined, 0, colors.blueMenuLine).anchor(0, 0.5);
-      // Vertical lines
-      game.add.geom.rect(x + 2 * offsetW, y - 25, width, height, undefined, 0, colors.blueMenuLine).anchor(0.5, 0);
-      game.add.geom.rect(x + 4 * offsetW, y - 25, width, height, undefined, 0, colors.blueMenuLine).anchor(0.5, 0);
-
-      // --------------------------- TURN ON/OFF FRACTION LABELS / RECTANGLE GUIDE
-
-      // Horizontal line
-      game.add.geom.rect(x + 4 * offsetW, y + 136, 200 + 25, width, undefined, 0, colors.blueMenuLine).anchor(0, 0.5);
-
-      // Label 'Show Fractions / Auxiliar rectangles'
-      game.add.text(x + 5 * offsetW, y + 102, game.lang.show, textStyles.h4_blue_2);
-
-      infoIcon = game.add.image(x + 6 * offsetW + 20, y + 102, 'info', 0.5, 0.4);
-      infoIcon.anchor(0.5, 0.5);
-      infoIcon.iconType = 'infoIcon';
-      infoIcon.id = 'gameMisc';
-      this.menuIcons.push(infoIcon);
-
-      let auxText;
-      if (gameType == 'squareTwo') {
-        auxText = game.lang.aux_rectangle;
-        game.add.text(x + 5 * offsetW + 10, y + 102 + 24, auxText, textStyles.h4_blue_2);
-      } else {
-        auxText = game.lang.title;
-        game.add.text(x + 5 * offsetW, y + 102 + 24, auxText, textStyles.h2_blue_2);
-      }
-
-      // Selection box
-      y += 40;
-      const frame = (fractionLabel) ? 1 : 0;
-
-      const selectionBox = game.add.sprite(x + 5 * offsetW, y + 102 + 24 - 2, 'select', frame, 0.11);
-      selectionBox.anchor(0.5, 0.5);
-      selectionBox.iconType = 'selectionBox';
-      this.menuIcons.push(selectionBox);
-
-      // --------------------------- GAME MODE ICONS
-
-      x = 150 + offsetW;
-      y = baseY;
-      offsetH = this.getOffset(height, curGame.gameMode.length);
-
-      for (let i = 0; i < curGame.gameModeUrl.length; i++, y += offsetH) {
-        const icon = game.add.sprite(x, y, curGame.gameModeUrl[i], 0, iconScale, 1);
-        icon.anchor(0.5, 0.5);
-
-        icon.gameMode = curGame.gameMode[i];
-        icon.iconType = 'gameMode';
-        if (i == 0) {
-          gameMode = icon.gameMode;
-          icon.curFrame = 1;
-        }
-
-        this.menuIcons.push(icon);
-      }
-
-      // --------------------------- GAME OPERATION ICONS
-
-      x += 2 * offsetW;
-      y = baseY;
-      offsetH = this.getOffset(height, curGame.gameOperation.length);
-
-      let icon;
-
-      // Placing math operation icons
-      for (let i = 0; i < curGame.gameOperation.length; i++, y += offsetH) {
-        icon = game.add.sprite(x, y, curGame.gameOperationUrl[i], 0, iconScale, 1);
-        icon.anchor(0.5, 0.5);
-
-        icon.gameOperation = curGame.gameOperation[i];
-        icon.iconType = 'gameOperation';
-
-        if (i == 0) {
-          gameOperation = icon.gameOperation;
-          icon.curFrame = 1;
-        }
-
-        this.menuIcons.push(icon);
-      }
-
-      // --------------------------- DIFFICULTY ICONS
-
-      x = (gameType == 'squareOne') ? 625 : 585;
-      y = baseY - 25;
-
-      for (let i = 0; i < curGame.gameDifficulty; i++) {
-        // Parameters
-        const curX = x + (30 + 10) * i;
-
-        // Difficulty menuIcons
-        const icon = game.add.geom.rect(curX, y, 30, 30, undefined, 0, colors.gray, 1);
-        icon.anchor(0.5, 0.5);
-        icon.difficulty = i + 1;
-        icon.iconType = 'difficulty';
-
-        if (i == 0) {
-          gameDifficulty = icon.difficulty;
-          icon.fillColor = colors.blue;
-        }
-        this.menuIcons.push(icon);
-
-        // Difficulty numbers
-        game.add.text(curX, y + 7, i + 1, textStyles.h4_white);
-      }
-
-      // --------------------------- ENTER ICON
-
-      // FOR MOODLE
-      if (!moodle) {
-
-        x = defaultWidth - 100;
-        y = defaultHeight - 110;
-
-        const enterIcon = game.add.image(x, y, 'bush');
-        enterIcon.anchor(0.5, 0.5);
-        enterIcon.iconType = 'enter';
-
-        this.menuIcons.push(enterIcon);
-
-        this.enterText = game.add.text(x, y, game.lang.continue, textStyles.h4_white);
-
-      }
-
-      // --------------------------- INFO BOX
-
-      this.infoBox = document.getElementById('myModal');
-
-      // When the user clicks on the 'x', close the modal
-      document.getElementsByClassName('close')[0].onclick = function () {
-        self.infoBox.style.display = 'none';
-      }
-
-      // When the user clicks anywhere outside of the modal, close it
-      window.onclick = function (event) {
-        if (event.target == self.infoBox) {
-          self.infoBox.style.display = 'none';
-        }
-      }
-
-      this.infoBoxContent = {
-
-        gameMode: {
-          squareOne: {
-            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 +
-              ' </td> </tr> <tr> <td> <img width=100% src="' + game.image['s1-A-h'].src + '"> ' +
-              ' </td> <td> <img width=100% src="' + game.image['s1-B-h'].src + '"> </td> </tr> <table>'
-          },
-          circleOne: {
-            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 +
-              ' </td> </tr> </tr> <td> <img width=100% src="' + game.image['c1-B-h'].src + '"> ' +
-              ' </td> <td> &nbsp; <b>B)</b> ' + game.lang.infoBox_mode_c1_B + '</td> </tr> <table>'
-          },
-          squareTwo: {
-            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 +
-              ' </td> </tr> <tr> <td> <img width=98% src="' + game.image['s2-A-h'].src + '"> ' +
-              ' </td> <td> <img width=98% src="' + game.image['s2-B-h'].src + '"> </td> </tr> <table> </center>'
-          }
-        },
-
-        gameOperation: {
-          title: '<b>' + game.lang.operation_math + '</b>',
-          body: game.lang.infoBox_oper,
-          img: '<center> <table> <tr style="border-bottom: 5px solid white"> <td> <img width=50 src="' + game.image['operation_plus'].src + '"> ' + game.lang.plus +
-            ' </td> <td> <img width=50 src="' + game.image['operation_mixed'].src + '"> ' + game.lang.mixed +
-            ' </td> </tr> <tr> <td><img width=50 src="' + game.image['operation_minus'].src + '"> ' + game.lang.minus +
-            ' &nbsp; </td> <td> <img width=50 src="' + game.image['operation_equals'].src + '"> ' + game.lang.equals + ' </td> </tr> <table> <center>',
-        },
-
-        gameDifficulty: {
-          squareOne: {
-            title: '<b>' + game.lang.difficulties + '</b>',
-            body: game.lang.infoBox_diff + ' ' + game.lang.infoBox_diff_obs,
-            img: '<table> <tr> <td> <b>' + game.lang.difficulty + ':</b> 1' +
-              ' </td> <td> <b>' + game.lang.difficulty + ':</b> 3' +
-              ' </td> </tr> <tr> <td> <img width=100% src="' + game.image['s1-diff-1'].src + '"> ' +
-              ' </td> <td style="border-left: 4px solid white"> <img width=100% src="' + game.image['s1-diff-3'].src + '"> </td> </tr> </table> <br>' +
-              game.lang.infoBox_diff_aux + '<center> <img width=50% src="' + game.image['map-s1'].src + '"> </center>'
-          },
-          circleOne: {
-            title: '<b>' + game.lang.difficulties + '</b>',
-            body: game.lang.infoBox_diff + ' ' + game.lang.infoBox_diff_obs,
-            img: '<center> <table> <tr> <td style="border-right: 4px solid white"> <b>' + game.lang.difficulty + ':</b> 1' +
-              ' </td> <td> <b>' + game.lang.difficulty + ':</b> 5' +
-              ' </td> </tr> <tr> <td> <img width=100% src="' + game.image['c1-diff-1'].src + '"> ' +
-              ' </td> <td style="border-left: 4px solid white"> <img width=100% src="' + game.image['c1-diff-5'].src + '"> </td> </tr> </table> <center> <br>' +
-              game.lang.infoBox_diff_aux + '<center> <img width=50% src="' + game.image['map-c1s2'].src + '"> </center>'
-          },
-          squareTwo: {
-            title: '<b>' + game.lang.difficulties + '</b>',
-            body: game.lang.infoBox_diff,
-            img: '<table> <tr> <td> <b>' + game.lang.difficulty + ':</b> 1' +
-              ' </td> <td> <b>' + game.lang.difficulty + ':</b> 5' +
-              ' </td> </tr> <tr> <td> <img width=100% src="' + game.image['s2-diff-1'].src + '"> ' +
-              ' </td> <td style="border-left: 4px solid white"> <img width=100% src="' + game.image['s2-diff-5'].src + '"> </td> </tr> </table> <br>' +
-              game.lang.infoBox_diff_aux + '<center> <img width=50% src="' + game.image['map-c1s2'].src + '"> </center>'
-          },
-        },
-
-        gameMisc: {
-          squareOne: {
-            title: '<b>' + game.lang.show + ' ' + auxText + '</b>',
-            body: game.lang.infoBox_misc_label,
-            img: '<center> <img width=80% src="' + game.image['s1-label'].src + '"> </center>',
-          },
-          circleOne: {
-            title: '<b>' + game.lang.show + ' ' + auxText + '</b>',
-            body: game.lang.infoBox_misc_label,
-            img: '<center> <img width=60% src="' + game.image['c1-label'].src + '"> </center>',
-          },
-          squareTwo: {
-            title: '<b>' + game.lang.show + ' ' + auxText + '</b>',
-            body: game.lang.infoBox_misc_rect,
-            img: '<center> <img width=100% src="' + game.image['s2-label'].src + '"> </center>',
-          }
-        }
-
-      };
-
-      // ------------- EVENTS
-
-      game.event.add('click', this.onInputDown);
-      game.event.add('mousemove', this.onInputOver);
-
-    }
-
-  },
-
-  /**
-   * Displays game menu information boxes.
-   */
-  showInfoBox: function (icon) {
-    self.infoBox.style.display = 'block';
-
-    const element = (icon.id == 'gameOperation') ? self.infoBoxContent[icon.id] : self.infoBoxContent[icon.id][gameType];
-
-    let msg = '<h3>' + element.title + '</h3>'
-      + '<p align=justify>' + element.body + '</p>'
-      + element.img;
-
-    document.getElementById('infobox-content').innerHTML = msg;
-  },
-
-  /**
-   * Saves information selected by the player 
-   * 
-   * @param {object} icon selected icon
-   */
-  load: function (icon) {
-
-    if (audioStatus) game.audio.beepSound.play();
-
-    const type = icon.iconType;
-    switch (type) {
-      case 'gameMode': gameMode = icon.gameMode; break;
-      case 'gameOperation': gameOperation = icon.gameOperation; break;
-      case 'difficulty': gameDifficulty = icon.difficulty; break;
-      case 'infoIcon': self.showInfoBox(icon); break;
-      case 'selectionBox':
-        if (icon.curFrame == 0) {
-          icon.curFrame = 1;
-          fractionLabel = true;
-        } else {
-          icon.curFrame = 0;
-          fractionLabel = false;
-        }
-        game.render.all();
-        break;
-      case 'enter':
-        if (debugMode) {
-          console.log('------------------------------'+
-          '\nGame State: ' + gameType +
-          '\nGame Mode: ' + gameMode + 
-          '\n------------------------------');
-        }
-        mapPosition = 0;  // Map position
-        mapMove = true; // Move no next point
-        completedLevels = 0;  // Reset the game progress when entering a new level
-        game.state.start('map');
-        break;
-    }
-
-  },
-
-  /**
-   * Calculate spacing for icons on the menu screen
-   * 
-   * @param {number} width width of the available part of the screen
-   * @param {number} numberOfIcons number or icons to be put on the screen
-   * 
-   * @returns {number} correct spacing between icons
-   */
-  getOffset: function (width, numberOfIcons) {
-    return width / (numberOfIcons + 1);
-  },
-
-  /**
-   * Called by mouse click event
-   * 
-   * @param {object} mouseEvent contains the mouse click coordinates
-   */
-  onInputDown: function (mouseEvent) {
-    const x = mouseEvent.offsetX, y = mouseEvent.offsetY;
-    let overIcon;
-
-    // Check if clicked on an icon
-    for (let i in self.menuIcons) {
-      if (game.math.isOverIcon(x, y, self.menuIcons[i])) {
-        overIcon = i;
-        break;
-      }
-    }
-
-    // Update gui
-    if (overIcon) { // If has clicked on an icon
-      document.body.style.cursor = 'pointer';
-      self.menuIcons.forEach(cur => {
-        if (cur.iconType == self.menuIcons[overIcon].iconType) { // If its in the same icon category
-          if (cur == self.menuIcons[overIcon]) { // If its the clicked icon
-            if (cur.iconType == 'gameMode' || cur.iconType == 'gameOperation') cur.curFrame = 1;
-            else if (cur.iconType == 'difficulty') cur.fillColor = colors.blue;
-          } else {
-            if (cur.iconType == 'gameMode' || cur.iconType == 'gameOperation') cur.curFrame = 0;
-            else if (cur.iconType == 'difficulty') cur.fillColor = colors.gray;
-          }
-        }
-      });
-
-      self.load(self.menuIcons[overIcon]);
-
-    } else document.body.style.cursor = 'auto';
-
-    navigationIcons.onInputDown(x, y);
-
-    game.render.all();
-
-  },
-
-  /**
-   * Called by mouse move event
-   * 
-   * @param {object} mouseEvent contains the mouse move coordinates
-   */
-  onInputOver: function (mouseEvent) {
-    const x = mouseEvent.offsetX, y = mouseEvent.offsetY;
-    let overIcon;
-
-    // Check if pointer is over an icon
-    for (let i in self.menuIcons) {
-      if (game.math.isOverIcon(x, y, self.menuIcons[i])) {
-        overIcon = i;
-        break;
-      }
-    }
-
-    // Update gui
-    if (overIcon) { // If pointer is over icon
-      document.body.style.cursor = 'pointer';
-      self.menuIcons.forEach(cur => {
-        if (cur.iconType == self.menuIcons[overIcon].iconType) { // If its in the same icon category
-          if (cur == self.menuIcons[overIcon]) { // If its the icon the pointer is over 
-            if (cur.iconType == 'enter') self.enterText.style = textStyles.h3__white;
-            cur.scale = cur.originalScale * 1.1;
-          } else {
-            cur.scale = cur.originalScale;
-          }
-        }
-      });
-    } else { // If pointer is not over icon
-      if (self.enterText) self.enterText.style = textStyles.h4_white;
-      self.menuIcons.forEach(cur => { cur.scale = cur.originalScale; });
-      document.body.style.cursor = 'auto';
-    }
-
-    // Check navigation icons
-    navigationIcons.onInputOver(x, y);
-
-    game.render.all();
-
-  }
-
-}

+ 0 - 0
js/gameMechanics.js


Some files were not shown because too many files changed in this diff