2020-05-23 15:43:26 +02:00
|
|
|
import {TextField} from "../Components/TextField";
|
|
|
|
import Image = Phaser.GameObjects.Image;
|
2020-05-23 16:13:37 +02:00
|
|
|
import Sprite = Phaser.GameObjects.Sprite;
|
2020-05-23 15:43:26 +02:00
|
|
|
|
|
|
|
export const ReconnectingSceneName = "ReconnectingScene";
|
|
|
|
enum ReconnectingTextures {
|
|
|
|
icon = "icon",
|
|
|
|
mainFont = "main_font"
|
|
|
|
}
|
|
|
|
|
|
|
|
export class ReconnectingScene extends Phaser.Scene {
|
|
|
|
private reconnectingField: TextField;
|
|
|
|
private logo: Image;
|
2020-05-23 16:13:37 +02:00
|
|
|
private cat: Sprite;
|
2020-05-23 15:43:26 +02:00
|
|
|
|
|
|
|
constructor() {
|
|
|
|
super({
|
|
|
|
key: ReconnectingSceneName
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
preload() {
|
|
|
|
this.load.image(ReconnectingTextures.icon, "resources/logos/tcm_full.png");
|
|
|
|
// Note: arcade.png from the Phaser 3 examples at: https://github.com/photonstorm/phaser3-examples/tree/master/public/assets/fonts/bitmap
|
|
|
|
this.load.bitmapFont(ReconnectingTextures.mainFont, 'resources/fonts/arcade.png', 'resources/fonts/arcade.xml');
|
2020-05-23 16:13:37 +02:00
|
|
|
this.load.spritesheet(
|
|
|
|
'cat',
|
|
|
|
'resources/characters/pipoya/Cat 01-1.png',
|
|
|
|
{frameWidth: 32, frameHeight: 32}
|
|
|
|
);
|
2020-05-23 15:43:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
create() {
|
|
|
|
this.logo = new Image(this, this.game.renderer.width - 30, this.game.renderer.height - 20, ReconnectingTextures.icon);
|
|
|
|
this.add.existing(this.logo);
|
|
|
|
|
2020-05-23 16:13:37 +02:00
|
|
|
this.reconnectingField = new TextField(this, this.game.renderer.width / 2, this.game.renderer.height / 2, "Connection lost. Reconnecting...");
|
|
|
|
this.reconnectingField.setOrigin(0.5, 0.5).setCenterAlign();
|
|
|
|
|
2020-06-09 23:13:26 +02:00
|
|
|
const cat = this.physics.add.sprite(this.game.renderer.width / 2, this.game.renderer.height / 2 - 32, 'cat');
|
2020-05-23 16:13:37 +02:00
|
|
|
this.anims.create({
|
|
|
|
key: 'right',
|
|
|
|
frames: this.anims.generateFrameNumbers('cat', { start: 6, end: 8 }),
|
|
|
|
frameRate: 10,
|
|
|
|
repeat: -1
|
|
|
|
});
|
|
|
|
cat.play('right');
|
|
|
|
|
2020-05-23 15:43:26 +02:00
|
|
|
}
|
|
|
|
}
|