diff --git a/Juego/.classpath b/Juego/.classpath
index adf4efe..b410df7 100644
--- a/Juego/.classpath
+++ b/Juego/.classpath
@@ -38,14 +38,14 @@
-
-
+
+
-
+
diff --git a/Juego/.project b/Juego/.project
index 9adf0d4..aba3012 100644
--- a/Juego/.project
+++ b/Juego/.project
@@ -1,6 +1,6 @@
- JR-Grupo-H
+ JR-Grupo-H-Master
diff --git a/Juego/pom.xml b/Juego/pom.xml
index 003e686..7ea16d8 100644
--- a/Juego/pom.xml
+++ b/Juego/pom.xml
@@ -8,7 +8,7 @@
0.0.1-SNAPSHOT
jar
- rest_ejer1_con_ui
+ rest
Backend y frontend para el ejercicio de gesti�n de items
diff --git a/Juego/src/main/java/es/urjc/code/juegosenred/Rest.java b/Juego/src/main/java/es/urjc/code/juegosenred/Rest.java
index bcf9649..696b82f 100644
--- a/Juego/src/main/java/es/urjc/code/juegosenred/Rest.java
+++ b/Juego/src/main/java/es/urjc/code/juegosenred/Rest.java
@@ -39,19 +39,4 @@ public WebsocketEchoHandler echoHandler()
public static void main(String[] args) {
SpringApplication.run(Rest.class, args);
}
-}
-
-/*
-package es.urjc.code.juegosenred;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-@SpringBootApplication
-public class RestEjer1ConUiApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(RestEjer1ConUiApplication.class, args);
- }
-}
-*/
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/Juego/src/main/java/es/urjc/code/juegosenred/WebsocketEchoHandler.java b/Juego/src/main/java/es/urjc/code/juegosenred/WebsocketEchoHandler.java
index 956ccc6..80eaad8 100644
--- a/Juego/src/main/java/es/urjc/code/juegosenred/WebsocketEchoHandler.java
+++ b/Juego/src/main/java/es/urjc/code/juegosenred/WebsocketEchoHandler.java
@@ -18,12 +18,21 @@ public class WebsocketEchoHandler extends TextWebSocketHandler {
private ObjectMapper mapper = new ObjectMapper();
BlockingQueue matchmaking = new ArrayBlockingQueue<>(1000);
ConcurrentHashMap users = new ConcurrentHashMap();
- int num = 0;
+ int num;
Random rand = new Random();
int [] r1 = new int[9];
int [] r2 = new int[3];
int [] r3 = new int[3];
-
+
+ public void setNum(int h)
+ {
+ num=h;
+ }
+
+ public int getNum()
+ {
+ return num;
+ }
@Override
protected void handleTextMessage(WebSocketSession session, TextMessage message) throws Exception {
@@ -83,66 +92,47 @@ protected void handleTextMessage(WebSocketSession session, TextMessage message)
//Eleccion de personajes y de habilidades
case "1":
{
- num++;
+ this.setNum(this.getNum()+1);
//Se elijen los personajes
- String p = node.get("personaje").asText();
+ String p = node.get("p").asText();
String h1 = node.get("h1").asText();
String h2 = node.get("h2").asText();
String h3 = node.get("h3").asText();
String enemigo = node.get("sess").asText();
-
- //Se hacen los randoms para la partida
- int ch1 = r1[0];
- int ch2 = r1[1];
- int ch3 = r1[2];
- int ch4 = r1[3];
- int ch5 = r1[4];
- int ch6 = r1[5];
- int ch7 = r1[6];
- int ch8 = r1[7];
- int ch9 = r1[8];
-
- int rQ1 = r2[0];
- int rQ2 = r2[1];
- int rQ3 = r2[2];
-
- int cT1 = r3[0];
- int cT2 = r3[1];
- int cT3 = r3[2];
+
//Respuesta
ObjectNode responseNode = mapper.createObjectNode();
responseNode.put("code",1);
- responseNode.put("personaje",p);
+ responseNode.put("p",p);
responseNode.put("h1",h1);
responseNode.put("h2",h2);
responseNode.put("h3",h3);
- responseNode.put("characters", ch1);
- responseNode.put("characters", ch2);
- responseNode.put("characters", ch3);
- responseNode.put("characters", ch4);
- responseNode.put("characters", ch5);
- responseNode.put("characters", ch6);
- responseNode.put("characters", ch7);
- responseNode.put("characters", ch8);
- responseNode.put("characters", ch9);
- responseNode.put("characters", rQ1);
- responseNode.put("characters", rQ2);
- responseNode.put("characters", rQ3);
- responseNode.put("characters", cT1);
- responseNode.put("characters", cT2);
- responseNode.put("characters", cT3);
+ responseNode.put("ch1", r1[0]);
+ responseNode.put("ch2", r1[1]);
+ responseNode.put("ch3", r1[2]);
+ responseNode.put("ch4", r1[3]);
+ responseNode.put("ch5", r1[4]);
+ responseNode.put("ch6", r1[5]);
+ responseNode.put("ch7", r1[6]);
+ responseNode.put("ch8", r1[7]);
+ responseNode.put("ch9", r1[8]);
+ responseNode.put("rQ1", r2[0]);
+ responseNode.put("rQ2", r2[1]);
+ responseNode.put("rQ3", r2[2]);
+ responseNode.put("cT1", r3[0]);
+ responseNode.put("cT2", r3[1]);
+ responseNode.put("cT3", r3[2]);
System.out.println("Mensaje enviado: " + responseNode.toString());
users.get(enemigo).sendMessage(new TextMessage(responseNode.toString()));
- session.sendMessage(new TextMessage(responseNode.toString()));
-
- if(num==2)
- {
- ObjectNode responseNode1 = mapper.createObjectNode();
- responseNode1.put("code",4);
- users.get(enemigo).sendMessage(new TextMessage(responseNode1.toString()));
- session.sendMessage(new TextMessage(responseNode1.toString()));
- }
+
+ if(num>=2)
+ {
+ ObjectNode responseNode1 = mapper.createObjectNode();
+ responseNode1.put("code",4);
+ users.get(enemigo).sendMessage(new TextMessage(responseNode1.toString()));
+ session.sendMessage(new TextMessage(responseNode1.toString()));
+ }
break;
}
diff --git a/Juego/src/main/resources/static/cutsceneOnline.js b/Juego/src/main/resources/static/cutsceneOnline.js
index 22f0b35..1c7b2b1 100644
--- a/Juego/src/main/resources/static/cutsceneOnline.js
+++ b/Juego/src/main/resources/static/cutsceneOnline.js
@@ -58,7 +58,7 @@ class CutsceneOnline extends Phaser.Scene {
Las preguntas coinciden con el índice de answers que lleva su cuenta (actualizado en schedulePlaner())
*/
this.questions = ["¿Cuántos fantasmas azules pasaron?", "¿Cuántos fantasmas rojos pasaron?", "¿Cuántos cazafantasmas pasaron?", "¿Cuántos personajes pasaron en total?"];
- this.questionIndex = roundQuestions[round];
+ this.questionIndex = round;
this.answers = [0, 0, 0, 0];
//Timers para enseñar la pregunta y cambiar de escena.
@@ -89,11 +89,10 @@ class CutsceneOnline extends Phaser.Scene {
//Enseña la pregunta
showQuestion() {
- this.add.text(gameWidth*3/20, gameHeight/2, this.questions[this.questionIndex], { font: '64px Caveat Brush', fill: '#ffffff' });
- console.log(this.answers[this.questionIndex]);
+ this.add.text(gameWidth*3/20, gameHeight/2, roundQuestions[this.questionIndex], { font: '64px Caveat Brush', fill: '#ffffff' });
}
- //Cambia la escena y acutaliza el valor de la variable global round con la respuesta
+ //Cambia la escena y actualiza el valor de la variable global round con la respuesta
changeScene() {
answer = this.answers[this.questionIndex];
console.log(this.answers[this.questionIndex] + ' = ' + answer);
diff --git a/Juego/src/main/resources/static/login.js b/Juego/src/main/resources/static/login.js
index 4896f1c..ab9a550 100644
--- a/Juego/src/main/resources/static/login.js
+++ b/Juego/src/main/resources/static/login.js
@@ -48,25 +48,11 @@ var p;
var h1;
var h2;
var h3;
-var ch1;
-var ch2;
-var ch3;
-var ch4;
-var ch5;
-var ch6;
-var ch7;
-var ch8;
-var ch9;
-var rQ1;
-var rQ2;
-var rQ3;
-var cT1;
-var cT2;
-var cT3;
-
-var characters;
-var correctTombstones;
-var roundQuestions;
+
+
+var characters = [9];
+var correctTombstones = [3];
+var roundQuestions = [3];
var ax;
var ay;
@@ -117,7 +103,7 @@ connection.onmessage = function(msg)
case 1:
{
//Generacion de la partida
- p = info.personaje;
+ p = info.p;
h1 = info.h1;
h2 = info.h2;
h3 = info.h3;
diff --git "a/Juego/src/main/resources/static/selecci\303\263nPJH.js" "b/Juego/src/main/resources/static/selecci\303\263nPJH.js"
index 2895e67..0e1d5aa 100644
--- "a/Juego/src/main/resources/static/selecci\303\263nPJH.js"
+++ "b/Juego/src/main/resources/static/selecci\303\263nPJH.js"
@@ -39,41 +39,119 @@ class SeleccionPJH extends Phaser.Scene {
Al pulsarse cada uno de los dos botones, dependiendo de la iteración de la configuración de partida se actualiza:
El primer parámetro de playerXConfig a 0 o 1 dependiendo de la elección.
*/
- this.ghostbusterM.on('pointerdown', function (pointer){
- if (this.iter == 0) player1Config[0] = 0;
- if (this.iter == 1) player2Config[0] = 0;
- this.disableCharSelectMenu();
- this.showAbilitiesSelectMenu();
- }, this);
- this.ghostbusterM.on('pointerover', function (pointer) { this.ghostbusterM.setScale(0.9); }, this);
- this.ghostbusterM.on('pointerout', function (pointer) { this.ghostbusterM.setScale(0.7); }, this);
-
- this.ghostbusterW.on('pointerdown', function (pointer){
- if (this.iter == 0) player1Config[0] = 1;
- if (this.iter == 1) player2Config[0] = 1;
- this.disableCharSelectMenu();
- this.showAbilitiesSelectMenu();
- }, this);
- this.ghostbusterW.on('pointerover', function (pointer) { this.ghostbusterW.setScale(0.9); }, this);
- this.ghostbusterW.on('pointerout', function (pointer) { this.ghostbusterW.setScale(0.7); }, this);
-
- this.blueGhost.on('pointerdown', function (pointer){
- if (this.iter == 0) player1Config[0] = 2;
- if (this.iter == 1) player2Config[0] = 2;
- this.disableCharSelectMenu();
- this.showAbilitiesSelectMenu();
- }, this);
- this.blueGhost.on('pointerover', function (pointer) { this.blueGhost.setScale(1.1); }, this);
- this.blueGhost.on('pointerout', function (pointer) { this.blueGhost.setScale(0.9); }, this);
-
- this.redGhost.on('pointerdown', function (pointer){
- if (this.iter == 0) player1Config[0] = 3;
- if (this.iter == 1) player2Config[0] = 3;
- this.disableCharSelectMenu();
- this.showAbilitiesSelectMenu();
- }, this);
- this.redGhost.on('pointerover', function (pointer) { this.redGhost.setScale(1.1); }, this);
- this.redGhost.on('pointerout', function (pointer) { this.redGhost.setScale(0.9); }, this);
+
+
+ if(conectado)
+ {
+ if(playerj=1)
+ {
+ this.ghostbusterM.on('pointerdown', function (pointer){
+ player1Config[0] = 0;
+ this.disableCharSelectMenu();
+ this.showAbilitiesSelectMenu();
+ }, this);
+ this.ghostbusterM.on('pointerover', function (pointer) { this.ghostbusterM.setScale(0.9); }, this);
+ this.ghostbusterM.on('pointerout', function (pointer) { this.ghostbusterM.setScale(0.7); }, this);
+
+ this.ghostbusterW.on('pointerdown', function (pointer){
+ player1Config[0] = 1;
+ this.disableCharSelectMenu();
+ this.showAbilitiesSelectMenu();
+ }, this);
+ this.ghostbusterW.on('pointerover', function (pointer) { this.ghostbusterW.setScale(0.9); }, this);
+ this.ghostbusterW.on('pointerout', function (pointer) { this.ghostbusterW.setScale(0.7); }, this);
+
+ this.blueGhost.on('pointerdown', function (pointer){
+ player1Config[0] = 2;
+ this.disableCharSelectMenu();
+ this.showAbilitiesSelectMenu();
+ }, this);
+ this.blueGhost.on('pointerover', function (pointer) { this.blueGhost.setScale(1.1); }, this);
+ this.blueGhost.on('pointerout', function (pointer) { this.blueGhost.setScale(0.9); }, this);
+
+ this.redGhost.on('pointerdown', function (pointer){
+ player1Config[0] = 3;
+ this.disableCharSelectMenu();
+ this.showAbilitiesSelectMenu();
+ }, this);
+ this.redGhost.on('pointerover', function (pointer) { this.redGhost.setScale(1.1); }, this);
+ this.redGhost.on('pointerout', function (pointer) { this.redGhost.setScale(0.9); }, this);
+ }
+ else
+ {
+ this.ghostbusterM.on('pointerdown', function (pointer){
+ player2Config[0] = 0;
+ this.disableCharSelectMenu();
+ this.showAbilitiesSelectMenu();
+ }, this);
+ this.ghostbusterM.on('pointerover', function (pointer) { this.ghostbusterM.setScale(0.9); }, this);
+ this.ghostbusterM.on('pointerout', function (pointer) { this.ghostbusterM.setScale(0.7); }, this);
+
+ this.ghostbusterW.on('pointerdown', function (pointer){
+ player2Config[0] = 1;
+ this.disableCharSelectMenu();
+ this.showAbilitiesSelectMenu();
+ }, this);
+ this.ghostbusterW.on('pointerover', function (pointer) { this.ghostbusterW.setScale(0.9); }, this);
+ this.ghostbusterW.on('pointerout', function (pointer) { this.ghostbusterW.setScale(0.7); }, this);
+
+ this.blueGhost.on('pointerdown', function (pointer){
+ player2Config[0] = 2;
+ this.disableCharSelectMenu();
+ this.showAbilitiesSelectMenu();
+ }, this);
+ this.blueGhost.on('pointerover', function (pointer) { this.blueGhost.setScale(1.1); }, this);
+ this.blueGhost.on('pointerout', function (pointer) { this.blueGhost.setScale(0.9); }, this);
+
+ this.redGhost.on('pointerdown', function (pointer){
+ player2Config[0] = 3;
+ this.disableCharSelectMenu();
+ this.showAbilitiesSelectMenu();
+ }, this);
+ this.redGhost.on('pointerover', function (pointer) { this.redGhost.setScale(1.1); }, this);
+ this.redGhost.on('pointerout', function (pointer) { this.redGhost.setScale(0.9); }, this);
+ }
+ }
+ else
+ {
+ this.ghostbusterM.on('pointerdown', function (pointer){
+ if (this.iter == 0) player1Config[0] = 0;
+ if (this.iter == 1) player2Config[0] = 0;
+ this.disableCharSelectMenu();
+ this.showAbilitiesSelectMenu();
+ }, this);
+ this.ghostbusterM.on('pointerover', function (pointer) { this.ghostbusterM.setScale(0.9); }, this);
+ this.ghostbusterM.on('pointerout', function (pointer) { this.ghostbusterM.setScale(0.7); }, this);
+
+ this.ghostbusterW.on('pointerdown', function (pointer){
+ if (this.iter == 0) player1Config[0] = 1;
+
+ if (this.iter == 1) player2Config[0] = 1;
+ this.disableCharSelectMenu();
+ this.showAbilitiesSelectMenu();
+ }, this);
+ this.ghostbusterW.on('pointerover', function (pointer) { this.ghostbusterW.setScale(0.9); }, this);
+ this.ghostbusterW.on('pointerout', function (pointer) { this.ghostbusterW.setScale(0.7); }, this);
+
+ this.blueGhost.on('pointerdown', function (pointer){
+
+ if (this.iter == 0) player1Config[0] = 2;
+ if (this.iter == 1) player2Config[0] = 2;
+ this.disableCharSelectMenu();
+ this.showAbilitiesSelectMenu();
+ }, this);
+ this.blueGhost.on('pointerover', function (pointer) { this.blueGhost.setScale(1.1); }, this);
+ this.blueGhost.on('pointerout', function (pointer) { this.blueGhost.setScale(0.9); }, this);
+
+ this.redGhost.on('pointerdown', function (pointer){
+ if (this.iter == 0) player1Config[0] = 3;
+ if (this.iter == 1) player2Config[0] = 3;
+ this.disableCharSelectMenu();
+ this.showAbilitiesSelectMenu();
+ }, this);
+ this.redGhost.on('pointerover', function (pointer) { this.redGhost.setScale(1.1); }, this);
+ this.redGhost.on('pointerout', function (pointer) { this.redGhost.setScale(0.9); }, this);
+ }
//Son return to ___
this.returnChar = this.add.image(gameWidth*7/50, gameHeight*9/50, 'bt_return').setAlpha(0).setScale(0.7);
@@ -193,28 +271,60 @@ class SeleccionPJH extends Phaser.Scene {
}, this);
//Botón de continuar a la siguiente selección o de empezar juego
- this.ready.on('pointerdown', function (pointer){
+ this.ready.on('pointerdown', function (pointer)
+ {
//Sólo funciona si se han seleccionado 3 habilidades
if (this.abilitiesSelected == 3){
//Impide que este botón se pinte
this.abilitiesMenu = false;
//Actualizar las abilidades del jugador dependiendo de la iteración del menú
- if (this.iter == 0) {
- player1Config[1] = this.abilitiesIndex[0];
- player1Config[2] = this.abilitiesIndex[1];
- player1Config[3] = this.abilitiesIndex[2];
-
- if (conectado == true){
- msg = {
- code: "1",
- p: player1Config[0],
- h1: player1Config[1],
- h2: player1Config[2],
- h3: player1Config[3],
- sess: session
- }
- connection.send(JSON.stringify(msg));
-
+ if (this.iter == 0)
+ {
+ if(conectado)
+ {
+ if(playerj=1)
+ {
+ player1Config[1] = this.abilitiesIndex[0];
+ player1Config[2] = this.abilitiesIndex[1];
+ player1Config[3] = this.abilitiesIndex[2];
+
+
+ msg = {
+ code: "1",
+ p: player1Config[0],
+ h1: player1Config[1],
+ h2: player1Config[2],
+ h3: player1Config[3],
+ sess: session
+ }
+ connection.send(JSON.stringify(msg));
+ }
+ else
+ {
+ player2Config[1] = this.abilitiesIndex[0];
+ player2Config[2] = this.abilitiesIndex[1];
+ player2Config[3] = this.abilitiesIndex[2];
+
+ if (conectado){
+ msg = {
+ code: "1",
+ p: player2Config[0],
+ h1: player2Config[1],
+ h2: player2Config[2],
+ h3: player2Config[3],
+ sess: session
+ }
+ connection.send(JSON.stringify(msg));
+ }
+
+ }
+ }
+ else
+ {
+ player1Config[1] = this.abilitiesIndex[0];
+ player1Config[2] = this.abilitiesIndex[1];
+ player1Config[3] = this.abilitiesIndex[2];
+ }
}
//Si es la segunda iteración, comienza la partida. Si no vuelve al menú de selección de equipo (actualizando iter)
@@ -225,8 +335,12 @@ class SeleccionPJH extends Phaser.Scene {
this.scene.start('cutscene');
} else {
- this.iter++;
- this.showCharSelectMenu();
+ if(!conectado)
+ {
+ this.iter++;
+ this.showCharSelectMenu();
+ }
+
}
//Imprime por pantalla la configuración de cada jugador DEBUG
//console.log('P1 ' + player1Config);
@@ -236,7 +350,7 @@ class SeleccionPJH extends Phaser.Scene {
}
- }
+
}, this);
//Interfaz por encima de casi todo
@@ -351,8 +465,9 @@ class SeleccionPJH extends Phaser.Scene {
else if (this.abilitiesMenu == true && this.abilitiesSelected != 3) this.ready.setAlpha(0.4);
else this.ready.setAlpha(0);
- if (sincro == 2){
- cambiarescena();
+ if (sincro == 2)
+ {
+ this.cambiarescena();
}
}
}
diff --git a/Juego/target/classes/META-INF/MANIFEST.MF b/Juego/target/classes/META-INF/MANIFEST.MF
index af48a78..1f68447 100644
--- a/Juego/target/classes/META-INF/MANIFEST.MF
+++ b/Juego/target/classes/META-INF/MANIFEST.MF
@@ -1,11 +1,11 @@
Manifest-Version: 1.0
-Built-By: a.garciagar.2016
-Build-Jdk: 13.0.1
-Implementation-Title: rest_ejer1_con_ui
+Implementation-Title: rest
Implementation-Version: 0.0.1-SNAPSHOT
+Built-By: tomas
Implementation-Vendor-Id: es.urjc.code.juegosenred
-Implementation-Vendor: Pivotal Software, Inc.
-Implementation-URL: http://projects.spring.io/spring-boot/items-backend-
- and-frontend/
+Build-Jdk: 1.8.0_191
+Implementation-URL: http://projects.spring.io/spring-boot/items-backen
+ d-and-frontend/
Created-By: Maven Integration for Eclipse
+Implementation-Vendor: Pivotal Software, Inc.
diff --git a/Juego/target/classes/META-INF/maven/es.urjc.code.juegosenred/items-backend-and-frontend/pom.properties b/Juego/target/classes/META-INF/maven/es.urjc.code.juegosenred/items-backend-and-frontend/pom.properties
index eb78f06..d094d86 100644
--- a/Juego/target/classes/META-INF/maven/es.urjc.code.juegosenred/items-backend-and-frontend/pom.properties
+++ b/Juego/target/classes/META-INF/maven/es.urjc.code.juegosenred/items-backend-and-frontend/pom.properties
@@ -1,7 +1,7 @@
#Generated by Maven Integration for Eclipse
-#Wed Jan 15 23:35:44 CET 2020
-m2e.projectLocation=F\:\\URJC\\Tercero\\Juegos en Red\\Te acuerdas de\\JR-Grupo-H\\Juego
-m2e.projectName=JR-Grupo-H
+#Thu Jan 16 04:24:31 CET 2020
+version=0.0.1-SNAPSHOT
groupId=es.urjc.code.juegosenred
+m2e.projectName=JR-Grupo-H-Master
+m2e.projectLocation=C\:\\Users\\tomas\\Desktop\\Universidad\\JuegosEnRed\\JR-Grupo-H-master\\Juego
artifactId=items-backend-and-frontend
-version=0.0.1-SNAPSHOT
diff --git a/Juego/target/classes/META-INF/maven/es.urjc.code.juegosenred/items-backend-and-frontend/pom.xml b/Juego/target/classes/META-INF/maven/es.urjc.code.juegosenred/items-backend-and-frontend/pom.xml
index 003e686..7ea16d8 100644
--- a/Juego/target/classes/META-INF/maven/es.urjc.code.juegosenred/items-backend-and-frontend/pom.xml
+++ b/Juego/target/classes/META-INF/maven/es.urjc.code.juegosenred/items-backend-and-frontend/pom.xml
@@ -8,7 +8,7 @@
0.0.1-SNAPSHOT
jar
- rest_ejer1_con_ui
+ rest
Backend y frontend para el ejercicio de gesti�n de items
diff --git a/Juego/target/classes/es/urjc/code/juegosenred/WebsocketEchoHandler.class b/Juego/target/classes/es/urjc/code/juegosenred/WebsocketEchoHandler.class
index 24bc490..3290e03 100644
Binary files a/Juego/target/classes/es/urjc/code/juegosenred/WebsocketEchoHandler.class and b/Juego/target/classes/es/urjc/code/juegosenred/WebsocketEchoHandler.class differ
diff --git a/Juego/target/classes/static/cutsceneOnline.js b/Juego/target/classes/static/cutsceneOnline.js
index 22f0b35..1c7b2b1 100644
--- a/Juego/target/classes/static/cutsceneOnline.js
+++ b/Juego/target/classes/static/cutsceneOnline.js
@@ -58,7 +58,7 @@ class CutsceneOnline extends Phaser.Scene {
Las preguntas coinciden con el índice de answers que lleva su cuenta (actualizado en schedulePlaner())
*/
this.questions = ["¿Cuántos fantasmas azules pasaron?", "¿Cuántos fantasmas rojos pasaron?", "¿Cuántos cazafantasmas pasaron?", "¿Cuántos personajes pasaron en total?"];
- this.questionIndex = roundQuestions[round];
+ this.questionIndex = round;
this.answers = [0, 0, 0, 0];
//Timers para enseñar la pregunta y cambiar de escena.
@@ -89,11 +89,10 @@ class CutsceneOnline extends Phaser.Scene {
//Enseña la pregunta
showQuestion() {
- this.add.text(gameWidth*3/20, gameHeight/2, this.questions[this.questionIndex], { font: '64px Caveat Brush', fill: '#ffffff' });
- console.log(this.answers[this.questionIndex]);
+ this.add.text(gameWidth*3/20, gameHeight/2, roundQuestions[this.questionIndex], { font: '64px Caveat Brush', fill: '#ffffff' });
}
- //Cambia la escena y acutaliza el valor de la variable global round con la respuesta
+ //Cambia la escena y actualiza el valor de la variable global round con la respuesta
changeScene() {
answer = this.answers[this.questionIndex];
console.log(this.answers[this.questionIndex] + ' = ' + answer);
diff --git a/Juego/target/classes/static/login.js b/Juego/target/classes/static/login.js
index bed14b5..ab9a550 100644
--- a/Juego/target/classes/static/login.js
+++ b/Juego/target/classes/static/login.js
@@ -48,25 +48,11 @@ var p;
var h1;
var h2;
var h3;
-var ch1;
-var ch2;
-var ch3;
-var ch4;
-var ch5;
-var ch6;
-var ch7;
-var ch8;
-var ch9;
-var rQ1;
-var rQ2;
-var rQ3;
-var cT1;
-var cT2;
-var cT3;
-
-var characters;
-var correctTombstones;
-var roundQuestions;
+
+
+var characters = [9];
+var correctTombstones = [3];
+var roundQuestions = [3];
var ax;
var ay;
@@ -117,7 +103,7 @@ connection.onmessage = function(msg)
case 1:
{
//Generacion de la partida
- p = info.personaje;
+ p = info.p;
h1 = info.h1;
h2 = info.h2;
h3 = info.h3;
@@ -219,7 +205,6 @@ class Login extends Phaser.Scene
this.userCreatedText = this.add.text(gameWidth*(25/100), gameHeight*(30/80),"",{ font: '32px Courier', fill: '#00ff00'});
-
this.back.on('pointerdown', function (pointer){
nam.style.display = 'none';
pass.style.display = 'none';
@@ -321,7 +306,6 @@ class Login extends Phaser.Scene
this.showOnlineMenu();
loadchat = true;
}
-
if (registered == true) {
this.log.setText("");
this.reg.setText("");
@@ -347,6 +331,7 @@ class Login extends Phaser.Scene
if(backMenu)
{
this.fall.setText("El servidor se ha caido");
+
this.backMenuFuncTimer = this.time.addEvent({ delay: 4000, callback: this.backMenuFunc, loop: false, callbackScope: this});
}
if(match)
diff --git a/Juego/target/classes/static/menu.js b/Juego/target/classes/static/menu.js
index 8290a0d..8a28836 100644
--- a/Juego/target/classes/static/menu.js
+++ b/Juego/target/classes/static/menu.js
@@ -14,6 +14,7 @@ class Menu extends Phaser.Scene {
super({key:"menu"});
}
+
preload() {
}
@@ -85,6 +86,7 @@ class Menu extends Phaser.Scene {
this.disableTutorial1();
this.showMainMenu();
}, this);
+
//Interfaz por encima de casi todo
this.bg_estatica = this.add.sprite(gameWidth*11/20,gameHeight/2,'bg_estatica').setAlpha(0.05);
this.anims.create({
diff --git "a/Juego/target/classes/static/selecci\303\263nPJH.js" "b/Juego/target/classes/static/selecci\303\263nPJH.js"
index 2895e67..0e1d5aa 100644
--- "a/Juego/target/classes/static/selecci\303\263nPJH.js"
+++ "b/Juego/target/classes/static/selecci\303\263nPJH.js"
@@ -39,41 +39,119 @@ class SeleccionPJH extends Phaser.Scene {
Al pulsarse cada uno de los dos botones, dependiendo de la iteración de la configuración de partida se actualiza:
El primer parámetro de playerXConfig a 0 o 1 dependiendo de la elección.
*/
- this.ghostbusterM.on('pointerdown', function (pointer){
- if (this.iter == 0) player1Config[0] = 0;
- if (this.iter == 1) player2Config[0] = 0;
- this.disableCharSelectMenu();
- this.showAbilitiesSelectMenu();
- }, this);
- this.ghostbusterM.on('pointerover', function (pointer) { this.ghostbusterM.setScale(0.9); }, this);
- this.ghostbusterM.on('pointerout', function (pointer) { this.ghostbusterM.setScale(0.7); }, this);
-
- this.ghostbusterW.on('pointerdown', function (pointer){
- if (this.iter == 0) player1Config[0] = 1;
- if (this.iter == 1) player2Config[0] = 1;
- this.disableCharSelectMenu();
- this.showAbilitiesSelectMenu();
- }, this);
- this.ghostbusterW.on('pointerover', function (pointer) { this.ghostbusterW.setScale(0.9); }, this);
- this.ghostbusterW.on('pointerout', function (pointer) { this.ghostbusterW.setScale(0.7); }, this);
-
- this.blueGhost.on('pointerdown', function (pointer){
- if (this.iter == 0) player1Config[0] = 2;
- if (this.iter == 1) player2Config[0] = 2;
- this.disableCharSelectMenu();
- this.showAbilitiesSelectMenu();
- }, this);
- this.blueGhost.on('pointerover', function (pointer) { this.blueGhost.setScale(1.1); }, this);
- this.blueGhost.on('pointerout', function (pointer) { this.blueGhost.setScale(0.9); }, this);
-
- this.redGhost.on('pointerdown', function (pointer){
- if (this.iter == 0) player1Config[0] = 3;
- if (this.iter == 1) player2Config[0] = 3;
- this.disableCharSelectMenu();
- this.showAbilitiesSelectMenu();
- }, this);
- this.redGhost.on('pointerover', function (pointer) { this.redGhost.setScale(1.1); }, this);
- this.redGhost.on('pointerout', function (pointer) { this.redGhost.setScale(0.9); }, this);
+
+
+ if(conectado)
+ {
+ if(playerj=1)
+ {
+ this.ghostbusterM.on('pointerdown', function (pointer){
+ player1Config[0] = 0;
+ this.disableCharSelectMenu();
+ this.showAbilitiesSelectMenu();
+ }, this);
+ this.ghostbusterM.on('pointerover', function (pointer) { this.ghostbusterM.setScale(0.9); }, this);
+ this.ghostbusterM.on('pointerout', function (pointer) { this.ghostbusterM.setScale(0.7); }, this);
+
+ this.ghostbusterW.on('pointerdown', function (pointer){
+ player1Config[0] = 1;
+ this.disableCharSelectMenu();
+ this.showAbilitiesSelectMenu();
+ }, this);
+ this.ghostbusterW.on('pointerover', function (pointer) { this.ghostbusterW.setScale(0.9); }, this);
+ this.ghostbusterW.on('pointerout', function (pointer) { this.ghostbusterW.setScale(0.7); }, this);
+
+ this.blueGhost.on('pointerdown', function (pointer){
+ player1Config[0] = 2;
+ this.disableCharSelectMenu();
+ this.showAbilitiesSelectMenu();
+ }, this);
+ this.blueGhost.on('pointerover', function (pointer) { this.blueGhost.setScale(1.1); }, this);
+ this.blueGhost.on('pointerout', function (pointer) { this.blueGhost.setScale(0.9); }, this);
+
+ this.redGhost.on('pointerdown', function (pointer){
+ player1Config[0] = 3;
+ this.disableCharSelectMenu();
+ this.showAbilitiesSelectMenu();
+ }, this);
+ this.redGhost.on('pointerover', function (pointer) { this.redGhost.setScale(1.1); }, this);
+ this.redGhost.on('pointerout', function (pointer) { this.redGhost.setScale(0.9); }, this);
+ }
+ else
+ {
+ this.ghostbusterM.on('pointerdown', function (pointer){
+ player2Config[0] = 0;
+ this.disableCharSelectMenu();
+ this.showAbilitiesSelectMenu();
+ }, this);
+ this.ghostbusterM.on('pointerover', function (pointer) { this.ghostbusterM.setScale(0.9); }, this);
+ this.ghostbusterM.on('pointerout', function (pointer) { this.ghostbusterM.setScale(0.7); }, this);
+
+ this.ghostbusterW.on('pointerdown', function (pointer){
+ player2Config[0] = 1;
+ this.disableCharSelectMenu();
+ this.showAbilitiesSelectMenu();
+ }, this);
+ this.ghostbusterW.on('pointerover', function (pointer) { this.ghostbusterW.setScale(0.9); }, this);
+ this.ghostbusterW.on('pointerout', function (pointer) { this.ghostbusterW.setScale(0.7); }, this);
+
+ this.blueGhost.on('pointerdown', function (pointer){
+ player2Config[0] = 2;
+ this.disableCharSelectMenu();
+ this.showAbilitiesSelectMenu();
+ }, this);
+ this.blueGhost.on('pointerover', function (pointer) { this.blueGhost.setScale(1.1); }, this);
+ this.blueGhost.on('pointerout', function (pointer) { this.blueGhost.setScale(0.9); }, this);
+
+ this.redGhost.on('pointerdown', function (pointer){
+ player2Config[0] = 3;
+ this.disableCharSelectMenu();
+ this.showAbilitiesSelectMenu();
+ }, this);
+ this.redGhost.on('pointerover', function (pointer) { this.redGhost.setScale(1.1); }, this);
+ this.redGhost.on('pointerout', function (pointer) { this.redGhost.setScale(0.9); }, this);
+ }
+ }
+ else
+ {
+ this.ghostbusterM.on('pointerdown', function (pointer){
+ if (this.iter == 0) player1Config[0] = 0;
+ if (this.iter == 1) player2Config[0] = 0;
+ this.disableCharSelectMenu();
+ this.showAbilitiesSelectMenu();
+ }, this);
+ this.ghostbusterM.on('pointerover', function (pointer) { this.ghostbusterM.setScale(0.9); }, this);
+ this.ghostbusterM.on('pointerout', function (pointer) { this.ghostbusterM.setScale(0.7); }, this);
+
+ this.ghostbusterW.on('pointerdown', function (pointer){
+ if (this.iter == 0) player1Config[0] = 1;
+
+ if (this.iter == 1) player2Config[0] = 1;
+ this.disableCharSelectMenu();
+ this.showAbilitiesSelectMenu();
+ }, this);
+ this.ghostbusterW.on('pointerover', function (pointer) { this.ghostbusterW.setScale(0.9); }, this);
+ this.ghostbusterW.on('pointerout', function (pointer) { this.ghostbusterW.setScale(0.7); }, this);
+
+ this.blueGhost.on('pointerdown', function (pointer){
+
+ if (this.iter == 0) player1Config[0] = 2;
+ if (this.iter == 1) player2Config[0] = 2;
+ this.disableCharSelectMenu();
+ this.showAbilitiesSelectMenu();
+ }, this);
+ this.blueGhost.on('pointerover', function (pointer) { this.blueGhost.setScale(1.1); }, this);
+ this.blueGhost.on('pointerout', function (pointer) { this.blueGhost.setScale(0.9); }, this);
+
+ this.redGhost.on('pointerdown', function (pointer){
+ if (this.iter == 0) player1Config[0] = 3;
+ if (this.iter == 1) player2Config[0] = 3;
+ this.disableCharSelectMenu();
+ this.showAbilitiesSelectMenu();
+ }, this);
+ this.redGhost.on('pointerover', function (pointer) { this.redGhost.setScale(1.1); }, this);
+ this.redGhost.on('pointerout', function (pointer) { this.redGhost.setScale(0.9); }, this);
+ }
//Son return to ___
this.returnChar = this.add.image(gameWidth*7/50, gameHeight*9/50, 'bt_return').setAlpha(0).setScale(0.7);
@@ -193,28 +271,60 @@ class SeleccionPJH extends Phaser.Scene {
}, this);
//Botón de continuar a la siguiente selección o de empezar juego
- this.ready.on('pointerdown', function (pointer){
+ this.ready.on('pointerdown', function (pointer)
+ {
//Sólo funciona si se han seleccionado 3 habilidades
if (this.abilitiesSelected == 3){
//Impide que este botón se pinte
this.abilitiesMenu = false;
//Actualizar las abilidades del jugador dependiendo de la iteración del menú
- if (this.iter == 0) {
- player1Config[1] = this.abilitiesIndex[0];
- player1Config[2] = this.abilitiesIndex[1];
- player1Config[3] = this.abilitiesIndex[2];
-
- if (conectado == true){
- msg = {
- code: "1",
- p: player1Config[0],
- h1: player1Config[1],
- h2: player1Config[2],
- h3: player1Config[3],
- sess: session
- }
- connection.send(JSON.stringify(msg));
-
+ if (this.iter == 0)
+ {
+ if(conectado)
+ {
+ if(playerj=1)
+ {
+ player1Config[1] = this.abilitiesIndex[0];
+ player1Config[2] = this.abilitiesIndex[1];
+ player1Config[3] = this.abilitiesIndex[2];
+
+
+ msg = {
+ code: "1",
+ p: player1Config[0],
+ h1: player1Config[1],
+ h2: player1Config[2],
+ h3: player1Config[3],
+ sess: session
+ }
+ connection.send(JSON.stringify(msg));
+ }
+ else
+ {
+ player2Config[1] = this.abilitiesIndex[0];
+ player2Config[2] = this.abilitiesIndex[1];
+ player2Config[3] = this.abilitiesIndex[2];
+
+ if (conectado){
+ msg = {
+ code: "1",
+ p: player2Config[0],
+ h1: player2Config[1],
+ h2: player2Config[2],
+ h3: player2Config[3],
+ sess: session
+ }
+ connection.send(JSON.stringify(msg));
+ }
+
+ }
+ }
+ else
+ {
+ player1Config[1] = this.abilitiesIndex[0];
+ player1Config[2] = this.abilitiesIndex[1];
+ player1Config[3] = this.abilitiesIndex[2];
+ }
}
//Si es la segunda iteración, comienza la partida. Si no vuelve al menú de selección de equipo (actualizando iter)
@@ -225,8 +335,12 @@ class SeleccionPJH extends Phaser.Scene {
this.scene.start('cutscene');
} else {
- this.iter++;
- this.showCharSelectMenu();
+ if(!conectado)
+ {
+ this.iter++;
+ this.showCharSelectMenu();
+ }
+
}
//Imprime por pantalla la configuración de cada jugador DEBUG
//console.log('P1 ' + player1Config);
@@ -236,7 +350,7 @@ class SeleccionPJH extends Phaser.Scene {
}
- }
+
}, this);
//Interfaz por encima de casi todo
@@ -351,8 +465,9 @@ class SeleccionPJH extends Phaser.Scene {
else if (this.abilitiesMenu == true && this.abilitiesSelected != 3) this.ready.setAlpha(0.4);
else this.ready.setAlpha(0);
- if (sincro == 2){
- cambiarescena();
+ if (sincro == 2)
+ {
+ this.cambiarescena();
}
}
}