Fix: make game app button and typing app button smaller
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
class TypingAppButton extends RoundRectButton {
|
||||
|
||||
constructor(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;
|
||||
|
||||
setting.setStrokeColor(
|
||||
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);
|
||||
|
||||
if(iconName.length > 0) {
|
||||
let iconImage = game.add.sprite(0, 0, iconName);
|
||||
iconImage.width = 80;
|
||||
iconImage.height = 80;
|
||||
this.button.setIcon(iconImage);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TypingAppButton.BUTTON_WIDTH = 160;
|
||||
TypingAppButton.BUTTON_HEIGHT = 80;
|
||||
|
||||
TypingAppButton.BUTTON_GAP = 10;
|
||||
TypingAppButton.MARGIN_VERTICAL = 100;
|
||||
|
||||
TypingAppButton.BUTTON_UPPER_POS_Y = 200;
|
||||
TypingAppButton.BUTTON_LOWER_POS_Y = 480;
|
||||
Reference in New Issue
Block a user