Add: ChocoSettingButton
This commit is contained in:
@@ -29,11 +29,20 @@ function ChocoButton(setting, clickEvent) {
|
||||
|
||||
|
||||
ChocoButton.prototype.makeButtonStrokeSprite = function() { // outter(bigger) round rect sprite
|
||||
var texture = new Phaser.Graphics()
|
||||
.beginFill(0xffffff)
|
||||
.drawRoundedRect(0, 0, this.setting.width, this.setting.height, this.setting.roundAmount)
|
||||
.endFill()
|
||||
.generateTexture();
|
||||
var texture = null;
|
||||
if(this.setting.roundAmount === 0) {
|
||||
texture = new Phaser.Graphics()
|
||||
.beginFill(0xffffff)
|
||||
.drawRect(0, 0, this.setting.width, this.setting.height)
|
||||
.endFill()
|
||||
.generateTexture();
|
||||
} else {
|
||||
texture = new Phaser.Graphics()
|
||||
.beginFill(0xffffff)
|
||||
.drawRoundedRect(0, 0, this.setting.width, this.setting.height, this.setting.roundAmount)
|
||||
.endFill()
|
||||
.generateTexture();
|
||||
}
|
||||
|
||||
var buttonStrokeSprite = game.add.sprite(
|
||||
this.setting.x - this.setting.width / 2,
|
||||
@@ -58,11 +67,20 @@ ChocoButton.prototype.makeButtonSprite = function() { // inner(smaller) round re
|
||||
var longSideButton = (btnWidth > btnHeight ? btnWidth : btnHeight);
|
||||
var btnRoundAmount = setting.roundAmount * longSideButton / longSideStroke;
|
||||
|
||||
var texture = new Phaser.Graphics()
|
||||
.beginFill(0xffffff)
|
||||
.drawRoundedRect(0, 0, btnWidth, btnHeight, btnRoundAmount)
|
||||
.endFill()
|
||||
.generateTexture();
|
||||
var texture = null;
|
||||
if(this.setting.roundAmount === 0) {
|
||||
texture = new Phaser.Graphics()
|
||||
.beginFill(0xffffff)
|
||||
.drawRect(0, 0, btnWidth, btnHeight)
|
||||
.endFill()
|
||||
.generateTexture();
|
||||
} else {
|
||||
texture = new Phaser.Graphics()
|
||||
.beginFill(0xffffff)
|
||||
.drawRoundedRect(0, 0, btnWidth, btnHeight, btnRoundAmount)
|
||||
.endFill()
|
||||
.generateTexture();
|
||||
}
|
||||
|
||||
var posX = setting.x - btnWidth / 2;
|
||||
var posY = setting.y - btnHeight / 2;
|
||||
|
||||
Reference in New Issue
Block a user