Fix: center message text color

This commit is contained in:
2019-01-09 22:26:52 +09:00
parent e3ea3eceb8
commit b8faa417d8
3 changed files with 79 additions and 19 deletions
+24 -17
View File
@@ -5,7 +5,7 @@ function CenterMessageText(contentText) {
Phaser.Text.call( Phaser.Text.call(
this, game, this, game,
game.world.width / 2, game.world.width / 2,
game.world.height / 2, // - CenterMessageText.MOVE_AMOUNT_PX, game.world.height / 2 - CenterMessageText.MOVE_AMOUNT_PX,
contentText, contentText,
CenterMessageText.DEFAULT_TEXT_FONT CenterMessageText.DEFAULT_TEXT_FONT
); );
@@ -14,34 +14,41 @@ function CenterMessageText(contentText) {
this.anchor.set(0.5); this.anchor.set(0.5);
this.inputEnabled = false; this.inputEnabled = false;
var grd = this.context.createLinearGradient(0, 0, 0, this.height); // var grd = this.context.createLinearGradient(0, 0, 0, this.height);
grd.addColorStop(0, "#FFFFFF"); // '#FFD68E'); // grd.addColorStop(0, CenterMessageText.COLOR_GRADATION_START); //'#FFD68E');
grd.addColorStop(1, "#FFD68E"); // '#B34C00'); // grd.addColorStop(1, CenterMessageText.COLOR_GRADATION_END); //'#B34C00');
this.fill = grd; // this.fill = grd;
this.fill = CenterMessageText.COLOR_TEXT;
// this.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2); // this.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
this.stroke = '#000'; this.stroke = CenterMessageText.COLOR_STROKE;
this.strokeThickness = 10; this.strokeThickness = 9;
this.alpha = 0; this.alpha = 1;
var tweenAlpha = game.add.tween(this); var tweenAlpha = game.add.tween(this);
tweenAlpha.to( { alpha: 1 }, CenterMessageText.TWEEN_ALPHA_TIME, Phaser.Easing.Linear.None, true); tweenAlpha.to( { alpha: 0 }, CenterMessageText.TWEEN_ALPHA_TIME, Phaser.Easing.Elastic.In, true);
tweenAlpha.onComplete.addOnce(this.destroy, this);
var tweenScale = game.add.tween(this.scale); // var tweenScale = game.add.tween(this.scale);
tweenScale.to( { x: 0.8, y: 0.8 }, CenterMessageText.TWEEN_SCALE_TIME, Phaser.Easing.Bounce.Out, true); // tweenScale.to( { x: 0.8, y: 0.8 }, CenterMessageText.TWEEN_SCALE_TIME, Phaser.Easing.Bounce.Out, true);
tweenScale.onComplete.addOnce(this.destroy, this); // tweenScale.onComplete.addOnce(this.destroy, this);
game.add.existing(this); game.add.existing(this);
}; };
CenterMessageText.DEFAULT_TEXT_FONT = { CenterMessageText.DEFAULT_TEXT_FONT = {
font: "bold 100px Arial", font: "bold 40px Arial", // "bold 100px Arial",
boundsAlignH: "center", // left, center. right boundsAlignH: "center", // left, center. right
boundsAlignV: "middle", // top, middle, bottom boundsAlignV: "middle", // top, middle, bottom
fill: "#fff" fill: CenterMessageText.COLOR_TEXT // "#fff"
}; };
CenterMessageText.MOVE_AMOUNT_PX = 200; CenterMessageText.MOVE_AMOUNT_PX = 100;
CenterMessageText.TWEEN_ALPHA_TIME = 1000; CenterMessageText.TWEEN_ALPHA_TIME = 1500;
CenterMessageText.TWEEN_SCALE_TIME = 1500; CenterMessageText.TWEEN_SCALE_TIME = 1500;
CenterMessageText.COLOR_TEXT = "#ffcc00"; // "#cc9900";
CenterMessageText.COLOR_GRADATION_START = "#B34C00"; // "#333333"; //"#666666";
CenterMessageText.COLOR_GRADATION_END = "#333333"; // "#B34C00";
CenterMessageText.COLOR_STROKE = "#663300"; //"#FFDD88"; //"#FFD68E";
+9 -2
View File
@@ -94,6 +94,7 @@ var WordFlyingSaucer = {
// this.startGame(); // this.startGame();
this.showLevelUpText();
}, },
@@ -152,7 +153,13 @@ var WordFlyingSaucer = {
} }
var GROUND_OFFSET_Y = 600; var GROUND_OFFSET_Y = 600;
this.tileSprite = game.add.tileSprite(-50, GROUND_OFFSET_Y, GAME_SCREEN_SIZE.x + 50, GROUND_OFFSET_Y + 150, "tile_choco"); // this.tileSprite = game.add.tileSprite(50, GROUND_OFFSET_Y, GAME_SCREEN_SIZE.x + 50, GROUND_OFFSET_Y + 150, "tile_choco");
// this.tileSprite = game.add.tileSprite(300, 300, 100, 100, "tile_choco");
this.tileSprite = game.add.tileSprite(
GAME_SCREEN_SIZE.x, GAME_SCREEN_SIZE.y,
GAME_SCREEN_SIZE.x, 200,
"tile_choco");
this.tileSprite.anchor.set(0.5);
this.tileSprite.tileScale.set(2); this.tileSprite.tileScale.set(2);
}, },
@@ -221,7 +228,7 @@ var WordFlyingSaucer = {
if(this.centerMessageText) if(this.centerMessageText)
// this.centerMessageText.text = ""; // this.centerMessageText.text = "";
this.centerMessageText.destroy(); this.centerMessageText.destroy();
this.centerMessageText = new CenterMessageText("단어 난이도 상승!"); this.centerMessageText = new CenterMessageText("[ " + this.gameLevelManager.getWordLevelText() + " ] 단계 활성화");
}, },
} }
@@ -15,6 +15,52 @@ GameLevelManager.prototype.getWordLevel = function() {
return randomLevel; return randomLevel;
} }
GameLevelManager.prototype.getWordLevelText = function() {
var wordLevelText = "";
switch(this.wordLevel) {
case 0:
if(isKoreanTypingApp()) wordLevelText = "기본자리";
else wordLevelText = "Basic";
break;
case 1:
if(isKoreanTypingApp()) wordLevelText = "왼손 윗글쇠";
else wordLevelText = "Left upper";
break;
case 2:
if(isKoreanTypingApp()) wordLevelText = "오른손 윗글쇠";
else wordLevelText = "Right upper";
break;
case 3:
if(isKoreanTypingApp()) wordLevelText = "검지 글쇠";
else wordLevelText = "Second finger";
break;
case 4:
if(isKoreanTypingApp()) wordLevelText = "왼손 밑글쇠";
else wordLevelText = "Left lower";
break;
case 5:
if(isKoreanTypingApp()) wordLevelText = "오른손 밑글쇠";
else wordLevelText = "Right lower";
break;
case 6:
if(isKoreanTypingApp()) wordLevelText = "왼손 쌍자음";
else wordLevelText = "";
break;
case 7:
if(isKoreanTypingApp()) wordLevelText = "오른손 쌍자음";
else wordLevelText = "";
break;
}
return wordLevelText;
}
GameLevelManager.prototype.getDifficultyForLevel = function(wordLevel) { GameLevelManager.prototype.getDifficultyForLevel = function(wordLevel) {
return this.difficultyForLevelList[wordLevel]; return this.difficultyForLevelList[wordLevel];
} }