Add: animal icon for typing app button
This commit is contained in:
@@ -47,14 +47,14 @@ class Animal {
|
||||
tweenAnimation(animationType) {
|
||||
switch(animationType) {
|
||||
case Animal.ANIMATION_TYPE_CHANGE:
|
||||
this.sprite.width = 70;
|
||||
this.sprite.height = 70;
|
||||
game.add.tween(this.sprite).to( { width: 50, height: 50 }, 500, Phaser.Easing.Bounce.Out, true);
|
||||
this.sprite.width = 200;
|
||||
this.sprite.height = 200;
|
||||
game.add.tween(this.sprite).to( { width: 150, height: 150 }, 500, Phaser.Easing.Bounce.Out, true);
|
||||
break;
|
||||
|
||||
case Animal.ANIMATION_TYPE_DAMAGE:
|
||||
this.sprite.width = 100;
|
||||
game.add.tween(this.sprite).to( { width: 50 }, 500, Phaser.Easing.Bounce.In, true);
|
||||
this.sprite.width = 200;
|
||||
game.add.tween(this.sprite).to( { width: 150 }, 500, Phaser.Easing.Bounce.In, true);
|
||||
// game.add.tween(this.sprite).to( { width: 50 }, 500, Phaser.Easing.Elastic.Out, true);
|
||||
break;
|
||||
|
||||
@@ -71,8 +71,8 @@ class Animal {
|
||||
if(this.sprite === null) {
|
||||
this.sprite = game.add.sprite(this.posX, this.posY, this.spriteFrameNames.run1);
|
||||
this.sprite.anchor.set(0.5);
|
||||
this.sprite.width = 50;
|
||||
this.sprite.height = 50;
|
||||
this.sprite.width = 150;
|
||||
this.sprite.height = 150;
|
||||
}
|
||||
|
||||
this.stopAnimation();
|
||||
@@ -103,6 +103,8 @@ class Animal {
|
||||
|
||||
|
||||
static loadResources() {
|
||||
game.load.image('snail_shadow', '../../../resources/image/character/animal/snail/shadow.png');
|
||||
|
||||
game.load.image('snail_icon', '../../../resources/image/character/animal/snail/run2.png');
|
||||
game.load.image('snail_run1', '../../../resources/image/character/animal/snail/run1.png');
|
||||
game.load.image('snail_run2', '../../../resources/image/character/animal/snail/run2.png');
|
||||
|
||||
@@ -25,7 +25,7 @@ class RoundRectButtonSetting {
|
||||
this.strokeColors = { };
|
||||
this.strokeColors.out = out;
|
||||
this.strokeColors.over = over;
|
||||
this.strokeColors.odownut = down;
|
||||
this.strokeColors.down = down;
|
||||
this.strokeColors.disabled = disabled;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ class RoundRectButtonSetting {
|
||||
this.buttonColors = { };
|
||||
this.buttonColors.out = out;
|
||||
this.buttonColors.over = over;
|
||||
this.buttonColors.odownut = down;
|
||||
this.buttonColors.down = down;
|
||||
this.buttonColors.disabled = disabled;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ class RoundRectButtonSetting {
|
||||
this.textColors = { };
|
||||
this.textColors.out = out;
|
||||
this.textColors.over = over;
|
||||
this.textColors.odownut = down;
|
||||
this.textColors.down = down;
|
||||
this.textColors.disabled = disabled;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,59 @@
|
||||
class TypingAppButton extends RoundRectButton {
|
||||
|
||||
constructor(x, y, iconName, buttonText, clickEvent) {
|
||||
constructor(type, x, y, iconName, buttonText, clickEvent) {
|
||||
let setting = new RoundRectButtonSetting(x, y, TypingAppButton.BUTTON_WIDTH, TypingAppButton.BUTTON_HEIGHT);
|
||||
setting.fontStyle.boundsAlignH = "center"; // left, center. right
|
||||
setting.fontStyle.boundsAlignV = "middle"; // top, middle, bottom
|
||||
setting.strokeWidthPx = 5;
|
||||
|
||||
switch(type) {
|
||||
case TypingAppButton.TYPE_PRACTICE_KOREAN:
|
||||
case TypingAppButton.TYPE_TEST_KOREAN:
|
||||
setting.setStrokeColor(
|
||||
0xffffff,
|
||||
0xeeeeff,
|
||||
0xccccdd,
|
||||
0x333333
|
||||
);
|
||||
setting.setButtonColor(
|
||||
0xeeeeff,
|
||||
0xddddee,
|
||||
0xccccdd,
|
||||
0x666666
|
||||
);
|
||||
setting.setTextColor(
|
||||
"#668",
|
||||
"#668",
|
||||
"#668",
|
||||
"#333"
|
||||
);
|
||||
break;
|
||||
|
||||
case TypingAppButton.TYPE_PRACTICE_ENGLISH:
|
||||
case TypingAppButton.TYPE_TEST_ENGLISH:
|
||||
setting.setStrokeColor(
|
||||
0xffffff,
|
||||
0xffeeee,
|
||||
0xddcccc,
|
||||
0x333333
|
||||
);
|
||||
setting.setButtonColor(
|
||||
0xffeeee,
|
||||
0xeedddd,
|
||||
0xddcccc,
|
||||
0x666666
|
||||
);
|
||||
setting.setTextColor(
|
||||
"#866",
|
||||
"#866",
|
||||
"#866",
|
||||
"#333"
|
||||
);
|
||||
break;
|
||||
}
|
||||
/*
|
||||
setting.setStrokeColor(
|
||||
0x444488,
|
||||
0xffffff, //0x444488,
|
||||
0x6666aa,
|
||||
0x6666aa,
|
||||
0x333333
|
||||
@@ -24,6 +70,7 @@ class TypingAppButton extends RoundRectButton {
|
||||
"#a66",
|
||||
"#333"
|
||||
);
|
||||
*/
|
||||
|
||||
setting.fontStyle = {
|
||||
font: "22px Arial",
|
||||
@@ -34,21 +81,31 @@ class TypingAppButton extends RoundRectButton {
|
||||
|
||||
super(setting, iconName, buttonText, clickEvent);
|
||||
|
||||
this.text.x = 30;
|
||||
|
||||
if(iconName.length > 0) {
|
||||
let iconImage = game.add.sprite(0, 0, iconName);
|
||||
iconImage.width = 80;
|
||||
iconImage.height = 80;
|
||||
this.button.setIcon(iconImage);
|
||||
console.log(this.icon);
|
||||
this.icon.x = 40;
|
||||
this.icon.width = 100;
|
||||
this.icon.height = 100;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TypingAppButton.BUTTON_WIDTH = 220;
|
||||
TypingAppButton.TYPE_PRACTICE_KOREAN = 0;
|
||||
TypingAppButton.TYPE_PRACTICE_ENGLISH = 1;
|
||||
TypingAppButton.TYPE_TEST_KOREAN = 2;
|
||||
TypingAppButton.TYPE_TEST_ENGLISH = 3;
|
||||
|
||||
TypingAppButton.BUTTON_WIDTH = 230;
|
||||
TypingAppButton.BUTTON_HEIGHT = 80;
|
||||
|
||||
TypingAppButton.BUTTON_GAP = 10;
|
||||
TypingAppButton.MARGIN_VERTICAL = 100;
|
||||
TypingAppButton.MARGIN_VERTICAL = 20;
|
||||
|
||||
TypingAppButton.BUTTON_UPPER_POS_Y = 205;
|
||||
TypingAppButton.BUTTON_LOWER_POS_Y = 475;
|
||||
TypingAppButton.BUTTON_LOWER_POS_Y = 475;
|
||||
|
||||
TypingAppButton.QUESTION_ICON = "";
|
||||
@@ -41,10 +41,10 @@ class TypingTabButton extends RoundRectButton {
|
||||
|
||||
}
|
||||
|
||||
TypingTabButton.BUTTON_WIDTH = 445;
|
||||
TypingTabButton.BUTTON_WIDTH = 490;
|
||||
TypingTabButton.BUTTON_HEIGHT = 80;
|
||||
|
||||
TypingTabButton.BUTTON_GAP = 26;
|
||||
TypingTabButton.BUTTON_GAP = 5;
|
||||
TypingTabButton.MARGIN_VERTICAL = 100;
|
||||
|
||||
TypingTabButton.PRACTICE_BUTTON_POS_X = GAME_SCREEN_SIZE.x / 4 + TypingTabButton.BUTTON_GAP;
|
||||
|
||||
Reference in New Issue
Block a user