39 lines
1.0 KiB
JavaScript
39 lines
1.0 KiB
JavaScript
WelcomePlayerText.prototype = Object.create(Phaser.Text.prototype);
|
|
WelcomePlayerText.constructor = WelcomePlayerText;
|
|
|
|
function WelcomePlayerText(playerName) {
|
|
Phaser.Text.call(
|
|
this, game,
|
|
game.world.width / 2, game.world.height / 2 - 40,
|
|
"어서오세요, " + playerName + "님",
|
|
WelcomePlayerText.DEFAULT_TEXT_FONT
|
|
);
|
|
|
|
this.anchor.set(0.5);
|
|
this.inputEnabled = false;
|
|
|
|
var grd = this.context.createLinearGradient(0, 0, 0, this.height);
|
|
grd.addColorStop(0, '#8ED6FF');
|
|
grd.addColorStop(1, '#4C6CB3');
|
|
this.fill = grd;
|
|
this.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
|
this.stroke = '#000';
|
|
this.strokeThickness = 5;
|
|
|
|
this.alpha = 1;
|
|
var tweenAlpha = game.add.tween(this);
|
|
tweenAlpha.to( { alpha: 0 }, Phaser.Timer.SECOND * 2, Phaser.Easing.Back.In, true);
|
|
|
|
game.add.existing(this);
|
|
}
|
|
|
|
WelcomePlayerText.prototype.destroySelf = function() {
|
|
this.destroy();
|
|
}
|
|
|
|
WelcomePlayerText.DEFAULT_TEXT_FONT = {
|
|
font: "60px Arial",
|
|
boundsAlignH: "center", // left, center. right
|
|
boundsAlignV: "middle", // top, middle, bottom
|
|
fill: "#fff"
|
|
} |