-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ordenador [WIP] y cambios en los dialogos
- Se han hecho cambios en los diálogos para que pueda haber más personajes sin retratos aparte del jugador - Se ha añadido a la listview dos métodos: setVisible y añadir elementos al principio - Avances en el ordenador: transiciones entre todas las pantallas y pantalla de solicitudes de amistad terminada
- Loading branch information
Showing
30 changed files
with
966 additions
and
539 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"root1": { | ||
"type": "text", | ||
"character": "computer", | ||
"next": "decision" | ||
}, | ||
"decision": { | ||
"type": "choice", | ||
"choices":[ | ||
{ "next": "accessComputer" }, | ||
{} | ||
] | ||
}, | ||
"accessComputer": { | ||
"type": "event", | ||
"events": [ | ||
{ "switchToComputer": { } } | ||
] | ||
}, | ||
"root2": { | ||
"type": "text", | ||
"character": "player" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"root1": { | ||
"text": "Do you want to turn the computer on?" | ||
}, | ||
"decision": [ | ||
{ | ||
"text": "Yes" | ||
}, | ||
{ | ||
"text": "No" | ||
} | ||
], | ||
"root2": { | ||
"text": "I don't have any new photo to upload" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
{ | ||
"mom": "Mom", | ||
"dad": "Dad", | ||
"player": "You" | ||
"player": "You", | ||
"computer": "Computer", | ||
"Maria": "Mary", | ||
"Alex": "Alex", | ||
"Alison": "Alison", | ||
"Guille": "William" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"root1": { | ||
"text": "¿Quieres encender el ordenador?" | ||
}, | ||
"decision": [ | ||
{ | ||
"text": "Si" | ||
}, | ||
{ | ||
"text": "No" | ||
} | ||
], | ||
"root2": { | ||
"text": "No tengo ninguna nueva foto que subir" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
{ | ||
"mom": "Mamá", | ||
"dad": "Papá", | ||
"player": "Tú" | ||
"player": "Tú", | ||
"computer": "Ordenador", | ||
"Maria": "María", | ||
"Alex": "Alex", | ||
"Alison": "Alison", | ||
"Guille": "Guille" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
import Button from '../button.js'; | ||
import GameManager from '../../managers/gameManager.js'; | ||
import LoginScreen from './loginScreen.js' | ||
import SocialNetworkScreen from './socialNetworkScreen.js' | ||
|
||
export default class ComputerScene extends Phaser.Scene { | ||
/** | ||
* Ordenador que se usa dentro del juego para consultar la red social | ||
* Nota: esta escena existe durante todo el juego, aunque se va durmiendo y despertando | ||
* en funcion de si se necesita usar o no | ||
* @extends Phaser.Scene | ||
*/ | ||
constructor() { | ||
super({ key: 'ComputerScene' }); | ||
} | ||
|
||
create() { | ||
this.CANVAS_WIDTH = this.sys.game.canvas.width; | ||
this.CANVAS_HEIGHT = this.sys.game.canvas.height; | ||
|
||
this.gameManager = GameManager.getInstance(); | ||
|
||
// Mesa | ||
let bg = this.add.image(this.CANVAS_WIDTH / 2, this.CANVAS_HEIGHT / 2, 'basePC'); | ||
let scale = this.CANVAS_WIDTH / bg.width; | ||
bg.setScale(scale); | ||
|
||
// Color base del fondo de pantalla del ordenador | ||
this.add.rectangle(this.CANVAS_WIDTH / 2, 0, this.CANVAS_WIDTH, this.CANVAS_HEIGHT / 1.2, 0x000000).setOrigin(0.5, 0); | ||
|
||
// Se crean en este punto para que las pantallas esten por encima del fondo del ordenador, | ||
// pero por debajo del marco | ||
this.socialNetScreen = new SocialNetworkScreen(this); | ||
this.socialNetScreen.setVisible(false); | ||
this.loginScreen = new LoginScreen(this); | ||
|
||
// Boton de apagar de la esquina inferior izquierda | ||
this.powerOffButton = new Button(this, 103.5, this.CANVAS_HEIGHT - 197, 0.31, | ||
() => { | ||
this.gameManager.leaveComputer(); | ||
}, | ||
'powerOff', { R: 255, G: 255, B: 255 }, { R: 200, G: 200, B: 200 }, { R: 150, G: 150, B: 150 } | ||
); | ||
|
||
// Boton de cerrar el ordenador de la esquina superior derecha | ||
this.closeButton = new Button(this, this.CANVAS_WIDTH - 99, 54, 0.82, | ||
() => { | ||
this.gameManager.leaveComputer(); | ||
}, | ||
'closerBrowser', { R: 255, G: 255, B: 255 }, { R: 200, G: 200, B: 200 }, { R: 150, G: 150, B: 150 }, | ||
); | ||
// El boton de cerrar esta formado por tres botones | ||
// Se calcula el tam de uno (cruz) para que el area de colision sea el adecuado | ||
let oneButtonWidth = this.closeButton.fillImg.displayWidth / 3; | ||
this.closeButton.setHitArea({ | ||
area: new Phaser.Geom.Rectangle(2 * oneButtonWidth, 0, oneButtonWidth, this.closeButton.fillImg.displayHeight), | ||
callback: Phaser.Geom.Rectangle.Contains | ||
}) | ||
|
||
// Pantalla del ordenador con el tam del canvas | ||
let screen = this.add.image(this.CANVAS_WIDTH / 2, this.CANVAS_HEIGHT / 2, 'PCscreen'); | ||
screen.setDisplaySize(this.CANVAS_WIDTH, this.CANVAS_HEIGHT); | ||
|
||
// Posit con el usuario y contrasena del jugador | ||
let postitCont = this.add.container(1.3 * this.CANVAS_WIDTH / 4, this.CANVAS_HEIGHT - 100); | ||
let postitBg = this.add.image(0, 0, 'postit'); | ||
postitCont.add(postitBg); | ||
|
||
let userInfo = this.gameManager.getUserInfo(); | ||
|
||
let postitTextInfoStyle = { ...this.gameManager.textConfig }; | ||
postitTextInfoStyle.fontFamily = 'dadha'; | ||
postitTextInfoStyle.fontSize = '60px'; | ||
postitTextInfoStyle.color = '#323232'; | ||
|
||
let postitTextStyle = postitTextInfoStyle; | ||
postitTextStyle.fontSize = '52px'; | ||
|
||
let postitTextsPos = { | ||
x: 180, | ||
offsetX: 15, | ||
firstTextY: -65, | ||
secondTextY: 95, | ||
offsetY: 75 | ||
} | ||
let yourUserText = this.add.text(-postitTextsPos.x, postitTextsPos.firstTextY, "Tu usuario", postitTextInfoStyle); | ||
yourUserText.setOrigin(0, 0.5); | ||
postitCont.add(yourUserText); | ||
|
||
let userText = this.add.text(postitTextsPos.x + postitTextsPos.offsetX, | ||
postitTextsPos.firstTextY + postitTextsPos.offsetY, userInfo.username, postitTextStyle); | ||
userText.setOrigin(1, 0.5); | ||
postitCont.add(userText); | ||
|
||
let yourPasswordText = this.add.text(-postitTextsPos.x, | ||
postitTextsPos.secondTextY, "Tu contraseña", postitTextInfoStyle); | ||
yourPasswordText.setOrigin(0, 0.5); | ||
postitCont.add(yourPasswordText); | ||
|
||
let passwordText = this.add.text(postitTextsPos.x + postitTextsPos.offsetX, | ||
postitTextsPos.secondTextY + postitTextsPos.offsetY, userInfo.password, postitTextStyle); | ||
passwordText.setOrigin(1, 0.5); | ||
postitCont.add(passwordText); | ||
|
||
postitCont.setScale(0.37); | ||
} | ||
|
||
/** | ||
* Iniciar el ordenador | ||
* Nota: se llama justo antes de realizar el cambio a esta escena | ||
*/ | ||
start() { | ||
// Se resetean los colores de los botones al por defecto porque si se sale del ordenador | ||
// y luego se vuelve entrar, como los tweens de cambio de color al pasar el raton por encima | ||
// estaban activados, se sigue manteniendo ese color | ||
this.powerOffButton.reset(); | ||
this.closeButton.reset(); | ||
// Se inicia la pantalla de login | ||
this.socialNetScreen.setVisible(false); | ||
this.loginScreen.start(); | ||
//this.loginScreen.setVisible(false); | ||
//this.socialNetScreen.start(); | ||
} | ||
|
||
logIntoSocialNet() { | ||
this.loginScreen.setVisible(false); | ||
this.socialNetScreen.start(); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.