Add: login home button, menu welcome message

* Add: home button in login

* Fix: animal typingCount

* Add: Welcome player text in login
This commit is contained in:
2018-08-29 07:41:35 +09:00
parent c7fe3bf4e5
commit 0d1ada9a4e
6 changed files with 79 additions and 22 deletions
+24 -22
View File
@@ -9,20 +9,22 @@ class Animal {
}
animalLevelIDByRecord(record) {
if(sessionStorageManager.playingAppID <= 20) { // practice
for(let i = 0; i < Animal.SPECIES_DATA.length - 1; i++) {
if(record < Animal.SPECIES_DATA[i].practiceTypingCount)
return i;
}
} else { // test
for(let i = 0; i < Animal.SPECIES_DATA.length - 1; i++) {
if(record < Animal.SPECIES_DATA[i].testTypingCount)
return i;
}
console.log(record);
for(let i = Animal.SPECIES_DATA.length - 1; i > 0; i--) {
console.log(i);
console.log(this.typingCount(Animal.SPECIES_DATA[i]));
if(record >= this.typingCount(Animal.SPECIES_DATA[i]))
return i;
}
return Animal.SPECIES_DATA.length - 1;
return 0;
}
typingCount(speciesData) {
if(sessionStorageManager.playingAppID <= 20)
return speciesData.practiceTypingCount;
else
return speciesData.testTypingCount;
}
loadSpriteNames() {
@@ -112,16 +114,16 @@ Animal.ANIMATION_TYPE_DAMAGE = 1;
Animal.SPECIES_DATA = [
{ "species" : "snail", "runningFPS" : 1.1, "practiceTypingCount" : 5, "testTypingCount" : 10 },
{ "species" : "turtle", "runningFPS" : 5.5, "practiceTypingCount" : 10, "testTypingCount" : 20 },
{ "species" : "cat", "runningFPS" : 10.1, "practiceTypingCount" : 20, "testTypingCount" : 30 },
{ "species" : "lion", "runningFPS" : 15.5, "practiceTypingCount" : 30, "testTypingCount" : 50 },
{ "species" : "rabbit", "runningFPS" : 20.2, "practiceTypingCount" : 40, "testTypingCount" : 100 },
{ "species" : "ostrich", "runningFPS" : 25.5, "practiceTypingCount" : 50, "testTypingCount" : 200 },
{ "species" : "horse", "runningFPS" : 30.3, "practiceTypingCount" : 60, "testTypingCount" : 300 },
{ "species" : "dog", "runningFPS" : 35.5, "practiceTypingCount" : 70, "testTypingCount" : 400 },
{ "species" : "cheetah", "runningFPS" : 40.4, "practiceTypingCount" : 80, "testTypingCount" : 500 },
{ "species" : "eagle", "runningFPS" : 45.5, "practiceTypingCount" : 1000, "testTypingCount" : 1000 }
{ "species" : "snail", "runningFPS" : 1.1, "practiceTypingCount" : 0, "testTypingCount" : 0 },
{ "species" : "turtle", "runningFPS" : 5.5, "practiceTypingCount" : 5, "testTypingCount" : 20 },
{ "species" : "cat", "runningFPS" : 10.1, "practiceTypingCount" : 10, "testTypingCount" : 50 },
{ "species" : "lion", "runningFPS" : 15.5, "practiceTypingCount" : 15, "testTypingCount" : 100 },
{ "species" : "rabbit", "runningFPS" : 20.2, "practiceTypingCount" : 20, "testTypingCount" : 200 },
{ "species" : "ostrich", "runningFPS" : 25.5, "practiceTypingCount" : 30, "testTypingCount" : 300 },
{ "species" : "horse", "runningFPS" : 30.3, "practiceTypingCount" : 40, "testTypingCount" : 400 },
{ "species" : "dog", "runningFPS" : 35.5, "practiceTypingCount" : 50, "testTypingCount" : 500 },
{ "species" : "cheetah", "runningFPS" : 40.4, "practiceTypingCount" : 60, "testTypingCount" : 600 },
{ "species" : "eagle", "runningFPS" : 45.5, "practiceTypingCount" : 80, "testTypingCount" : 700 }
];
Animal.SPRITE_NAMES = {
+5
View File
@@ -15,6 +15,11 @@ class Login {
this.game.stage.backgroundColor = '#4d4d4d';
this.textStyle = { font: "bold 32px Arial", fill: "#fff", align: "right", boundsAlignH: "right", boundsAlignV: "middle" };
let backButton = new BackButton( () => {
sessionStorageManager.clear();
location.href = '../../web/main/index.html';
});
let fullscreenButton = new FullscreenButton(this.game);
let textX = this.game.world.centerX - 320;
+3
View File
@@ -17,6 +17,9 @@ class MenuApp {
sessionStorageManager.clear();
location.href = '../../web/client/login.html';
});
new WelcomePlayerText(sessionStorageManager.playerName);
let fullscreenButton = new FullscreenButton(this.game);
+45
View File
@@ -0,0 +1,45 @@
class WelcomePlayerText extends Phaser.Text {
constructor(playerName) {
super(game, game.world.width / 2, WelcomePlayerText.FONT_HEIGHT_PX, "어서오세요, " + 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;
let tweenAlpha = game.add.tween(this);
tweenAlpha.from( { alpha: 0 } ).to( { alpha: 100 }, 1000, Phaser.Easing.Linear.None, true);
/*
let tweenAlpha = game.add.tween(this);
tweenAlpha.to( { alpha: 0 }, 1000, Phaser.Easing.Linear.None, true);
let tweenMoveUp = game.add.tween(this);
tweenMoveUp.to( { y: this.y - WelcomePlayerText.MOVE_UP_AMOUNT_PX }, 1000, Phaser.Easing.Linear.None, true);
tweenMoveUp.onComplete.addOnce(this.destroySelf, this);
*/
game.add.existing(this);
};
destroySelf() {
this.destroy();
}
}
WelcomePlayerText.DEFAULT_TEXT_FONT = {
font: "40px Arial",
boundsAlignH: "center", // left, center. right
boundsAlignV: "middle", // top, middle, bottom
fill: "#fff"
};
WelcomePlayerText.FONT_HEIGHT_PX = 35;
+1
View File
@@ -16,6 +16,7 @@
<!-- library source files -->
<script src="../../game/lib/input_type_text.js"></script>
<script src="../../game/lib/round_rect_button.js"></script>
<script src="../../game/lib/back_button.js"></script>
<script src="../../game/lib/fullscreen_button.js"></script>
<script src="../../game/lib/db_connect_manager.js"></script>
+1
View File
@@ -26,6 +26,7 @@
<!-- source files -->
<script src="../../game/menu/menu_app.js"></script>
<script src="../../game/menu/main_menu_app.js"></script>
<script src="../../game/menu/welcome_player_text.js"></script>
<style>