Fix: some bugs
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
class AppButton {
|
||||
|
||||
constructor(x, y, type, iconName, clickEvent) {
|
||||
constructor(x, y, type, iconName, appText, clickEvent) {
|
||||
let setting = new RoundRectButtonSetting(150, 150);
|
||||
setting.fontStyle.boundsAlignH = "center"; // left, center. right
|
||||
setting.fontStyle.boundsAlignV = "middle"; // top, middle, bottom
|
||||
@@ -46,14 +46,23 @@ class AppButton {
|
||||
);
|
||||
}
|
||||
|
||||
let icon_fullscreen = game.add.sprite(0, 0, iconName);
|
||||
icon_fullscreen.width = 80;
|
||||
icon_fullscreen.height = 80;
|
||||
|
||||
this.button = new RoundRectButton(setting, "", clickEvent);
|
||||
this.button.setIcon(icon_fullscreen);
|
||||
|
||||
this.move(x, y);
|
||||
|
||||
if(iconName.length > 0) {
|
||||
let icon_fullscreen = game.add.sprite(0, 0, iconName);
|
||||
icon_fullscreen.width = 80;
|
||||
icon_fullscreen.height = 80;
|
||||
this.button.setIcon(icon_fullscreen);
|
||||
}
|
||||
|
||||
if(appText.length > 0) {
|
||||
const style = { font: "32px Arial", fill: "#fff", align: "center", boundsAlignH: "center", boundsAlignV: "middle" };
|
||||
let icon_text = game.add.text(0, 0, appText, style);
|
||||
icon_text.setTextBounds(x - 50, y - 50, 100, 100);
|
||||
icon_text.stroke = "#333";
|
||||
icon_text.strokeThickness = 5;
|
||||
}
|
||||
}
|
||||
|
||||
move(x, y) {
|
||||
@@ -63,4 +72,7 @@ class AppButton {
|
||||
}
|
||||
|
||||
AppButton.TYPE_MOUSE = 0;
|
||||
AppButton.TYPE_TYPING = 1;
|
||||
AppButton.TYPE_TYPING = 1;
|
||||
|
||||
AppButton.NONE_ICON = "";
|
||||
AppButton.NONE_BUTTON_TEXT = "";
|
||||
Reference in New Issue
Block a user