Fix: RoundRectSetting color object value errer
This commit is contained in:
@@ -4,22 +4,23 @@ class BackButton {
|
|||||||
let setting = new RoundRectButtonSetting(50, 50);
|
let setting = new RoundRectButtonSetting(50, 50);
|
||||||
setting.fontStyle.boundsAlignH = "center"; // left, center. right
|
setting.fontStyle.boundsAlignH = "center"; // left, center. right
|
||||||
setting.fontStyle.boundsAlignV = "middle"; // top, middle, bottom
|
setting.fontStyle.boundsAlignV = "middle"; // top, middle, bottom
|
||||||
|
setting.strokeWidthPx = 3;
|
||||||
setting.setStrokeColor(
|
setting.setStrokeColor(
|
||||||
|
0xaa6666,
|
||||||
|
0x884444,
|
||||||
0x884444,
|
0x884444,
|
||||||
0xaa6666,
|
|
||||||
0xaa6666,
|
|
||||||
0x333333
|
0x333333
|
||||||
);
|
);
|
||||||
setting.setButtonColor(
|
setting.setButtonColor(
|
||||||
|
0xffdddd,
|
||||||
|
0xddaaaa,
|
||||||
0xddaaaa,
|
0xddaaaa,
|
||||||
0xffdddd,
|
|
||||||
0xffdddd,
|
|
||||||
0x666666
|
0x666666
|
||||||
);
|
);
|
||||||
setting.setTextColor(
|
setting.setTextColor(
|
||||||
|
"#a66",
|
||||||
|
"#844",
|
||||||
"#844",
|
"#844",
|
||||||
"#a66",
|
|
||||||
"#a66",
|
|
||||||
"#333"
|
"#333"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -8,16 +8,17 @@ class FullscreenButton {
|
|||||||
let setting = new RoundRectButtonSetting(50, 50);
|
let setting = new RoundRectButtonSetting(50, 50);
|
||||||
setting.fontStyle.boundsAlignH = "center"; // left, center. right
|
setting.fontStyle.boundsAlignH = "center"; // left, center. right
|
||||||
setting.fontStyle.boundsAlignV = "middle"; // top, middle, bottom
|
setting.fontStyle.boundsAlignV = "middle"; // top, middle, bottom
|
||||||
|
setting.strokeWidthPx = 3;
|
||||||
setting.setStrokeColor(
|
setting.setStrokeColor(
|
||||||
0x884444,
|
0x444488,
|
||||||
0xaa6666,
|
0x6666aa,
|
||||||
0xaa6666,
|
0x6666aa,
|
||||||
0x333333
|
0x333333
|
||||||
);
|
);
|
||||||
setting.setButtonColor(
|
setting.setButtonColor(
|
||||||
0xddaaaa,
|
0xaaaadd,
|
||||||
0xffdddd,
|
0xddddff,
|
||||||
0xffdddd,
|
0xddddff,
|
||||||
0x666666
|
0x666666
|
||||||
);
|
);
|
||||||
setting.setTextColor(
|
setting.setTextColor(
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class RoundRectButtonSetting {
|
|||||||
} else {
|
} else {
|
||||||
this.roundAmount = roundAmount;
|
this.roundAmount = roundAmount;
|
||||||
}
|
}
|
||||||
this.strokeWidth = RoundRectButtonSetting.DEFAULT_STROKE_WIDTH_PX;
|
this.strokeWidthPx = RoundRectButtonSetting.DEFAULT_STROKE_WIDTH_PX;
|
||||||
|
|
||||||
|
|
||||||
this.strokeColors = RoundRectButtonSetting.DEFAULT_STROKE_COLORS;
|
this.strokeColors = RoundRectButtonSetting.DEFAULT_STROKE_COLORS;
|
||||||
@@ -20,6 +20,7 @@ class RoundRectButtonSetting {
|
|||||||
};
|
};
|
||||||
|
|
||||||
setStrokeColor(out, over, down, disabled) {
|
setStrokeColor(out, over, down, disabled) {
|
||||||
|
this.strokeColors = { };
|
||||||
this.strokeColors.out = out;
|
this.strokeColors.out = out;
|
||||||
this.strokeColors.over = over;
|
this.strokeColors.over = over;
|
||||||
this.strokeColors.odownut = down;
|
this.strokeColors.odownut = down;
|
||||||
@@ -27,6 +28,7 @@ class RoundRectButtonSetting {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setButtonColor(out, over, down, disabled) {
|
setButtonColor(out, over, down, disabled) {
|
||||||
|
this.buttonColors = { };
|
||||||
this.buttonColors.out = out;
|
this.buttonColors.out = out;
|
||||||
this.buttonColors.over = over;
|
this.buttonColors.over = over;
|
||||||
this.buttonColors.odownut = down;
|
this.buttonColors.odownut = down;
|
||||||
@@ -34,6 +36,7 @@ class RoundRectButtonSetting {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setTextColor(out, over, down, disabled) {
|
setTextColor(out, over, down, disabled) {
|
||||||
|
this.textColors = { };
|
||||||
this.textColors.out = out;
|
this.textColors.out = out;
|
||||||
this.textColors.over = over;
|
this.textColors.over = over;
|
||||||
this.textColors.odownut = down;
|
this.textColors.odownut = down;
|
||||||
@@ -120,13 +123,13 @@ class RoundRectButton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
makeButtonSprite() {
|
makeButtonSprite() {
|
||||||
let width = this.setting.width - this.setting.strokeWidth * 2;
|
let width = this.setting.width - this.setting.strokeWidthPx * 2;
|
||||||
let height = this.setting.height - this.setting.strokeWidth * 2;
|
let height = this.setting.height - this.setting.strokeWidthPx * 2;
|
||||||
let innerRoundAmount = this.setting.roundAmount * (width / this.setting.width);
|
let innerRoundAmount = this.setting.roundAmount * (width / this.setting.width);
|
||||||
|
|
||||||
let btnTexture = new Phaser.Graphics()
|
let btnTexture = new Phaser.Graphics()
|
||||||
.beginFill(0xffffff)
|
.beginFill(0xffffff)
|
||||||
.drawRoundedRect(this.setting.strokeWidth, this.setting.strokeWidth, width, height, innerRoundAmount)
|
.drawRoundedRect(this.setting.strokeWidthPx, this.setting.strokeWidthPx, width, height, innerRoundAmount)
|
||||||
.endFill()
|
.endFill()
|
||||||
.generateTexture();
|
.generateTexture();
|
||||||
|
|
||||||
@@ -134,8 +137,8 @@ class RoundRectButton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
makeText(textContent) {
|
makeText(textContent) {
|
||||||
let width = this.setting.width - this.setting.strokeWidth * 2;
|
let width = this.setting.width - this.setting.strokeWidthPx * 2;
|
||||||
let height = this.setting.height - this.setting.strokeWidth * 2;
|
let height = this.setting.height - this.setting.strokeWidthPx * 2;
|
||||||
|
|
||||||
let btnText = game.add.text(0, 0, textContent, this.setting.fontStyle)
|
let btnText = game.add.text(0, 0, textContent, this.setting.fontStyle)
|
||||||
.setTextBounds(0, 0, width, this.setting.height);
|
.setTextBounds(0, 0, width, this.setting.height);
|
||||||
@@ -198,8 +201,8 @@ class RoundRectButton {
|
|||||||
this.buttonStroke.x = x - this.setting.width / 2;
|
this.buttonStroke.x = x - this.setting.width / 2;
|
||||||
this.buttonStroke.y = y - this.setting.height / 2;
|
this.buttonStroke.y = y - this.setting.height / 2;
|
||||||
|
|
||||||
this.button.x = x - this.setting.width / 2+ this.setting.strokeWidth;
|
this.button.x = x - this.setting.width / 2+ this.setting.strokeWidthPx;
|
||||||
this.button.y = y - this.setting.height / 2+ this.setting.strokeWidth;
|
this.button.y = y - this.setting.height / 2+ this.setting.strokeWidthPx;
|
||||||
}
|
}
|
||||||
|
|
||||||
get inputEnabled() {
|
get inputEnabled() {
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ let Login = {
|
|||||||
// game.stage.backgroundColor = '#4d4d4d';
|
// game.stage.backgroundColor = '#4d4d4d';
|
||||||
|
|
||||||
this.makeInputTypeTexts();
|
this.makeInputTypeTexts();
|
||||||
|
|
||||||
this.makeButton();
|
this.makeButton();
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -71,11 +70,6 @@ let Login = {
|
|||||||
|
|
||||||
let startButton = new RoundRectButton(setting, "시작", this.startMenu);
|
let startButton = new RoundRectButton(setting, "시작", this.startMenu);
|
||||||
startButton.move(game.world.centerX, game.world.centerY + 140);
|
startButton.move(game.world.centerX, game.world.centerY + 140);
|
||||||
|
|
||||||
icon_fullscreen = game.add.sprite(0, 0, 'icon_fullscreen');
|
|
||||||
icon_fullscreen.width = 20;
|
|
||||||
icon_fullscreen.height = 20;
|
|
||||||
startButton.setIcon(icon_fullscreen);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
startMenu: function() {
|
startMenu: function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user