12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- 'use strict';
- import {GameDeckMode} from '../../common/utils/const/game-deck-mode-enum';
- import { PhaserScene } from '../../common/utils/const/phaser-scene-enum';
- import Phaser from 'phaser';
- import * as Utils from '../../common/utils/prompt-renderer';
- export default class MainMenuScene extends Phaser.Scene {
- constructor(menuEventListener) {
- super({ key: PhaserScene.MAIN_MENU, active: false });
- this.menuEventListener = menuEventListener;
- }
- preload() {
- console.log('Preload');
- this.load.image('game-cover', '../../assets/twelveHeroes_cover.png');
- }
- create() {
- console.log('create');
- let logo = this.add.image(0,0,'game-cover');
- logo.setOrigin(0,0);
- //this.add.dom
- // TODO : Display main menu
- // Create new scenes : Local player room / Multi player room
- // Pass to them the event listener
- // On local player room, user can enter player names, selected color, game deck mode & rules
- // FOR TESTING
- this.fakeNewPnpGameSelected();
- }
- update() {
- }
- fakeNewPnpGameSelected() {
- setTimeout(() => {
- let pBlueName = prompt("Player blue name : ");
- let pRedName = prompt("Player red name : ");
- let gameDeckModeOptions = Object.values(GameDeckMode);
- let gameDeckMode = Utils.promptSelectAmongOptions("Select Deck Mode", gameDeckModeOptions);
- let advancedRules = [];
- console.log("Calling listener");
- this.menuEventListener.onNewPnpGame(pBlueName, pRedName, gameDeckMode, advancedRules);
- }, 1000);
- }
- }
|