Add: animal icon for typing app button
This commit is contained in:
@@ -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 = "";
|
||||
Reference in New Issue
Block a user