|
@@ -1,27 +1,48 @@
|
|
'use strict';
|
|
'use strict';
|
|
import { PhaserScene } from '../../utils/const/phaser-scene-enum';
|
|
import { PhaserScene } from '../../utils/const/phaser-scene-enum';
|
|
|
|
+import Phaser from 'phaser';
|
|
|
|
+import GameMasterPassnplay from '../game-master-passnplay';
|
|
|
|
|
|
-function addCard(x, y, game, heroName, heroCost, heroPower, heroDesc) {
|
|
+
|
|
- let textStyle = {
|
|
|
|
- font: "normal 12px Arial",
|
|
|
|
- fill: '#000000',
|
|
|
|
- align: 'center',
|
|
|
|
- boundsAlignH: "center",
|
|
|
|
- boundsAlignV: "middle"
|
|
|
|
- };
|
|
|
|
- let graphics = game.add.graphics(0, 0);
|
|
|
|
- let color = 0x654321;
|
|
|
|
- let thickness = 2;
|
|
|
|
- let alpha = 1;
|
|
|
|
|
|
|
|
- graphics.lineStyle(thickness, color, alpha);
|
|
+
|
|
- graphics.strokeRect(0, 0, 80, 120);
|
|
+
|
|
- let text = `${heroName}\ncost : ${heroCost}\npower : ${heroPower}`;
|
|
+
|
|
- let label = game.add.text(3, 3, text, textStyle);
|
|
+
|
|
- label.setOrigin(0, 0);
|
|
+
|
|
- let container = game.add.container(x, y, [graphics, label]).setSize(5, 5);
|
|
+
|
|
-
|
|
+
|
|
-}
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
export default class World extends Phaser.Scene {
|
|
export default class World extends Phaser.Scene {
|
|
|
|
|
|
@@ -30,9 +51,11 @@ export default class World extends Phaser.Scene {
|
|
console.log('constructor');
|
|
console.log('constructor');
|
|
}
|
|
}
|
|
|
|
|
|
- init(data){
|
|
+ init(gameParams){
|
|
- console.log('Init');
|
|
+ console.log('Init', gameParams);
|
|
- this.heroesSet = data.heroesSet;
|
|
+ this.gameParams = gameParams;
|
|
|
|
+ this.GameMasterPassnplay = new GameMasterPassnplay(gameParams);
|
|
|
|
+
|
|
}
|
|
}
|
|
preload() {
|
|
preload() {
|
|
console.log('Preload');
|
|
console.log('Preload');
|
|
@@ -41,23 +64,7 @@ export default class World extends Phaser.Scene {
|
|
|
|
|
|
create() {
|
|
create() {
|
|
console.log('create');
|
|
console.log('create');
|
|
- let i = 0;
|
|
+
|
|
- let j = 0;
|
|
|
|
- this.heroesSet.forEach(hero => {
|
|
|
|
- let x = 10 + (i * 80) + 5;
|
|
|
|
- let y = 10 + (j * 120) + 5;
|
|
|
|
- addCard(x, y, this, hero.name, hero.cost, hero.power, hero.ability.description);
|
|
|
|
- if (x >= 1040) {
|
|
|
|
- i = 0;
|
|
|
|
- j++;
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- i++;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
update() {
|
|
update() {
|