Add: TypingAppButton - showEmptyDisabled

This commit is contained in:
2019-08-12 18:06:33 +09:00
parent 896d9f3067
commit cf467dd2d7
4 changed files with 49 additions and 17 deletions
+1 -1
View File
@@ -36,7 +36,7 @@ function BackButton(clickEvent) {
this.addIcon("home"); this.addIcon("home");
this.setIconSize(30); this.setIconSize(30);
this.setShortcutText("돌아가기"); this.setShortcutText("[ESC]");
} }
+2 -4
View File
@@ -311,7 +311,6 @@ BasicButton.prototype.setActive = function(flag) {
this.buttonSprite.alpha = 0; this.buttonSprite.alpha = 0;
this.strokeSprite.alpha = 0; this.strokeSprite.alpha = 0;
} }
} }
BasicButton.prototype.getPosX = function() { BasicButton.prototype.getPosX = function() {
@@ -338,11 +337,10 @@ BasicButton.prototype.setInputEnabled = function(isEnabled) {
this.strokeSprite.inputEnabled = isEnabled; this.strokeSprite.inputEnabled = isEnabled;
this.buttonSprite.inputEnabled = isEnabled; this.buttonSprite.inputEnabled = isEnabled;
if(isEnabled === true) { if(isEnabled === true)
this.mouseOut(); this.mouseOut();
} else { else
this.buttonDisabled(); this.buttonDisabled();
}
} }
BasicButton.prototype.setLineSpacing = function(spacingInPixels) { BasicButton.prototype.setLineSpacing = function(spacingInPixels) {
+37 -9
View File
@@ -40,32 +40,60 @@ function TypingAppButton(x, y) {
TypingAppButton.TEXT_COLOR_DISABLED_HEX TypingAppButton.TEXT_COLOR_DISABLED_HEX
); );
BasicButton.call(this, setting, this.clickEvent); BasicButton.call(this, setting, this.clickEvent);
// this.setMainText(this.appData.koreanName); // this.setMainText("");
this.setMainText("타자 앱 버튼");
// this.addIcon("tile_choco"); // this.addIcon("tile_choco");
// this.setIconSize(40); // this.setIconSize(40);
// this.setShortcutText("[단축키]"); // this.setShortcutText("[단축키]");
// this.setShortcutText("Setting");
// this.setInputEnabled(this.appData.activated);
this.animalSprite = new Animal( this.animalSprite = new Animal(
Animal.TYPE_ICON, 0, Animal.TYPE_ICON, 0,
Animal.SPRITE_WIDTH / 2, TypingAppButton.HEIGHT / 2 TypingAppButton.WIDTH - Animal.SPRITE_WIDTH / 2, TypingAppButton.HEIGHT / 2
); );
this.buttonSprite.addChild(this.animalSprite.sprite); this.buttonSprite.addChild(this.animalSprite.sprite);
} }
TypingAppButton.prototype.updateAnimalSprite = function(highestRecord) { TypingAppButton.prototype.updateAnimalSprite = function(highestRecord) {
// console.log("highestRecord : " + highestRecord + ", appType : " + this.appType);
var animalIndex = Animal.animalIndexByRecord(highestRecord, this.appType); var animalIndex = Animal.animalIndexByRecord(highestRecord, this.appType);
// console.log("animalIndex : " + animalIndex);
this.animalSprite.chagneStandAnimation(animalIndex); this.animalSprite.chagneStandAnimation(animalIndex);
} }
TypingAppButton.prototype.setInputEnabled = function(isEnabled) {
this.strokeSprite.inputEnabled = isEnabled;
this.buttonSprite.inputEnabled = isEnabled;
if(isEnabled === true) {
this.mouseOut();
this.animalSprite.sprite.tint = MainColor.WHITE_HEX;
} else {
this.buttonDisabled();
this.animalSprite.sprite.tint = MainColor.DIM_GRAY_HEX;
}
}
TypingAppButton.prototype.setActive = function(flag) {
this.setInputEnabled(flag);
if(flag) {
this.buttonSprite.alpha = 1;
this.strokeSprite.alpha = 1;
this.animalSprite.sprite.alpha = 1;
} else {
this.buttonSprite.alpha = 0;
this.strokeSprite.alpha = 0;
this.animalSprite.sprite.alpha = 0;
}
}
TypingAppButton.prototype.showEmptyDisabled = function() {
this.setInputEnabled(false);
this.buttonSprite.alpha = 0;
this.strokeSprite.alpha = 1;
this.strokeSprite.tint = MainColor.SADDLE_BROWN_HEX;
this.animalSprite.sprite.alpha = 0;
}
TypingAppButton.prototype.updateAppData = function(appData) { TypingAppButton.prototype.updateAppData = function(appData) {
this.appData = appData; this.appData = appData;
+9 -3
View File
@@ -171,7 +171,7 @@ MainMenu.prototype.loadAppData = function() {
MainMenu.prototype.makeTypingAppButtons = function() { MainMenu.prototype.makeTypingAppButtons = function() {
var offsetX = 95; var offsetX = 95;
var startY = 190; var startY = 190;
var offsetY = 115; var offsetY = 110;
var buttonHalfWidth = TypingAppButton.WIDTH / 2; var buttonHalfWidth = TypingAppButton.WIDTH / 2;
for(var i = 0; i < MainMenu.TYPING_APP_COUNT; i++) { for(var i = 0; i < MainMenu.TYPING_APP_COUNT; i++) {
@@ -186,6 +186,10 @@ MainMenu.prototype.makeTypingAppButtons = function() {
MainMenu.prototype.hideAllButtons = function() { MainMenu.prototype.hideAllButtons = function() {
// hide all buttons // hide all buttons
for(var i = 0; i < MainMenu.TYPING_APP_COUNT; i++) {
this.typingAppButtons[i].setActive(false);
}
} }
MainMenu.prototype.updateAppButtons = function(appGroup, appData) { MainMenu.prototype.updateAppButtons = function(appGroup, appData) {
@@ -277,7 +281,8 @@ MainMenu.prototype.updateTypingPracticeAppButtons = function(appGroup, appData)
button.setActive(true); button.setActive(true);
button.updateAppData(appDataList[i]); button.updateAppData(appDataList[i]);
} else { } else {
button.setActive(false); button.setActive(true);
button.showEmptyDisabled();
} }
} }
} }
@@ -295,7 +300,8 @@ MainMenu.prototype.updateTypingTestAppButtons = function(appGroup, appData) {
button.setActive(true); button.setActive(true);
button.updateAppData(appDataList[i]); button.updateAppData(appDataList[i]);
} else { } else {
button.setActive(false); button.setActive(true);
button.showEmptyDisabled();
} }
} }
} }