From c3cfb2ad71c636e6cb8ffe092b8f0f2043cddfb2 Mon Sep 17 00:00:00 2001 From: MattCastUCM Date: Thu, 25 Jul 2024 17:14:05 +0200 Subject: [PATCH] =?UTF-8?q?Traducciones=20y=20m=C3=A1s=20escenas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Escaleras, pasillo y frente de la clase (mañana del día 1) completados - Añadidas traducciones al inglés de las escenas completadas - Modificado character para poder cambiar la profundidad del personaje - Ajustado dialogManager para que las cajas de texto no desaparezcan si se lanza un evento y luego hay más diálogo --- localization/day1/classFrontMorningDay1.json | 80 +++++++++++ localization/day1/corridorMorningDay1.json | 69 ++++++++++ localization/en/computer.json | 39 +++--- .../en/day1/classFrontMorningDay1.json | 81 ++++++++++++ localization/en/day1/corridorMorningDay1.json | 37 ++++++ .../en/day1/livingroomMorningDay1.json | 2 +- .../en/day1/playgroundMorningDay1.json | 112 ++++++++++++++++ localization/en/everydayDialog.json | 31 +++++ localization/en/names.json | 12 +- localization/en/{ => test}/chat1.json | 0 localization/en/{ => test}/dadDialog.json | 0 localization/en/{ => test}/momDialog.json | 0 localization/en/transitionScenes.json | 4 +- localization/es/computer.json | 15 ++- .../es/day1/classFrontMorningDay1.json | 83 ++++++++++++ localization/es/day1/corridorMorningDay1.json | 37 ++++++ .../es/day1/livingroomMorningDay1.json | 2 +- localization/es/everydayDialog.json | 12 ++ localization/es/names.json | 11 +- localization/es/{ => test}/chat1.json | 0 localization/es/{ => test}/dadDialog.json | 0 localization/es/{ => test}/momDialog.json | 0 localization/es/transitionScenes.json | 5 +- localization/everydayDialog.json | 17 ++- localization/{ => test}/chat1.json | 0 localization/{ => test}/dadDialog.json | 0 localization/{ => test}/momDialog.json | 0 src/UI/dialog/dialogObject.js | 2 +- src/game.js | 19 ++- src/gameObjects/character.js | 4 + src/managers/dialogManager.js | 34 ++--- src/managers/gameManager.js | 4 +- src/scenes/bootScene.js | 34 ++--- src/scenes/gameLoop/alarmScene.js | 9 +- src/scenes/gameLoop/classBackBase.js | 4 +- .../gameLoop/day1/classBackBreakDay1.js | 12 -- .../gameLoop/day1/classBackMorningDay1.js | 13 ++ .../gameLoop/day1/classFontMorningDay1.js | 124 ++++++++++++++++++ .../gameLoop/day1/corridorMorningDay1.js | 45 +++++++ .../gameLoop/day1/playgroundMorningDay1.js | 13 ++ src/scenes/gameLoop/day1/stairsMorningDay1.js | 3 +- src/scenes/gameLoop/playgroundBase.js | 8 +- src/scenes/gameLoop/stairsBase.js | 11 +- src/scenes/test.js | 6 +- 44 files changed, 894 insertions(+), 100 deletions(-) create mode 100644 localization/day1/classFrontMorningDay1.json create mode 100644 localization/day1/corridorMorningDay1.json create mode 100644 localization/en/day1/classFrontMorningDay1.json create mode 100644 localization/en/day1/corridorMorningDay1.json create mode 100644 localization/en/day1/playgroundMorningDay1.json rename localization/en/{ => test}/chat1.json (100%) rename localization/en/{ => test}/dadDialog.json (100%) rename localization/en/{ => test}/momDialog.json (100%) create mode 100644 localization/es/day1/classFrontMorningDay1.json create mode 100644 localization/es/day1/corridorMorningDay1.json rename localization/es/{ => test}/chat1.json (100%) rename localization/es/{ => test}/dadDialog.json (100%) rename localization/es/{ => test}/momDialog.json (100%) rename localization/{ => test}/chat1.json (100%) rename localization/{ => test}/dadDialog.json (100%) rename localization/{ => test}/momDialog.json (100%) delete mode 100644 src/scenes/gameLoop/day1/classBackBreakDay1.js create mode 100644 src/scenes/gameLoop/day1/classBackMorningDay1.js diff --git a/localization/day1/classFrontMorningDay1.json b/localization/day1/classFrontMorningDay1.json new file mode 100644 index 0000000..f63d37a --- /dev/null +++ b/localization/day1/classFrontMorningDay1.json @@ -0,0 +1,80 @@ +{ + "ana": { + "root": { + "type": "text", + "character": "Ana", + "next": "choices" + }, + "choices": { + "type": "choice", + "choices":[ + { "next": "introduce" }, + { "next": "insult" } + ] + }, + + "introduce": { + "type": "text", + "character": "Ana", + "next": "teacherArrive" + }, + "insult": { + "type": "text", + "character": "Ana", + "next": "teacherArrive" + }, + + "teacherArrive": { + "type": "text", + "character": "", + "next": "teacher" + }, + "teacher": { + "type": "text", + "character": "teacher", + "next": "chooseSit" + }, + "chooseSit": { + "type": "choice", + "choices":[ + { "next": "startClass" }, + { "next": "ask" } + ] + }, + + "ask": { + "type": "text", + "character": "teacher", + "next": "startClass" + }, + + "startClass": { + "type": "event", + "events": [ + { + "startClass": { } + } + ] + } + }, + + "teacher": { + "root": { + "type": "text", + "character": "teacher", + "next": "startClass" + }, + + "startClass": { + "type": "event", + "events": [ + { + "startClass": { } + } + ] + } + } + + + +} \ No newline at end of file diff --git a/localization/day1/corridorMorningDay1.json b/localization/day1/corridorMorningDay1.json new file mode 100644 index 0000000..8a16922 --- /dev/null +++ b/localization/day1/corridorMorningDay1.json @@ -0,0 +1,69 @@ +{ + "maria": { + "root": { + "type": "text", + "character": "Maria", + "next": "leaveMaria" + }, + "leaveMaria": { + "type": "text", + "character": "player" + } + }, + + "alison": { + "root": { + "type": "text", + "character": "Alison" + } + }, + + "guille": { + "root": { + "type": "condition", + "conditions": [ + { + "next": "notTalked", + "talked": { + "value": false, + "operator": "equal", + "global": false, + "default": false + } + }, + { + "next": "talked", + "talked": { + "value": true, + "operator": "equal", + "global": false, + "default": false + } + } + ] + }, + + "notTalked": { + "type": "text", + "character": "Guille", + "next": "setTalked" + }, + "setTalked": { + "type": "event", + "events": [ + { + "setTalkedGuille": { + "variable": "talked", + "value": true, + "global": false + } + } + ] + }, + + "talked": { + "type": "text", + "character": "Guille" + } + } +} \ No newline at end of file diff --git a/localization/en/computer.json b/localization/en/computer.json index 47245e3..532637f 100644 --- a/localization/en/computer.json +++ b/localization/en/computer.json @@ -1,36 +1,41 @@ { "yourUserText": "Tu usuario", "yourPasswordText": "Tu contraseña", + "loginScreen": { - "subtitleText": "¡CONECTA CON TUS AMIGOS!", + "subtitleText": "CONNECT WITH YOUR FRIENDS!", "userInput": { - "sideText": "Usuario" + "sideText": "User" }, "passwordInput": { - "sideText": "Contraseña" + "sideText": "Password" }, - "errorText": "El usuario/contraseña introducidos son incorrectos", - "enterButton": "Entrar" + "errorText": "User/Password introduced are incorrect", + "enterButton": "Enter" }, + "socialNetScreen": { "tabTexts": { - "feed": "Tablón", - "friends": "Amigos", - "upload": "Postear" + "feed": "Dashboard", + "friends": "Friends", + "upload": "Publish" }, - "friendRequestNot": "¡Tienes nuevas peticiones de amistad!", + "friendRequestNot": "You've got new friend petitions!", "blockNot": "¡NO ESTÁ PERMITIDO BLOQUEAR USUARIOS!", - "friendsNumberText": "Amigos", - "pendingRequestsText": "Peticiones pendientes", - "informationText": "Este es tu tablón, mira lo que tus amigos han compartido" + "friendsNumberText": "Friends", + "pendingRequestsText": "Pending petitions: ", + "informationText": "This is your dashboard, look what your friends have shared" }, + + "commentsNumberText": "Comments", + + "friendRequestButtons": { + "acceptText": "Accept", + "denyText": "Deny" + }, + "bio": { "Alison": "Hola holita", "Guillermo": "holu" - }, - "commentsNumberText": "comentarios", - "friendRequestButtons": { - "acceptText": "Aceptar solicitud", - "denyText": "Denegar solicitud" } } \ No newline at end of file diff --git a/localization/en/day1/classFrontMorningDay1.json b/localization/en/day1/classFrontMorningDay1.json new file mode 100644 index 0000000..6e4e672 --- /dev/null +++ b/localization/en/day1/classFrontMorningDay1.json @@ -0,0 +1,81 @@ +{ + "ana": { + "root": { + "text": "I think you got into the wrong classroom." + }, + "choices": [ + { + "text": "No, it's just my first day, i am {{name}}." + }, + { + "text": "And who you are? The butch woman of the class?" + } + ], + + "introduce": [ + { + "text": "Oh, so you are the newcomer." + }, + { + "text": "I am Ana, i'm in this class too." + } + ], + "insult": { + "text": "You're a twat..." + }, + + "teacherArrive": { + "text": "(Knocks on the back, it seems like your new teacher has arrived)" + }, + "teacher": { + "text": "C'mon everyone, class is about to start, come in and sit." + }, + + "chooseSit":[ + { + "text": "(Sit in the last row)" + }, + { + "text": "(Ask where you can sit)" + } + ], + "ask": [ + { + "text": "Sit next to Alison.." + }, + { + "text": "Alison, do me a favour and solve any doubts {{name}} might have about school." + } + ] + + }, + + "teacher": { + "root": [ + { + "text": "{{name}} right?" + }, + { + "text": "Getting late on your first day, not the best way to start." + }, + { + "text": "", + "text_male": "Class, this is your new classmate, please, help him during the first days.", + "text_female": "Class, this is your new classmate, please, help her during the first days." + }, + { + "text": "{{name}}, i am your tutor, anything you need just let me know." + }, + { + "text": "Please, {{name}} sit next to Alison." + }, + { + "text": "Alison, do me a favour and solve any doubts {{name}} might have about school." + }, + { + "text": "Let's continue the class." + } + ] + } + +} \ No newline at end of file diff --git a/localization/en/day1/corridorMorningDay1.json b/localization/en/day1/corridorMorningDay1.json new file mode 100644 index 0000000..9af0caf --- /dev/null +++ b/localization/en/day1/corridorMorningDay1.json @@ -0,0 +1,37 @@ +{ + "maria": { + "root": { + "text": "..." + }, + "leaveMaria": { + "text": "She seems uncomfortable, better leave her alone for now." + } + }, + + "alison": { + "root": { + "text": "Sorry, i'm in a hurry, i'll be late if i don't get in." + } + }, + + "guille": { + "notTalked": [ + { + "text": "Hi, I was reading the bulletin board." + }, + { + "text": "There're intresting stuff sometimes, and someone has been leaving messages, stickers and riddles lately." + }, + { + "text": "Have a look at it at least once a day, get used to it." + }, + { + "text": "Shall we get in?" + } + ], + "talked": { + "text": "Remember to look at the boards, sometimes you can find intresting things." + } + } + +} \ No newline at end of file diff --git a/localization/en/day1/livingroomMorningDay1.json b/localization/en/day1/livingroomMorningDay1.json index dae8ca2..e17f526 100644 --- a/localization/en/day1/livingroomMorningDay1.json +++ b/localization/en/day1/livingroomMorningDay1.json @@ -43,7 +43,7 @@ "door": { "noBag": { - "text": "Me dejo la mochila. Será mejor que pases por mi habitación a recogerla antes de irme." + "text": "I forgot the backpack. I better go to my room and take it before leaving." } } } \ No newline at end of file diff --git a/localization/en/day1/playgroundMorningDay1.json b/localization/en/day1/playgroundMorningDay1.json new file mode 100644 index 0000000..a0055d3 --- /dev/null +++ b/localization/en/day1/playgroundMorningDay1.json @@ -0,0 +1,112 @@ +{ + "jose": { + "notTalked": { + "text": "You are new, aren't you?" + }, + "ask": { + "text": "Do you want anything?" + }, + + "talked": { + "text": "You're back, do you need anything else?" + }, + "choices": [ + { + "text": "Hello, I'm {{name}}..." + }, + { + "text": "(Ask where the classroom is)." + }, + { + "text": "I don't need anything, see you later." + } + ], + "askClass": { + "text": "That's my classroom too, it's in the second floor.Go upstairs on your right once you get inside the building. And in the first floor is the principal's office." + }, + "askMore": { + "text": "Do you need anything else?" + }, + "goodbye": { + "text": "Bye." + }, + "notIntroduced": { + "text": "I'm Jose." + }, + "alreadyIntroduced": { + "text": "You've already told me your name." + } + }, + + "alison": { + "root": { + "text": "Do I know you?" + }, + "choices": [ + { + "text": "I'm {{name}}, and you are...?" + }, + { + "text": "No, I'm sorry, I'm in a hurry. Bye." + } + + ], + "introduce": [ + { + "text": "Nice to meet ya, I'm Alison." + }, + { + "text": "I hope you have a nice time here, people are really nice." + }, + { + "text": "What grade are you in?" + } + ], + "playerAnswer": { + "text": "(You answer)" + }, + "afterPlayerIntroduction": [ + { + "text": "I'll see you in class then." + }, + { + "text": "The boy with the yellow shirt next to the playground entrance is also in our class." + }, + { + "text": "He's very nice, why don't you go and talk to him?" + } + ], + "goodbye": [ + { + "text": "Don't be shy, I don't bite." + }, + { + "text": "Well, see ya. Have a nice first day." + } + ] + }, + + "guille": { + "root": { + "text": "Are you new? I haven't seen you around here before." + }, + "choices": [ + { + "text": "Yeah, I'm {{name}}... who are you?" + }, + { + "text": "Excuse me, I'm in a hurry. (You leave)." + } + ], + "introduce": { + "text": "Call me Guille." + }, + "bellRinging": { + "text": "<>" + }, + "guilleGoodbye": { + "text": "We should get inside, see ya." + } + } + +} \ No newline at end of file diff --git a/localization/en/everydayDialog.json b/localization/en/everydayDialog.json index edc69b0..4d71fc7 100644 --- a/localization/en/everydayDialog.json +++ b/localization/en/everydayDialog.json @@ -26,6 +26,37 @@ } }, + "playground": { + "homeMorning": { + "root": { + "text": "I've just arrived, I cannot leave yet." + } + }, + "door": { + "root": { + "text": "Looks like I've arrived soon and entrance is not allowed. I'll hang around." + } + } + }, + + "stairs": { + "door": { + "root": { + "text": "Looks like nobody's in there." + } + }, + "tag": { + "root": { + "text": "Principal's office." + } + }, + "downstairs": { + "root": { + "text": "I should go straight to class." + } + } + }, + "corridor": { "bathroom": { "root": { diff --git a/localization/en/names.json b/localization/en/names.json index f546146..7a9246c 100644 --- a/localization/en/names.json +++ b/localization/en/names.json @@ -1,10 +1,16 @@ { + "player": "You", + "mom": "Mom", "dad": "Dad", - "player": "You", - "computer": "Computer", + "Maria": "Mary", "Alex": "Alex", "Alison": "Alison", - "Guille": "William" + "Guille": "William", + + "teacher": "Teacher", + "computer": "Computer", + "note": "Note" + } \ No newline at end of file diff --git a/localization/en/chat1.json b/localization/en/test/chat1.json similarity index 100% rename from localization/en/chat1.json rename to localization/en/test/chat1.json diff --git a/localization/en/dadDialog.json b/localization/en/test/dadDialog.json similarity index 100% rename from localization/en/dadDialog.json rename to localization/en/test/dadDialog.json diff --git a/localization/en/momDialog.json b/localization/en/test/momDialog.json similarity index 100% rename from localization/en/momDialog.json rename to localization/en/test/momDialog.json diff --git a/localization/en/transitionScenes.json b/localization/en/transitionScenes.json index 5c82174..264f3d9 100644 --- a/localization/en/transitionScenes.json +++ b/localization/en/transitionScenes.json @@ -1,6 +1,8 @@ { "day1": { - "start": "Your phone's alarm is ringing. It's time to wake up. Today you start in a new school, it is time to meet your new classmates." + "start": "Your phone's alarm is ringing. It's time to wake up. Today you start in a new school, it is time to meet your new classmates.", + "startClass": "Everyone sits down and the class starts.", + "startClassLate": "You go and sit in your place while everyone is looking at you." }, "day2": { diff --git a/localization/es/computer.json b/localization/es/computer.json index 47245e3..4c0c547 100644 --- a/localization/es/computer.json +++ b/localization/es/computer.json @@ -1,6 +1,7 @@ { "yourUserText": "Tu usuario", "yourPasswordText": "Tu contraseña", + "loginScreen": { "subtitleText": "¡CONECTA CON TUS AMIGOS!", "userInput": { @@ -12,6 +13,7 @@ "errorText": "El usuario/contraseña introducidos son incorrectos", "enterButton": "Entrar" }, + "socialNetScreen": { "tabTexts": { "feed": "Tablón", @@ -24,13 +26,16 @@ "pendingRequestsText": "Peticiones pendientes", "informationText": "Este es tu tablón, mira lo que tus amigos han compartido" }, - "bio": { - "Alison": "Hola holita", - "Guillermo": "holu" - }, - "commentsNumberText": "comentarios", + + "commentsNumberText": "Comentarios", + "friendRequestButtons": { "acceptText": "Aceptar solicitud", "denyText": "Denegar solicitud" + }, + + "bio": { + "Alison": "Hola holita", + "Guillermo": "holu" } } \ No newline at end of file diff --git a/localization/es/day1/classFrontMorningDay1.json b/localization/es/day1/classFrontMorningDay1.json new file mode 100644 index 0000000..76c70d2 --- /dev/null +++ b/localization/es/day1/classFrontMorningDay1.json @@ -0,0 +1,83 @@ +{ + "ana": { + "root": { + "text": "Me parece que te has equivocado de clase." + }, + "choices": [ + { + "text": "No, es que hoy es mi primer día, soy {{name}}" + }, + { + "text": "¿Y tú quién eres? ¿La marimacho de clase?" + } + ], + + "introduce": [ + { + "text": "", + "text_male": "Oh, así que tú eres {{name}}, el nuevo.", + "text_female": "Oh, así que tú eres {{name}}, la nueva." + }, + { + "text": "Yo soy Ana, también estoy en esta clase." + } + ], + "insult": { + "text": "Imbécil de mierda..." + }, + + "teacherArrive": { + "text": "(Ruidos de fondo, parece que tu nuevo profesor ha llegado)" + }, + "teacher": { + "text": "Vamos a empezar la clase, venga, pasad todos y sentaos." + }, + + "chooseSit":[ + { + "text": "(Sentarse en última fila)" + }, + { + "text": "(Preguntar dónde puedes sentarte)" + } + ], + "ask": [ + { + "text": "Siéntate al lado de Alison." + }, + { + "text": "Alison, haz el favor de resolver todas las dudas que tenga {{name}} sobre el colegio." + } + ] + + }, + + "teacher": { + "root": [ + { + "text": "{{name}} ¿verdad?" + }, + { + "text": "Llegar tarde tu primer día, no es una buena manera de empezar." + }, + { + "text": "", + "text_male": "Clase, este es vuestro nuevo compañero, por favor, ayudadle en sus primeros días.", + "text_female": "Clase, esta es vuestra nueva compañera, por favor, ayudadla en sus primeros días." + }, + { + "text": "{{name}}, yo soy vuestro tutor, cualquier cosa que necesites dímelo." + }, + { + "text": "Por favor, {{name}} siéntate al lado de Alison." + }, + { + "text": "Alison, haz el favor de resolver todas las dudas que tenga {{name}} sobre el colegio." + }, + { + "text": "Continuemos con la clase." + } + ] + } + +} \ No newline at end of file diff --git a/localization/es/day1/corridorMorningDay1.json b/localization/es/day1/corridorMorningDay1.json new file mode 100644 index 0000000..77d7531 --- /dev/null +++ b/localization/es/day1/corridorMorningDay1.json @@ -0,0 +1,37 @@ +{ + "maria": { + "root": { + "text": "..." + }, + "leaveMaria": { + "text": "Parece incómoda, mejor dejarla por ahora." + } + }, + + "alison": { + "root": { + "text": "Perdona, tengo prisa, si no entro ya a clase voy a llegar tarde." + } + }, + + "guille": { + "notTalked": [ + { + "text": "Buenas, estaba leyendo los anuncios del corcho." + }, + { + "text": "A veces hay cosas interesantes, y últimamente alguien va dejando cromos, mensajes y adivinanzas." + }, + { + "text": "Acostúmbrate a mirarlo una vez al día." + }, + { + "text": "¿Entramos a clase?" + } + ], + "talked": { + "text": "Acuérdate de mirar los corchos, a veces se encuentran cosas interesantes." + } + } + +} \ No newline at end of file diff --git a/localization/es/day1/livingroomMorningDay1.json b/localization/es/day1/livingroomMorningDay1.json index a2dc296..f204152 100644 --- a/localization/es/day1/livingroomMorningDay1.json +++ b/localization/es/day1/livingroomMorningDay1.json @@ -45,7 +45,7 @@ "door": { "noBag": { - "text": "Me dejo la mochila. Será mejor que pases por mi habitación a recogerla antes de irme." + "text": "Me dejo la mochila. Será mejor que pase por mi habitación a recogerla antes de irme." } } diff --git a/localization/es/everydayDialog.json b/localization/es/everydayDialog.json index e405afd..b762c89 100644 --- a/localization/es/everydayDialog.json +++ b/localization/es/everydayDialog.json @@ -45,6 +45,18 @@ "root": { "text": "Parece que no hay nadie dentro." } + }, + "tag": { + "root": { + "text": "Despacho del Director." + } + }, + "downstairs": { + "root": { + "text": "", + "text_male": "Debería ir directo a clase.", + "text_female": "Debería ir directa a clase." + } } }, diff --git a/localization/es/names.json b/localization/es/names.json index 8de1bb7..a634ce7 100644 --- a/localization/es/names.json +++ b/localization/es/names.json @@ -1,10 +1,15 @@ { + "player": "Tú", + "mom": "Mamá", "dad": "Papá", - "player": "Tú", - "computer": "Ordenador", + "Maria": "María", "Alex": "Alex", "Alison": "Alison", - "Guille": "Guille" + "Guille": "Guille", + + "teacher": "Profesor", + "computer": "Ordenador", + "note": "Nota" } \ No newline at end of file diff --git a/localization/es/chat1.json b/localization/es/test/chat1.json similarity index 100% rename from localization/es/chat1.json rename to localization/es/test/chat1.json diff --git a/localization/es/dadDialog.json b/localization/es/test/dadDialog.json similarity index 100% rename from localization/es/dadDialog.json rename to localization/es/test/dadDialog.json diff --git a/localization/es/momDialog.json b/localization/es/test/momDialog.json similarity index 100% rename from localization/es/momDialog.json rename to localization/es/test/momDialog.json diff --git a/localization/es/transitionScenes.json b/localization/es/transitionScenes.json index 6827d5d..ceb27d0 100644 --- a/localization/es/transitionScenes.json +++ b/localization/es/transitionScenes.json @@ -1,6 +1,9 @@ { "day1": { - "start": "La alarma de tu teléfono suena. Es hora de levantarse. Hoy empiezas en un nuevo colegio, es hora de conocer a tus compañeros." + "start": "La alarma de tu teléfono suena. Es hora de levantarse. Hoy empiezas en un nuevo colegio, es hora de conocer a tus compañeros.", + "startClass": "Os sentáis todos y empieza la clase.", + "startClassLate": "Te diriges entre todas las miradas a tu sitio y te sientas." + }, "day2": { diff --git a/localization/everydayDialog.json b/localization/everydayDialog.json index 575d909..04f5d55 100644 --- a/localization/everydayDialog.json +++ b/localization/everydayDialog.json @@ -8,7 +8,7 @@ }, "pcQuestion": { "type": "text", - "character": "PC", + "character": "computer", "next": "pcChoice" }, "pcChoice": { @@ -36,6 +36,7 @@ } }, + "playground": { "homeMorning": { "root": { @@ -52,16 +53,30 @@ }, + "stairs": { "door": { "root": { "type": "text", "character": "player" } + }, + "tag": { + "root": { + "type": "text", + "character": "note" + } + }, + "downstairs": { + "root": { + "type": "text", + "character": "player" + } } }, + "corridor": { "bathroom": { "root": { diff --git a/localization/chat1.json b/localization/test/chat1.json similarity index 100% rename from localization/chat1.json rename to localization/test/chat1.json diff --git a/localization/dadDialog.json b/localization/test/dadDialog.json similarity index 100% rename from localization/dadDialog.json rename to localization/test/dadDialog.json diff --git a/localization/momDialog.json b/localization/test/momDialog.json similarity index 100% rename from localization/momDialog.json rename to localization/test/momDialog.json diff --git a/src/UI/dialog/dialogObject.js b/src/UI/dialog/dialogObject.js index 90b83f5..016d33a 100644 --- a/src/UI/dialog/dialogObject.js +++ b/src/UI/dialog/dialogObject.js @@ -10,7 +10,7 @@ export default class DialogObject { // Configuracion de las animaciones this.animConfig = { - fadeTime: 100, + fadeTime: 150, fadeEase: 'linear' } } diff --git a/src/game.js b/src/game.js index a41fc25..da19156 100644 --- a/src/game.js +++ b/src/game.js @@ -1,10 +1,15 @@ import BootScene from './scenes/bootScene.js'; + +// Menus import LanguageMenu from './scenes/languageMenu.js'; import TitleMenu from './scenes/titleMenu.js'; import UserInfoMenu from './scenes/userInfoMenu.js'; +// Flujo de juego import TextOnlyScene from './scenes/textOnlyScene.js'; import AlarmScene from './scenes/gameLoop/alarmScene.js'; + +// Dia 1 import BedroomMorningDay1 from './scenes/gameLoop/day1/bedroomMorningDay1.js'; import LivingroomMorningDay1 from './scenes/gameLoop/day1/livingroomMorningDay1.js'; import PlaygroundMorningDay1 from './scenes/gameLoop/day1/playgroundMorningDay1.js'; @@ -12,10 +17,10 @@ import StairsMorningDay1 from './scenes/gameLoop/day1/stairsMorningDay1.js'; import CorridorMorningDay1 from './scenes/gameLoop/day1/corridorMorningDay1.js'; import BathroomMorning from './scenes/gameLoop/bathroomMorning.js'; import ClassFrontMorningDay1 from './scenes/gameLoop/day1/classFontMorningDay1.js'; -import ClassBackBreakDay1 from './scenes/gameLoop/day1/classBackBreakDay1.js'; +import ClassBackMorningDay1 from './scenes/gameLoop/day1/classBackMorningDay1.js'; +// UI import ComputerScene from './UI/computer/computerScene.js' - import UIManager from './managers/UIManager.js'; import Test from './scenes/test.js'; @@ -30,13 +35,13 @@ const config = { version: "1.0", type: Phaser.AUTO, - // Nota: el orden de las escenas es relevante. Las que se encuentran delante, se renderizan delante + // Nota: el orden de las escenas es relevante, y las que se encuentren antes en el array se renderizaran por debajo de las siguientes scene: [ BootScene, LanguageMenu, TitleMenu, UserInfoMenu, - TextOnlyScene, AlarmScene, - BedroomMorningDay1, LivingroomMorningDay1, PlaygroundMorningDay1, StairsMorningDay1, CorridorMorningDay1, BathroomMorning, ClassFrontMorningDay1, ClassBackBreakDay1, - Test, TestMenu, - ComputerScene, UIManager,], + AlarmScene, + BedroomMorningDay1, LivingroomMorningDay1, PlaygroundMorningDay1, StairsMorningDay1, CorridorMorningDay1, BathroomMorning, ClassFrontMorningDay1, ClassBackMorningDay1, + Test, TestMenu, + ComputerScene, UIManager, TextOnlyScene ], autoFocus: true, disableContextMenu: true, // Desactivar que aparezca el menu de inspeccionar al hacer click derecho render: { diff --git a/src/gameObjects/character.js b/src/gameObjects/character.js index 20cea3e..d8ea0f4 100644 --- a/src/gameObjects/character.js +++ b/src/gameObjects/character.js @@ -69,6 +69,10 @@ export default class Character { } } + setDepth(depth) { + this.char.setDepth(depth); + } + changeDialog(dialog) { this.dialog = dialog; } diff --git a/src/managers/dialogManager.js b/src/managers/dialogManager.js index 9d949a8..ded56c9 100644 --- a/src/managers/dialogManager.js +++ b/src/managers/dialogManager.js @@ -201,9 +201,23 @@ export default class DialogManager { this.processNode(); } else { - this.textbox.setPortrait(this.portraits.get(this.currNode.character)); - this.setText(this.currNode.dialogs[this.currNode.currDialog], true); - this.textbox.activate(true); + // Funcion a ejecutar para mostrar la caja. Actualiza el retrato y el texto y activa la caja + let showBox = () => { + this.textbox.setPortrait(this.portraits.get(this.currNode.character)); + this.setText(this.currNode.dialogs[this.currNode.currDialog], true); + this.textbox.activate(true); + } + + // Si el ultimo personaje que hablo es distinto del que habla ahora, se oculta la caja y luego se muestra + if (this.currNode.character !== this.lastCharacter) { + this.textbox.activate(false, () => { + showBox(); + }, 0); + } + // Si no, se muestra directamente. Si la caja ya estaba activa, no vuelve a mostrarla + else { + showBox(); + } } } else if (this.currNode.type === "event") { @@ -277,6 +291,7 @@ export default class DialogManager { } // Si ya se han mostrado todos los dialogos else { + // Actualiza el ultimo personaje que ha balado this.lastCharacter = this.currNode.character; // Se reinicia el dialogo del nodo actual y actualiza el nodo al siguiente @@ -284,18 +299,7 @@ export default class DialogManager { // EL SIGUIENTE NODO SERA EL PRIMER NODO DEL ARRAY DE NODOS SIGUIENTES this.currNode.currDialog = 0; this.currNode = this.currNode.next[0]; - - // Si el nodo es valido y el siguiente personaje que habla no es el mismo que el anterior - // Se oculta la caja de texto y una vez terminada la animacion, procesa el siguiente nodo - if (this.currNode && this.currNode.character !== this.lastCharacter && this.currNode.type !== "event") { - this.textbox.activate(false, () => { - this.processNode(); - }, 0); - } - // Si no, procesa el siguiente nodo directamente - else { - this.processNode(); - } + this.processNode(); } } diff --git a/src/managers/gameManager.js b/src/managers/gameManager.js index 686f3c2..74ef64f 100644 --- a/src/managers/gameManager.js +++ b/src/managers/gameManager.js @@ -238,7 +238,7 @@ export default class GameManager { this.computerScene = this.currentScene.scene.get(computerSceneName); this.computerScene.scene.sleep(); - let sceneName = 'PlaygroundMorningDay1'; + let sceneName = 'ClassFrontMorningDay1'; // Pasa a la escena inicial con los parametros text, onComplete y onCompleteDelay // let sceneName = 'TextOnlyScene'; @@ -247,7 +247,7 @@ export default class GameManager { text: this.i18next.t("day1.start", { ns: "transitionScenes", returnObjects: true }), onComplete: () => { // Al llamar a onComplete, se cambiara a la escena de la alarma - this.changeScene('AlarmScene', null, true); + this.changeScene('AlarmScene', null); }, onCompleteDelay: 500 }; diff --git a/src/scenes/bootScene.js b/src/scenes/bootScene.js index 9d1c3f7..6716bb8 100644 --- a/src/scenes/bootScene.js +++ b/src/scenes/bootScene.js @@ -146,9 +146,10 @@ export default class BootScene extends Phaser.Scene { // en cualquier idioma (aunque o existiese) supportedLngs: ['en', 'es'], // Namespaces que se cargan para cada uno de los idiomas - ns: ['titleMenu', 'userInfoMenu', 'names', 'phoneInfo', 'computer', - 'transitionScenes', 'everydayDialog', 'day1\\bedroomMorningDay1', 'day1\\livingroomMorningDay1', 'day1\\playgroundMorningDay1', - 'momDialog', 'dadDialog', 'chat1'], + ns: ['titleMenu', 'userInfoMenu', 'names', 'phoneInfo', 'computer', 'transitionScenes', 'everydayDialog', + 'day1\\bedroomMorningDay1', 'day1\\livingroomMorningDay1', 'day1\\playgroundMorningDay1', 'day1\\corridorMorningDay1', 'day1\\classFrontMorningDay1', + + 'test\\momDialog', 'test\\dadDialog', 'test\\chat1'], preload: ['en', 'es'], // Mostrar informacion de ayuda por consola debug: false, @@ -188,15 +189,18 @@ export default class BootScene extends Phaser.Scene { // Archivos de dialogos (estructura) this.load.setPath('localization'); - this.load.json('momDialog', 'momDialog.json'); - this.load.json('dadDialog', 'dadDialog.json'); - this.load.json('chat1', 'chat1.json'); + this.load.json('momDialog', 'test/momDialog.json'); + this.load.json('dadDialog', 'test/dadDialog.json'); + this.load.json('chat1', 'test/chat1.json'); this.load.json('posts', 'posts.json'); this.load.json('everydayDialog', 'everydayDialog.json'); this.load.json('bedroomMorningDay1', 'day1/bedroomMorningDay1.json'); this.load.json('livingroomMorningDay1', 'day1/livingroomMorningDay1.json'); this.load.json('playgroundMorningDay1', 'day1/playgroundMorningDay1.json'); + this.load.json('corridorMorningDay1', 'day1/corridorMorningDay1.json'); + this.load.json('classFrontMorningDay1', 'day1/classFrontMorningDay1.json'); + } loadSpinalAnims() { @@ -205,28 +209,28 @@ export default class BootScene extends Phaser.Scene { // Personajes y sus respectivas animaciones esqueletales de Spine // [Idle01, IdleBase, Walk] this.load.spine('mom', 'mom/Front.json', 'mom/Front.atlas'); - + // [Idle01, IdleBase] this.load.spine('dad', 'dad/Front 34.json', 'dad/Front 34.atlas'); // [Idle01, IdleBase] this.load.spine('Alex_front', 'Alex/Front 34.json', 'Alex/Front 34.atlas'); - + // [IdleBase, Walk] this.load.spine('Alex_side', 'Alex/Side.json', 'Alex/Side.atlas'); - + // [Idle01, IdleBase] this.load.spine('Alison', 'Alison/Front 34.json', 'Alison/Front 34.atlas'); - + // [Idle01, IdleBase] this.load.spine('Ana', 'Ana/Front 34.json', 'Ana/Front 34.atlas'); - + // [Idle01, IdleBase] this.load.spine('Guille', 'Guille/Front 34.json', 'Guille/Front 34.atlas'); - + // [Idle01, IdleBase] this.load.spine('Jose', 'Jose/Front 34.json', 'Jose/Front 34.atlas'); - + // [Idle01, IdleBase, IdlePhone] this.load.spine('Maria', 'Maria/Front 34.json', 'Maria/Front 34.atlas') } @@ -289,7 +293,7 @@ export default class BootScene extends Phaser.Scene { this.load.image('backRow5Chairs', 'classBack/desks/backRow5Chairs.png'); this.load.image('backRow5Tables', 'classBack/desks/backRow5Tables.png'); this.load.atlas('classBack', 'classBack/classBack.png', 'classBack/classBack.json'); - + // Pesadillas // this.load.image('nightmaresBg', 'nightmares/nightmaresBg.png'); // this.load.image('gum', 'nightmares/gum.png'); @@ -326,5 +330,5 @@ export default class BootScene extends Phaser.Scene { gameManager.startLangMenu(); } - + } \ No newline at end of file diff --git a/src/scenes/gameLoop/alarmScene.js b/src/scenes/gameLoop/alarmScene.js index df90ef5..993ef72 100644 --- a/src/scenes/gameLoop/alarmScene.js +++ b/src/scenes/gameLoop/alarmScene.js @@ -34,7 +34,7 @@ export default class AlarmScene extends BaseScene { this.phoneManager.phone.setDayInfo(hour, day); // Pone la imagen de fondo con las dimensiones del canvas - let bg = this.add.image(0, 0, this.atlasName, 'bedroomCeiling').setOrigin(0.5, 0); + let bg = this.add.image(0, 0, 'bedroomCeiling').setOrigin(0.5, 0); let scale = this.CANVAS_HEIGHT / bg.height; bg.setScale(scale); @@ -52,7 +52,10 @@ export default class AlarmScene extends BaseScene { this.UIManager.cameras.main.scrollX = 0; }); this.dispatcher.add(this.phoneManager.wakeUpEvent, this, (obj) => { - this.gameManager.changeScene('BedroomMorningDay' + this.gameManager.day); + let params = { + camPos: "right" + } + this.gameManager.changeScene('BedroomMorningDay' + this.gameManager.day, params); }); } @@ -60,7 +63,7 @@ export default class AlarmScene extends BaseScene { update(t, dt) { if (!this.phoneManager.toggling && this.phoneManager.phone.visible) { super.update(t, dt); - this.UIManager.cameras.main.scrollX = this.cameras.main.scrollX * dt; + this.UIManager.cameras.main.scrollX = this.cameras.main.scrollX; } } diff --git a/src/scenes/gameLoop/classBackBase.js b/src/scenes/gameLoop/classBackBase.js index 53244dd..3213815 100644 --- a/src/scenes/gameLoop/classBackBase.js +++ b/src/scenes/gameLoop/classBackBase.js @@ -32,11 +32,11 @@ export default class ClassBackBase extends BaseScene { y: 530 * this.scale }; this.doorNode = null; - let doorClosed = this.add.image(doorPos.x, doorPos.y, this.atlasName, 'classDoorClosed').setOrigin(0, 0).setScale(this.scale); + this.doorClosed = this.add.image(doorPos.x, doorPos.y, this.atlasName, 'classDoorClosed').setOrigin(0, 0).setScale(this.scale); let doorOpened = this.add.image(doorPos.x, doorPos.y, this.atlasName, 'classDoorOpened').setOrigin(0, 0).setScale(this.scale); // Al hacer click, si hay algun dialogo que mostrar (para indicar que no se puede salir), se // mostrara. En caso contrario, se pasara a la escena del pasillo y se elimina esta escena - super.toggleDoor(doorClosed, doorOpened, () => { + super.toggleDoor(this.doorClosed, doorOpened, () => { if (this.doorNode) { this.dialogManager.setNode(this.doorNode); } diff --git a/src/scenes/gameLoop/day1/classBackBreakDay1.js b/src/scenes/gameLoop/day1/classBackBreakDay1.js deleted file mode 100644 index 58dd201..0000000 --- a/src/scenes/gameLoop/day1/classBackBreakDay1.js +++ /dev/null @@ -1,12 +0,0 @@ -import ClassBackBase from "../classBackBase.js"; - -export default class ClassBackBreakDay1 extends ClassBackBase { - constructor() { - super('ClassBackBreakDay1'); - } - - create(params) { - super.create(params); - - } -} diff --git a/src/scenes/gameLoop/day1/classBackMorningDay1.js b/src/scenes/gameLoop/day1/classBackMorningDay1.js new file mode 100644 index 0000000..a07bb2a --- /dev/null +++ b/src/scenes/gameLoop/day1/classBackMorningDay1.js @@ -0,0 +1,13 @@ +import ClassBackBase from "../classBackBase.js"; + +export default class ClassBackMorningDay1 extends ClassBackBase { + constructor() { + super('ClassBackMorningDay1'); + } + + create(params) { + super.create(params); + + this.doorClosed.disableInteractive(); + } +} diff --git a/src/scenes/gameLoop/day1/classFontMorningDay1.js b/src/scenes/gameLoop/day1/classFontMorningDay1.js index 707b80b..0328443 100644 --- a/src/scenes/gameLoop/day1/classFontMorningDay1.js +++ b/src/scenes/gameLoop/day1/classFontMorningDay1.js @@ -1,4 +1,5 @@ import ClassFrontBase from "../classFrontBase.js"; +import Character from "../../../gameObjects/character.js" export default class ClassFrontMorningDay1 extends ClassFrontBase { constructor() { @@ -8,5 +9,128 @@ export default class ClassFrontMorningDay1 extends ClassFrontBase { create(params) { super.create(params); + let tr = { + x: this.CANVAS_WIDTH, + y: this.CANVAS_HEIGHT, + scale: 0 + }; + let teacher = new Character(this, "dad", tr, this.portraitTr, () => { }); + this.portraits.set("teacher", teacher.getPortrait()); + + // Si no se ha llegado tarde, solo se coloca a Ana en clase + if (!this.gameManager.getValue(this.gameManager.isLate)) { + tr = { + x: 650, + y: this.CANVAS_HEIGHT * 0.86, + scale: 0.1 + }; + let ana = new Character(this, "Ana", tr, this.portraitTr, () => { + this.dialogManager.setNode(anaNode); + }); + ana.setDepth(this.row4Tables.depth); + ana.setAnimation("IdleBase", true); + this.portraits.set("Ana", ana.getPortrait()); + + let nodes = this.cache.json.get('classFrontMorningDay1'); + let anaNode = super.readNodes(nodes, "day1\\classFrontMorningDay1", "ana", true); + } + // Si no, se colocan mas alumnos en la clase y se pone directamente el nodo del profesor + else { + tr = { + x: 160, + y: this.CANVAS_HEIGHT * 0.51, + scale: this.scale * 1.4 + }; + this.add.image(tr.x, tr.y, this.atlasName, 'frontChar3').setOrigin(0, 0).setScale(tr.scale).setDepth(this.row1Chairs.depth); + + tr = { + x: 680, + y: this.CANVAS_HEIGHT * 0.55, + scale: this.scale * 1.4 + }; + this.add.image(tr.x, tr.y, this.atlasName, 'frontChar2').setOrigin(0, 0).setScale(tr.scale).setDepth(this.row1Chairs.depth); + + tr = { + x: 1150, + y: this.CANVAS_HEIGHT * 0.55, + scale: this.scale * 1.4 + }; + this.add.image(tr.x, tr.y, this.atlasName, 'frontChar1').setOrigin(0, 0).setScale(tr.scale).setDepth(this.row1Chairs.depth); + + + tr = { + x: 280, + y: this.CANVAS_HEIGHT * 0.54, + scale: this.scale * 1 + }; + this.add.image(tr.x, tr.y, this.atlasName, 'frontChar8').setOrigin(0, 0).setScale(tr.scale).setDepth(this.row2Chairs.depth); + + tr = { + x: 720, + y: this.CANVAS_HEIGHT * 0.54, + scale: this.scale * 1 + }; + this.add.image(tr.x, tr.y, this.atlasName, 'frontChar10').setOrigin(0, 0).setScale(tr.scale).setDepth(this.row2Chairs.depth); + + tr = { + x: 1060, + y: this.CANVAS_HEIGHT * 0.54, + scale: this.scale * 1.1 + }; + this.add.image(tr.x, tr.y, this.atlasName, 'frontChar11').setOrigin(0, 0).setScale(tr.scale).setDepth(this.row2Chairs.depth); + + + tr = { + x: 1560, + y: this.CANVAS_HEIGHT * 0.52, + scale: this.scale * 0.9 + }; + this.add.image(tr.x, tr.y, this.atlasName, 'frontChar7').setOrigin(0, 0).setScale(-tr.scale, tr.scale).setDepth(this.row3Chairs.depth); + + tr = { + x: 1030, + y: this.CANVAS_HEIGHT * 0.52, + scale: this.scale * 0.8 + }; + this.add.image(tr.x, tr.y, this.atlasName, 'frontChar5').setOrigin(0, 0).setScale(tr.scale).setDepth(this.row3Chairs.depth); + + + tr = { + x: 510, + y: this.CANVAS_HEIGHT * 0.49, + scale: this.scale * 0.76 + }; + this.add.image(tr.x, tr.y, this.atlasName, 'frontChar9').setOrigin(0, 0).setScale(tr.scale).setDepth(this.row4Chairs.depth); + + + let nodes = this.cache.json.get('classFrontMorningDay1'); + let teacherNode = super.readNodes(nodes, "day1\\classFrontMorningDay1", "teacher", true); + this.dialogManager.setNode(teacherNode); + } + + + // Evento llamado cuando terminan los dialogos y empieza la clase + this.dispatcher.addOnce("startClass", this, (obj) => { + console.log(obj); + + let sceneName = 'TextOnlyScene'; + + // Se obtiene el texto de la escena de transicion del archivo de traducciones + let text = this.i18next.t("day1.startClass", { ns: "transitionScenes", returnObjects: true }); + if (this.gameManager.getValue(this.gameManager.isLate)) { + text = this.i18next.t("day1.startClassLate", { ns: "transitionScenes", returnObjects: true }); + } + + let params = { + text: text, + onComplete: () => { + this.gameManager.changeScene('ClassBackMorningDay1'); + }, + onCompleteDelay: 500 + }; + + // Se cambia a la escena de transicion + this.gameManager.changeScene(sceneName, params); + }); } } diff --git a/src/scenes/gameLoop/day1/corridorMorningDay1.js b/src/scenes/gameLoop/day1/corridorMorningDay1.js index f420bd9..6de5846 100644 --- a/src/scenes/gameLoop/day1/corridorMorningDay1.js +++ b/src/scenes/gameLoop/day1/corridorMorningDay1.js @@ -1,4 +1,5 @@ import CorridorBase from "../corridorBase.js"; +import Character from "../../../gameObjects/character.js" export default class CorridorMorningDay1 extends CorridorBase { constructor() { @@ -19,5 +20,49 @@ export default class CorridorMorningDay1 extends CorridorBase { else { this.girlsBathroom = "BathroomMorning"; } + + // Si no se llega tarde, se colocan personajes en el fondo + if (!this.gameManager.getValue(this.gameManager.isLate)) { + let tr = { + x: 250, + y: this.CANVAS_HEIGHT * 0.75, + scale: 0.087 + }; + let maria = new Character(this, "Maria", tr, this.portraitTr, () => { + this.dialogManager.setNode(mariaNode); + }); + maria.setAnimation("IdleBase", true); + this.portraits.set("Maria", maria.getPortrait()); + + tr = { + x: this.rightBound * 0.60, + y: this.CANVAS_HEIGHT * 0.75, + scale: 0.083 + }; + let alison = new Character(this, "Alison", tr, this.portraitTr, () => { + this.dialogManager.setNode(alisonNode); + }); + alison.setAnimation("IdleBase", true); + this.portraits.set("Alison", alison.getPortrait()); + + + tr = { + x: this.rightBound * 0.76, + y: this.CANVAS_HEIGHT * 0.93, + scale: 0.15 + }; + let guille = new Character(this, "Guille", tr, this.portraitTr, () => { + this.dialogManager.setNode(guilleNode); + }); + guille.setScale(-tr.scale, tr.scale); + guille.setAnimation("IdleBase", true); + this.portraits.set("Guille", guille.getPortrait()); + + let nodes = this.cache.json.get('corridorMorningDay1'); + let mariaNode = super.readNodes(nodes, "day1\\corridorMorningDay1", "maria", true); + let alisonNode = super.readNodes(nodes, "day1\\corridorMorningDay1", "alison", true); + let guilleNode = super.readNodes(nodes, "day1\\corridorMorningDay1", "guille", true); + } + } } diff --git a/src/scenes/gameLoop/day1/playgroundMorningDay1.js b/src/scenes/gameLoop/day1/playgroundMorningDay1.js index b20f2ee..c978138 100644 --- a/src/scenes/gameLoop/day1/playgroundMorningDay1.js +++ b/src/scenes/gameLoop/day1/playgroundMorningDay1.js @@ -62,14 +62,27 @@ export default class PlaygroundMorningDay1 extends PlaygroundBase { nodes = this.cache.json.get('everydayDialog'); this.homeNode = super.readNodes(nodes, "everydayDialog", "playground.homeMorning", true); + + // Evento llamado cuando suena la campana this.dispatcher.addOnce("openDoors", this, (obj) => { console.log(obj); + + // Cambia la hora del movil + let hour = this.i18next.t("clock.classStart", { ns: "phoneInfo" }); + this.phoneManager.phone.setDayInfo(hour, ""); + + // Se quita el dialogo que aparece al hacer click en las puertas + this.doorNode = null; + + // Se hace fade out de todos los personajes de la escena let anim = this.tweens.add({ targets: [jose.char, alison.char, guille.char], alpha: { from: 1, to: 0 }, duration: 1000, repeat: 0, }); + + // Una vez termina la animacion, se abren las puertas anim.on('complete', () => { super.openDoors(); }) diff --git a/src/scenes/gameLoop/day1/stairsMorningDay1.js b/src/scenes/gameLoop/day1/stairsMorningDay1.js index 55c1789..2a5cf11 100644 --- a/src/scenes/gameLoop/day1/stairsMorningDay1.js +++ b/src/scenes/gameLoop/day1/stairsMorningDay1.js @@ -11,6 +11,7 @@ export default class StairsMorningDay1 extends StairsBase { this.playground = "PlaygroundMorningDay1"; this.corridor = "CorridorMorningDay1"; - + let nodes = this.cache.json.get('everydayDialog'); + this.playgroundNode = super.readNodes(nodes, "everydayDialog", "stairs.downstairs", true); } } diff --git a/src/scenes/gameLoop/playgroundBase.js b/src/scenes/gameLoop/playgroundBase.js index 28d2fad..cb8d99d 100644 --- a/src/scenes/gameLoop/playgroundBase.js +++ b/src/scenes/gameLoop/playgroundBase.js @@ -49,14 +49,12 @@ export default class PlaygroundBase extends BaseScene { this.doorNode = super.readNodes(nodes, "everydayDialog", "playground.door", true);; let doors = this.add.rectangle(2640 * this.scale, 1060 * this.scale, 262, 186, 0xfff, 0).setOrigin(0, 0); doors.setInteractive({ useHandCursor: true }); - // Al hacer click sobre la zona de la peurta, si las puertas estan abiertas, se pasara a la escena de las escaleras - // sin eliminar esta escena. En caso contrario, se mostrara un dialogo indicando que no se puede entrar + // Al hacer click sobre la zona de la puerta, si hay algun dialogo que mostrar, (para indicar que + // no se puede entrar), se mostrara. En caso contrario, se pasara a la escena de las escaleras doors.on('pointerdown', () => { - // Si las puertas estan abiertas, pasa a la escena de las escaleras - if (this.bgImg === 'playgroundOpened') { + if (!this.doorNode) { this.gameManager.changeScene(this.stairs, { } , true); } - // Si no, se muestra el dialogo correspondiente else { this.dialogManager.setNode(this.doorNode); } diff --git a/src/scenes/gameLoop/stairsBase.js b/src/scenes/gameLoop/stairsBase.js index a4beffc..cf1ba05 100644 --- a/src/scenes/gameLoop/stairsBase.js +++ b/src/scenes/gameLoop/stairsBase.js @@ -24,8 +24,17 @@ export default class StairsBase extends BaseScene { this.bg.setScale(this.scale); this.rightBound = this.bg.displayWidth; - // Puerta del despacho let nodes = this.cache.json.get('everydayDialog'); + + let wallTagNode = super.readNodes(nodes, "everydayDialog", "stairs.tag", true); + let wallTag = this.add.rectangle(2321 * this.scale, 650 * this.scale, 130 * this.scale, 78 * this.scale, 0xfff, 0).setOrigin(0, 0); + wallTag.setInteractive({ useHandCursor: true }); + wallTag.on('pointerdown', () => { + this.dialogManager.setNode(wallTagNode); + + }); + + // Puerta del despacho this.doorNode = super.readNodes(nodes, "everydayDialog", "stairs.door", true); let doorPos = { x: 2490 * this.scale, diff --git a/src/scenes/test.js b/src/scenes/test.js index 71a2c80..725e5fc 100644 --- a/src/scenes/test.js +++ b/src/scenes/test.js @@ -55,9 +55,9 @@ export default class Test extends BaseScene { let test2 = this.cache.json.get('dadDialog'); let test3 = this.cache.json.get('chat1'); - let momNode = super.readNodes(test1, "momDialog", "", true); - let dadNode = super.readNodes(test2, "dadDialog", "", true); - let choices = super.readNodes(test3, "chat1", "", true); + let momNode = super.readNodes(test1, "test\\momDialog", "", true); + let dadNode = super.readNodes(test2, "test\\dadDialog", "", true); + let choices = super.readNodes(test3, "test\\chat1", "", true); // Telefono let chatName = this.i18next.t("textMessages.chat1", { ns: "phoneInfo", returnObjects: true });