110 lines
2.1 KiB
JavaScript
110 lines
2.1 KiB
JavaScript
class TypingAppButton extends RoundRectButton {
|
|
|
|
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(
|
|
"#66c",
|
|
"#66c",
|
|
"#66c",
|
|
"#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(
|
|
"#a66",
|
|
"#a66",
|
|
"#a66",
|
|
"#333"
|
|
);
|
|
break;
|
|
}
|
|
/*
|
|
setting.setStrokeColor(
|
|
0xffffff, //0x444488,
|
|
0x6666aa,
|
|
0x6666aa,
|
|
0x333333
|
|
);
|
|
setting.setButtonColor(
|
|
0xaaaadd,
|
|
0xddddff,
|
|
0xddddff,
|
|
0x666666
|
|
);
|
|
setting.setTextColor(
|
|
"#844",
|
|
"#a66",
|
|
"#a66",
|
|
"#333"
|
|
);
|
|
*/
|
|
|
|
setting.fontStyle = {
|
|
font: "22px Arial",
|
|
boundsAlignH: "center", // left, center. right
|
|
boundsAlignV: "middle", // top, middle, bottom
|
|
fill: "#fff"
|
|
};
|
|
|
|
super(setting, iconName, buttonText, clickEvent);
|
|
|
|
this.text.x = 30;
|
|
|
|
if(iconName.length > 0) {
|
|
this.icon.x = 40;
|
|
this.icon.width = 100;
|
|
this.icon.height = 100;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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 = 20;
|
|
|
|
TypingAppButton.BUTTON_UPPER_POS_Y = 205;
|
|
TypingAppButton.BUTTON_LOWER_POS_Y = 475;
|
|
|
|
TypingAppButton.QUESTION_ICON = ""; |