IPv6Penguin/src/Scenes/HighScoreScene.js

80 lines
2.4 KiB
JavaScript

import 'phaser';
// import Phaser from '../phaser.min';
import config from '../Config/config';
export default class HighScoreScene extends Phaser.Scene {
constructor () {
super('HighScore');
}
create () {
console.log('_________________SCENE CREATED : HighScore');
this.model = this.sys.game.globals.model;
console.log( this.model );
this.click1 = this.sound.add('click1', { volume: 1, loop: false });
this.click2 = this.sound.add('click2', { volume: 1, loop: false });
var background = this.add.sprite(config.width/2, config.height/2, 'bg');
this.add.sprite(config.width/2, config.height/2, 'blankBG').setDisplaySize(900,680).setAlpha(.25);
this.titleText = this.add.text(config.width/2, 70, "High Scores", {
font: "78px font1",
wordWrap: { width: 520, useAdvancedWrap: true },
color: '#4ADBFF',
align: 'center'
}).setOrigin(.5);
this.titleText.setStroke('#ffffff', 6);
this.titleText.setShadow(2, 2, "#00B0DC", 2, true, true);
this.add.text(config.width/2, config.height/2 - 150, "Rank\t-\tName\t-\tScore", {
font: "58px font1",
wordWrap: { width: 820, useAdvancedWrap: true },
color: '#00B0DC',
align: 'center'
}).setOrigin(.5).setStroke('#ffffff', 6);
this.add.text(config.width/2, config.height/2 - 100, "1\t-\tMr. ABC\t-\tXYZ \n2\t-\tMr. ABC\t-\tXYZ \n3\t-\tMr. ABC\t-\tXYZ \n4\t-\tMr. ABC\t-\tXYZ \n5\t-\tMr. ABC\t-\tXYZ \n6\t-\tMr. ABC\t-\tXYZ \n", {
font: "48px font1",
wordWrap: { width: 820, useAdvancedWrap: true },
color: '#00B0DC',
align: 'center'
}).setOrigin(.5,0).setStroke('#ffffff', 6);
this.btnBack = this.add.sprite( 50, 100 - 50 , 'btnBack').setScale(0.23).setData('normalSize',0.23).setData('hoverSize',0.28).setData('action',"").setInteractive();
this.btnBack.on('pointerdown', function () {
if(this.model.soundOn) this.click2.play();
this.scene.start('Title');
}.bind(this));
this.input.on('gameobjectover', function (pointer, gameObject) {
gameObject.setScale(gameObject.getData('hoverSize'));
if(this.model.soundOn) this.click1.play();
}.bind(this));
this.input.on('gameobjectout', function (pointer, gameObject) {
gameObject.setScale(gameObject.getData('normalSize'));
// gameObject.setScale(0.5);
});
this.input.on('gameobjectdown', function (pointer, gameObject) {
// gameObject.setScale(0.5);
});
}
}