Add: TypingAppButton(flat button) (incompleted)

This commit is contained in:
2019-08-11 15:27:03 +09:00
parent 6aa89a5db4
commit 0b8984540e
6 changed files with 186 additions and 9 deletions
+66 -1
View File
@@ -64,6 +64,10 @@ MainMenu.prototype.create = function() {
this.appGroupTabLayout = null;
this.languageTabLayout = null;
this.typingAppButtons = new Array();
this.writingAppButtons = new Array();
this.mouseAppButtons = new Array();
this.selectedAppGroup = MainMenu.APP_GROUP_TYPING_PRACTICE;
this.selectedLanguage = MainMenu.LANGUAGE_KOREAN;
// this.animalRecordList.printScore(Animal.TYPE_PRACTICE);
@@ -196,9 +200,70 @@ MainMenu.prototype.updateAppButtons = function(appGroup, appData) {
}
}
MainMenu.prototype.clearTypingAppButtons = function(appData) {
var count = this.typingAppButtons.length;
for(var i = 0; i < count; i++) {
var tempButton = this.typingAppButtons.pop();
tempButton.setActive(false);
delete tempButton;
}
}
MainMenu.prototype.isActivatedApp = function(appID, activeAppList) {
var count = activeAppList.length;
for(var i = 0; i < count; i++) {
if(appID === activeAppList[i].appID)
return true;
}
return false;
}
MainMenu.prototype.getAppHighestRecord = function(appID, highestRecordList) {
var count = highestRecordList.length;
for(var i = 0; i < count; i++) {
if(appID === highestRecordList.appID)
return highestRecordList[i].highestRecord;
}
return 0;
}
MainMenu.prototype.makeTypingPracticeAppDataList = function(appData) {
var appDataList = new Array();
var appList = appData.appList;
if(appList.length === 0)
return [];
var count = appList.length;
for(var appDataIndex = 0; appDataIndex < count; appDataIndex++) {
var data = {};
data["appID"] = appList[appDataIndex].appID;
data["appName"] = appList[appDataIndex].appName;
data["koreanName"] = appList[appDataIndex].koreanName;
data["activated"] = this.isActivatedApp(appList[appDataIndex].appID, appData.activeAppList);
data["highestRecord"] = this.getAppHighestRecord(appList[appDataIndex].appID, appData.highestRecordList);
appDataList.push(data);
}
return appDataList;
}
MainMenu.prototype.makeTypingPracticeAppButtons = function(appData) {
console.log("makeTypingPracticeAppButtons");
console.log(appData);
this.clearTypingAppButtons();
var buttonIndex = 0;
var appDataList = this.makeTypingPracticeAppDataList(appData);
var count = appDataList.length;
for(var i = 0; i < count; i++) {
var x = (i % 2) === 0 ? 300 : 800;
var y = 200 + Math.floor(i / 2) * 100;
var leftButton = new TypingAppButton(x, y,appDataList[i]);
this.typingAppButtons.push(leftButton);
}
}
MainMenu.prototype.makeTypingTestAppButtons = function(appData) {