Fix: icon color for out, in, pressed

Fix: make lib/util directory
Add: refresh browser if app goes wrong
This commit is contained in:
2018-12-15 23:46:48 +09:00
parent 3dd42ffe02
commit 9125e035b6
25 changed files with 237 additions and 79 deletions
+20 -4
View File
@@ -16,6 +16,7 @@ function RoundRectButtonSetting(x, y, width, height, roundAmount) {
this.strokeColors = RoundRectButtonSetting.DEFAULT_STROKE_COLORS;
this.buttonColors = RoundRectButtonSetting.DEFAULT_BUTTON_COLORS;
this.textColors = RoundRectButtonSetting.DEFAULT_TEXT_COLORS;
this.iconColors = RoundRectButtonSetting.DEFAULT_ICON_COLORS;
this.fontStyle = RoundRectButtonSetting.DEFAULT_TEXT_FONT;
};
@@ -43,6 +44,14 @@ RoundRectButtonSetting.prototype.setTextColor = function(out, over, down, disabl
this.textColors.disabled = disabled;
}
RoundRectButtonSetting.prototype.setIconColor = function(out, over, down, disabled) {
this.iconColors = { };
this.iconColors.out = out;
this.iconColors.over = over;
this.iconColors.down = down;
this.iconColors.disabled = disabled;
}
RoundRectButtonSetting.DEFAULT_STROKE_COLORS = {
out: 0x666666,
@@ -65,6 +74,13 @@ RoundRectButtonSetting.DEFAULT_TEXT_COLORS = {
disabled: "#999"
};
RoundRectButtonSetting.DEFAULT_ICON_COLORS = {
out: 0xffffff,
over: 0xddffdd,
down: 0xaaffaa,
disabled: 0x333333
};
RoundRectButtonSetting.DEFAULT_TEXT_FONT = {
font: "30px Arial",
boundsAlignH: "center", // left, center. right
@@ -212,7 +228,7 @@ RoundRectButton.prototype.mouseOut = function() {
this.buttonStroke.tint = this.setting.strokeColors.out;
this.button.tint = this.setting.buttonColors.out;
if(typeof this.buttonIcon !== "undefined") {
this.buttonIcon.tint = this.setting.strokeColors.out;
this.buttonIcon.tint = this.setting.iconColors.out;
}
}
@@ -223,7 +239,7 @@ RoundRectButton.prototype.mouseOver = function() {
this.buttonStroke.tint = this.setting.strokeColors.over;
this.button.tint = this.setting.buttonColors.over;
if(typeof this.buttonIcon !== "undefined") {
this.buttonIcon.tint = this.setting.strokeColors.over;
this.buttonIcon.tint = this.setting.iconColors.over;
}
}
@@ -234,7 +250,7 @@ RoundRectButton.prototype.mouseDown = function() {
this.buttonStroke.tint = this.setting.strokeColors.down;
this.button.tint = this.setting.buttonColors.down;
if(typeof this.buttonIcon !== "undefined") {
this.buttonIcon.tint = this.setting.strokeColors.down;
this.buttonIcon.tint = this.setting.iconColors.down;
}
}
@@ -245,7 +261,7 @@ RoundRectButton.prototype.buttonDisabled = function() {
this.buttonStroke.tint = this.setting.strokeColors.disabled;
this.button.tint = this.setting.buttonColors.disabled;
if(typeof this.buttonIcon !== "undefined") {
this.buttonIcon.tint = this.setting.strokeColors.disabled;
this.buttonIcon.tint = this.setting.iconColors.disabled;
}
}
+6
View File
@@ -50,6 +50,12 @@ function TypingAppButton(type, x, y, iconSprite, buttonText, appInfo) {
"#a66",
"#333"
);
setting.setIconColor(
0xffeeee,
0xeedddd,
0xddcccc,
0x666666
);
break;
}
@@ -21,4 +21,17 @@ NumberUtil.getRecordText = function(value) {
return numberWithCommas + " 타";
else
return numberWithCommas + " 점";
}
}
NumberUtil.hexToRGB = function(hexCode) {
var hex = "";
if(hexCode.length == 4)
hex = "#" + hexCode[1] + hexCode[1] + hexCode[2] + hexCode[2] + hexCode[3] + hexCode[3];
var hexValue = "0x" + hex[1] + hex[1] + hex[2] + hex[2] + hex[3] + hex[3];
// console.log(hexCode);
// console.log(hexValue);
return hexValue;
}
+32 -34
View File
@@ -121,27 +121,26 @@ Timer.prototype.makeResetButton = function() {
setting.fontStyle.fontSize = 40;
setting.setStrokeColor(
0x309090,
0x208080,
0x205050,
0x900020,
0x800010,
0x600000,
0x666666
);
setting.setButtonColor(
0x40c0c0,
0x30a0a0,
0x208080,
0xc00040,
0xa00020,
0x800010,
0x666666
);
setting.setTextColor(
"#fff",
"#edd",
"#dbb",
"#333"
setting.setIconColor(
0xffffff,
0xdddddd,
0xbbbbbb,
0x333333
);
var button = new RoundRectButton(
setting,
null, "",
setting, null, "",
(function() {
this.resetTimer();
this.resetLeftTimeToServer();
@@ -162,27 +161,26 @@ Timer.prototype.makePlayButton = function() {
// blue tone
setting.setStrokeColor(
0x808020,
0x606010,
0x404000,
0xd0d020,
0xb0b010,
0x909000,
0x333333
);
setting.setButtonColor(
0xc0c040,
0xa0a030,
0x909020,
0xf0f040,
0xd0d030,
0xb0b020,
0x666666
);
setting.setTextColor(
"#fff",
"#fff",
"#fff",
"#333"
setting.setIconColor(
0x906020, // 0x442211,
0x704010, // 0x332200,
0x502000, // 0x111100,
0x333333
);
var button = new RoundRectButton(
setting,
null, "",
setting, null, "",
(function() { this.startTimer(); }).bind(this)
);
button.setIcon(new SpriteIconTimer(100, 100, SpriteIconTimer.FRAME_PLAY));
@@ -214,17 +212,16 @@ Timer.prototype.makePauseButton = function() {
0xb0b0b0,
0x666666
);
setting.setTextColor(
"#333",
"#222",
"#111",
"#333"
setting.setIconColor(
0x444444,
0x333333,
0x222222,
0x333333
);
var button = new RoundRectButton(
setting,
new SpriteIconTimer(50, 50, SpriteIconTimer.FRAME_PAUSE), "",
setting, null, "",
(function() {
this.pauseTimer();
@@ -323,7 +320,7 @@ Timer.prototype.resetTimer = function() {
this.pauseTimer();
this.isTimerGoingOn = false;
this.setTimerTextColor(Timer.TEXT_COLOR_CYAN);
this.setTimerTextColor(Timer.TEXT_COLOR_WHITE);
}
Timer.prototype.tickLeftTime = function() {
@@ -633,6 +630,7 @@ Timer.TYPE_MINUTE = "minute";
Timer.TYPE_SECOND = "second";
Timer.TEXT_COLOR_WHITE = 0xffffff;
Timer.TEXT_COLOR_CYAN = 0x40c0c0;
Timer.TEXT_COLOR_YELLOW = 0xe0e040;
Timer.TEXT_COLOR_GREY = 0xa0a0a0;