|
|
|
@@ -99,6 +99,9 @@ function RoundRectButton(roundRectSetting, iconName, buttonText, clickEvent) {
|
|
|
|
|
this.setIcon(this.icon);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.shortcutText = this.makeShortcutText();
|
|
|
|
|
this.button.addChild(this.shortcutText);
|
|
|
|
|
|
|
|
|
|
// this.button.anchor.setTo(0.5, 0.5);
|
|
|
|
|
this.button.inputEnabled = true;
|
|
|
|
|
this.setEventMethod(this.button);
|
|
|
|
@@ -182,9 +185,28 @@ RoundRectButton.prototype.setIcon = function(icon) {
|
|
|
|
|
this.mouseOut();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RoundRectButton.prototype.makeShortcutText = function() {
|
|
|
|
|
var shortcutText = game.add.text(this.button.width / 2, this.button.height * 9 / 10, "");
|
|
|
|
|
shortcutText.anchor.set(0.5);
|
|
|
|
|
|
|
|
|
|
shortcutText.fontSize = this.button.height * 2 / 10;
|
|
|
|
|
// shortcutText.addColor(this.setting.textColors.over, 0);
|
|
|
|
|
shortcutText.addColor("0xffffff", 0);
|
|
|
|
|
|
|
|
|
|
return shortcutText;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RoundRectButton.prototype.addShortcutText = function(text) {
|
|
|
|
|
var scText = "[ " + text + " ]";
|
|
|
|
|
this.shortcutText.text = scText;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RoundRectButton.prototype.mouseOut = function() {
|
|
|
|
|
this.text.fill = this.setting.textColors.out;
|
|
|
|
|
if(this.shortcutText != undefined)
|
|
|
|
|
this.shortcutText.fill = this.setting.textColors.over;
|
|
|
|
|
this.buttonStroke.tint = this.setting.strokeColors.out;
|
|
|
|
|
this.button.tint = this.setting.buttonColors.out;
|
|
|
|
|
if(typeof this.buttonIcon !== "undefined") {
|
|
|
|
@@ -194,6 +216,8 @@ RoundRectButton.prototype.mouseOut = function() {
|
|
|
|
|
|
|
|
|
|
RoundRectButton.prototype.mouseOver = function() {
|
|
|
|
|
this.text.fill = this.setting.textColors.over;
|
|
|
|
|
if(this.shortcutText != undefined)
|
|
|
|
|
this.shortcutText.fill = this.setting.textColors.over;
|
|
|
|
|
this.buttonStroke.tint = this.setting.strokeColors.over;
|
|
|
|
|
this.button.tint = this.setting.buttonColors.over;
|
|
|
|
|
if(typeof this.buttonIcon !== "undefined") {
|
|
|
|
@@ -203,6 +227,8 @@ RoundRectButton.prototype.mouseOver = function() {
|
|
|
|
|
|
|
|
|
|
RoundRectButton.prototype.mouseDown = function() {
|
|
|
|
|
this.text.fill = this.setting.textColors.down;
|
|
|
|
|
if(this.shortcutText != undefined)
|
|
|
|
|
this.shortcutText.fill = this.setting.textColors.over;
|
|
|
|
|
this.buttonStroke.tint = this.setting.strokeColors.down;
|
|
|
|
|
this.button.tint = this.setting.buttonColors.down;
|
|
|
|
|
if(typeof this.buttonIcon !== "undefined") {
|
|
|
|
@@ -212,6 +238,8 @@ RoundRectButton.prototype.mouseDown = function() {
|
|
|
|
|
|
|
|
|
|
RoundRectButton.prototype.buttonDisabled = function() {
|
|
|
|
|
this.text.fill = this.setting.textColors.disabled;
|
|
|
|
|
if(this.shortcutText != undefined)
|
|
|
|
|
this.shortcutText.fill = this.setting.textColors.disabled;
|
|
|
|
|
this.buttonStroke.tint = this.setting.strokeColors.disabled;
|
|
|
|
|
this.button.tint = this.setting.buttonColors.disabled;
|
|
|
|
|
if(typeof this.buttonIcon !== "undefined") {
|
|
|
|
|