Fix: AnimalRecordList, Animal.TYPE_FINGER_POSITION / TYPE_PRACTICE / (TYPE_EXAM)

This commit is contained in:
2019-08-07 22:28:02 +09:00
parent b205787545
commit 8aee96fb51
6 changed files with 112 additions and 99 deletions
+24 -22
View File
@@ -72,17 +72,18 @@ Animal.animalLevelIDByRecord = function(record, gameType) {
return 0;
}
Animal.getAnimalPracticeTypingCount = function(animalIndex) {
return Animal.SPECIES_DATA[animalIndex].practiceTypingCount;
Animal.getAnimalFingerPositionTypingCount = function(animalIndex) {
return Animal.SPECIES_DATA[animalIndex].fingerPositionTypingCount;
}
Animal.typingCount = function(speciesData, gameType) {
if(gameType === Animal.TYPE_PRACTICE)
return speciesData.practiceTypingCount;
if(gameType === Animal.TYPE_FINGER_POSITION)
return speciesData.fingerPositionTypingCount;
else
return speciesData.testTypingCount;
return speciesData.practiceTypingCount;
}
Animal.loadResources = function() {
game.load.spritesheet('animals', '../../../resources/image/character/animal/animals.png', 50, 50);
}
@@ -91,8 +92,9 @@ Animal.loadResources = function() {
Animal.TYPE_ANIMATION = 0;
Animal.TYPE_ICON = 1;
Animal.TYPE_PRACTICE = 0;
Animal.TYPE_TEST = 1;
Animal.TYPE_FINGER_POSITION = 0;
Animal.TYPE_PRACITICE = 1;
Animal.TYPE_EXAM = 1;
Animal.ANIMATION_TYPE_CHANGE = 0;
Animal.ANIMATION_TYPE_DAMAGE = 1;
@@ -100,19 +102,19 @@ Animal.ANIMATION_TYPE_DAMAGE = 1;
Animal.HIDE_POS_Y = 1000;
Animal.SPECIES_DATA = [
{ "species" : "snail", "fps" : 1, "practiceTypingCount" : 0, "testTypingCount" : 0 },
{ "species" : "turtle", "fps" : 2, "practiceTypingCount" : 5, "testTypingCount" : 20 },
{ "species" : "chick", "fps" : 5, "practiceTypingCount" : 10, "testTypingCount" : 40 },
{ "species" : "mouse", "fps" : 12, "practiceTypingCount" : 15, "testTypingCount" : 70 },
{ "species" : "chicken", "fps" : 11, "practiceTypingCount" : 20, "testTypingCount" : 100 },
{ "species" : "pig", "fps" : 5, "practiceTypingCount" : 25, "testTypingCount" : 150 },
{ "species" : "cat", "fps" : 10, "practiceTypingCount" : 30, "testTypingCount" : 200 },
{ "species" : "deer", "fps" : 9, "practiceTypingCount" : 40, "testTypingCount" : 250 },
{ "species" : "kangaroo", "fps" : 4, "practiceTypingCount" : 50, "testTypingCount" : 300 },
{ "species" : "rabbit", "fps" : 12, "practiceTypingCount" : 60, "testTypingCount" : 350 },
{ "species" : "dog", "fps" : 9, "practiceTypingCount" : 70, "testTypingCount" : 400 },
{ "species" : "zebra", "fps" : 12, "practiceTypingCount" : 80, "testTypingCount" : 450 },
{ "species" : "ostrich", "fps" : 15, "practiceTypingCount" : 90, "testTypingCount" : 500 },
{ "species" : "lion", "fps" : 10, "practiceTypingCount" : 100, "testTypingCount" : 600 },
{ "species" : "cheetah", "fps" : 15, "practiceTypingCount" : 110, "testTypingCount" : 700 }
{ "species" : "snail", "fps" : 1, "fingerPositionTypingCount" : 0, "practiceTypingCount" : 0 },
{ "species" : "turtle", "fps" : 2, "fingerPositionTypingCount" : 5, "practiceTypingCount" : 20 },
{ "species" : "chick", "fps" : 5, "fingerPositionTypingCount" : 10, "practiceTypingCount" : 40 },
{ "species" : "mouse", "fps" : 12, "fingerPositionTypingCount" : 15, "practiceTypingCount" : 70 },
{ "species" : "chicken", "fps" : 11, "fingerPositionTypingCount" : 20, "practiceTypingCount" : 100 },
{ "species" : "pig", "fps" : 5, "fingerPositionTypingCount" : 25, "practiceTypingCount" : 150 },
{ "species" : "cat", "fps" : 10, "fingerPositionTypingCount" : 30, "practiceTypingCount" : 200 },
{ "species" : "deer", "fps" : 9, "fingerPositionTypingCount" : 40, "practiceTypingCount" : 250 },
{ "species" : "kangaroo", "fps" : 4, "fingerPositionTypingCount" : 50, "practiceTypingCount" : 300 },
{ "species" : "rabbit", "fps" : 12, "fingerPositionTypingCount" : 60, "practiceTypingCount" : 350 },
{ "species" : "dog", "fps" : 9, "fingerPositionTypingCount" : 70, "practiceTypingCount" : 400 },
{ "species" : "zebra", "fps" : 12, "fingerPositionTypingCount" : 80, "practiceTypingCount" : 450 },
{ "species" : "ostrich", "fps" : 15, "fingerPositionTypingCount" : 90, "practiceTypingCount" : 500 },
{ "species" : "lion", "fps" : 10, "fingerPositionTypingCount" : 100, "practiceTypingCount" : 600 },
{ "species" : "cheetah", "fps" : 15, "fingerPositionTypingCount" : 110, "practiceTypingCount" : 700 }
];
+1 -4
View File
@@ -109,9 +109,6 @@ AnimalList.RECORD_TEXT_OFFSET_Y = 36;
AnimalList.ALPHA_INACTIVE = 0.3;
AnimalList.TYPE_PRACTICE = 0;
AnimalList.TYPE_TEST = 1;
AnimalList.COLOR_BG = 0x545454; // "0x77aadd"; //0x99ccff;
AnimalList.COLOR_SCORE_DEFAULT_TEXT = "#999999"; // "#dddddd"; //"#bbddff";
AnimalList.COLOR_SCORE_CLEARED_TEXT = "#ffffff";
AnimalList.COLOR_SCORE_CLEARED_TEXT = "#ffffff";
+57 -48
View File
@@ -7,6 +7,26 @@ function AnimalRecordList(type) {
this.texts = new Array();
this.activeAnimalIndex = -1;
this.activeAnimalIndex = 0;
/*
var bgColor = AnimalRecordList.COLOR_BG;
var posY = AnimalRecordList.ANIMAL_LIST_POS_Y;
if(this.type === AnimalRecordList.TYPE_MENU) {
bgColor = MainColor.LIGHT_CHOCO_HEX;
posY = AnimalRecordList.ANIMAL_LIST_MENU_POS_Y;
}
*/
var bgColor = MainColor.LIGHT_CHOCO_HEX;
var posY = AnimalRecordList.ANIMAL_LIST_MENU_POS_Y;
this.posY = posY;
game.add.graphics()
.beginFill(bgColor, 1)
.drawRect(0, posY, game.world.width, 80);
// make animals and score texts
var animalCount = Animal.SPECIES_DATA.length;
var lineWidth = GAME_SCREEN_SIZE.x - AnimalRecordList.MARGIN_X * 2;
// console.log("lineWidth : " + lineWidth);
@@ -14,29 +34,17 @@ function AnimalRecordList(type) {
// console.log("animalCount : " + animalCount);
// console.log("offsetAnimal : " + offsetAnimal);
this.activeAnimalIndex = 0;
var bgColor = AnimalRecordList.COLOR_BG;
var posY = AnimalRecordList.ANIMAL_LIST_POS_Y;
if(this.type === AnimalRecordList.TYPE_MENU) {
bgColor = MainColor.LIGHT_CHOCO_HEX;
posY = AnimalRecordList.ANIMAL_LIST_MENU_POS_Y;
}
this.posY = posY;
game.add.graphics()
.beginFill(bgColor, 1)
.drawRect(
0, posY,
game.world.width, 80
);
this.makeAnimals(animalCount, lineWidth, offsetAnimal);
this.makeScoreTexts(animalCount, lineWidth, offsetAnimal);
}
AnimalRecordList.prototype.makeAnimals = function(animalCount, lineWidth, offsetAnimal) {
for(var i = 0; i < animalCount; i++) {
this.animals[i] = new Animal(
Animal.TYPE_ICON,
i,
AnimalRecordList.MARGIN_X + offsetAnimal * i,
posY + AnimalRecordList.ANIMAL_OFFSET_Y
AnimalRecordList.ANIMAL_LIST_MENU_POS_Y + AnimalRecordList.ANIMAL_OFFSET_Y
);
// this.inactivate(i);
}
@@ -45,38 +53,19 @@ function AnimalRecordList(type) {
// this.tweenAnimation(Animal.ANIMATION_TYPE_DAMAGE);
}
AnimalRecordList.prototype.printScore = function(type) {
var animalCount = Animal.SPECIES_DATA.length;
var lineWidth = GAME_SCREEN_SIZE.x - AnimalRecordList.MARGIN_X * 2;
// console.log("lineWidth : " + lineWidth);
var offsetAnimal = lineWidth / (animalCount - 1);
AnimalRecordList.prototype.makeScoreTexts = function(animalCount, lineWidth, offsetAnimal) {
var titleTextStyle = { font: "16px Nanum Gothic", fill: "#fff", align: "center"};
var typingCount = 0;
var animalData = null;
var posY = AnimalRecordList.RECORD_TEXT_OFFSET_Y;
if(this.type === AnimalRecordList.TYPE_MENU)
posY = AnimalRecordList.RECORD_TEXT_MENU_OFFSET_Y;
for(var i = 0; i < animalCount; i++) {
animalData = Animal.SPECIES_DATA[i];
if(type == AnimalRecordList.TYPE_PRACTICE)
typingCount = RecordUtil.getRecordValueWithUnit(animalData.practiceTypingCount, 1);
else
typingCount = RecordUtil.getRecordValueWithUnit(animalData.testTypingCount, 1);
var animalData = Animal.SPECIES_DATA[i];
var recordText = game.add.text(
// AnimalRecordList.MARGIN_X + offsetAnimal * i,
0, // center of animal image
posY,
typingCount, titleTextStyle
AnimalRecordList.RECORD_TEXT_OFFSET_Y,
"", titleTextStyle
);
recordText.anchor.set(0.5);
if(this.type === AnimalRecordList.TYPE_MENU)
recordText.addColor(AnimalRecordList.COLOR_SCORE_MENU_DEFAULT_TEXT, 0);
else
recordText.addColor(AnimalRecordList.COLOR_SCORE_DEFAULT_TEXT, 0);
recordText.addColor(AnimalRecordList.COLOR_SCORE_MENU_DEFAULT_TEXT, 0);
recordText.stroke = "#333";
recordText.strokeThickness = 3;
recordText.setShadow(1, 1, 'rgba(0, 0, 0, 0.5)', 2);
@@ -86,6 +75,29 @@ AnimalRecordList.prototype.printScore = function(type) {
}
}
AnimalRecordList.prototype.printScore = function(recordType) {
var count = this.texts.length;
for(var i = 0; i < count; i++) {
var animalData = Animal.SPECIES_DATA[i];
var recordText = this.texts[i];
var typingCountWithUnit = "";
if(recordType == Animal.TYPE_FINGER_POSITION)
typingCountWithUnit = RecordUtil.getRecordValueWithUnit(animalData.fingerPositionTypingCount, 1);
else
typingCountWithUnit = RecordUtil.getRecordValueWithUnit(animalData.practiceTypingCount, 1);
recordText.text = typingCountWithUnit;
/*
if(this.type === AnimalRecordList.TYPE_MENU)
recordText.addColor(AnimalRecordList.COLOR_SCORE_MENU_DEFAULT_TEXT, 0);
else
recordText.addColor(AnimalRecordList.COLOR_SCORE_DEFAULT_TEXT, 0);
*/
}
}
AnimalRecordList.prototype.activate = function(index) {
this.inactivate(this.activeAnimalIndex);
@@ -144,14 +156,11 @@ AnimalRecordList.RECORD_TEXT_OFFSET_Y = 36;
AnimalRecordList.ALPHA_INACTIVE = 0.3;
AnimalRecordList.TYPE_MENU = 0;
AnimalRecordList.TYPE_PRACTICE = 1;
AnimalRecordList.TYPE_TEST = 2;
AnimalRecordList.ANIMAL_LIST_MENU_POS_Y = 640;
AnimalRecordList.ANIMAL_OFFSET_Y = 30;
AnimalRecordList.RECORD_TEXT_MENU_OFFSET_Y = 35;
AnimalRecordList.COLOR_SCORE_MENU_DEFAULT_TEXT = MainColor.OLD_LACE_STRING; // MainColor.WHITE_STRING;
AnimalRecordList.ANIMAL_LIST_MENU_POS_Y = 690; // 70; //640;
AnimalRecordList.ANIMAL_OFFSET_Y = 30;
AnimalRecordList.RECORD_TEXT_MENU_OFFSET_Y = 35;
AnimalRecordList.COLOR_SCORE_MENU_DEFAULT_TEXT = MainColor.OLD_LACE_STRING;
AnimalRecordList.COLOR_BG = MainColor.CHOCO_HEX; // 0x77aadd; //0x99ccff;
AnimalRecordList.COLOR_SCORE_DEFAULT_TEXT = "#bbddff";
+1 -1
View File
@@ -75,7 +75,7 @@ BasicTab.prototype.makeActiveLineSprite = function() {
var ACTIVE_LINE_HEIGHT = 3;
var buttonWidth = setting.width;
var lineWidth = buttonWidth * 3 / 4;
var lineWidth = buttonWidth * 7 / 8;
var lineHeight = ACTIVE_LINE_HEIGHT;
var texture = null;
+3
View File
@@ -88,8 +88,11 @@ LanguageTab.prototype.createTab = function(index) {
LanguageTab.prototype.transformActiveLine = function() {
this.activeLineSprite.y = 3;
var height = this.tabLayout.getTabHeight();
this.activeLineSprite.y = height - 6;
}
LanguageTab.BUTTON_COLOR_OUT_HEX = MainColor.DARK_CHOCO_HEX;
LanguageTab.BUTTON_COLOR_OVER_HEX = MainColor.CHOCO_HEX;
LanguageTab.BUTTON_COLOR_DOWN_HEX = MainColor.LIGHTER_CHOCO_HEX;
+26 -24
View File
@@ -66,7 +66,7 @@ MainMenu.prototype.create = function() {
this.selectedAppGroup = MainMenu.APP_GROUP_FINGER_POSITION;
this.selectedLanguage = MainMenu.LANGUAGE_KOREAN;
// this.animalRecordList.printScore(AnimalList.TYPE_PRACTICE);
// this.animalRecordList.printScore(Animal.TYPE_FINGER_POSITION);
}
MainMenu.prototype.fontLoaded = function() {
@@ -173,8 +173,8 @@ MainMenu.prototype.updateAppButtons = function(appGroup, appData) {
this.makeTypingPracticeAppButtons();
break;
case MainMenu.APP_GROUP_TYPING_TEST:
this.makeTypingTestAppButtons();
case MainMenu.APP_GROUP_TYPING_EXAM:
this.makeTypingExamAppButtons();
break;
case MainMenu.APP_GROUP_TYPING_PLAY:
@@ -188,6 +188,7 @@ MainMenu.prototype.updateAppButtons = function(appGroup, appData) {
}
}
/*
MainMenu.prototype.loadSucceeded = function(replyJSON) {
// console.log(replyJSON);
@@ -211,6 +212,7 @@ MainMenu.prototype.hasApp = function(appID, appList) {
return false;
}
*/
MainMenu.prototype.makeButtons = function() {
this.backButton = new BackButton(
@@ -230,6 +232,7 @@ MainMenu.prototype.makeAppGroupTab = function() {
console.log("typing finger position");
this.selectedAppGroup = MainMenu.APP_GROUP_FINGER_POSITION;
this.animalRecordList.show();
this.animalRecordList.printScore(Animal.TYPE_FINGER_POSITION);
this.languageTabLayout.show();
}).bind(this)
);
@@ -242,6 +245,7 @@ MainMenu.prototype.makeAppGroupTab = function() {
console.log("typing practice");
this.selectedAppGroup = MainMenu.APP_GROUP_TYPING_PRACTICE;
this.animalRecordList.show();
this.animalRecordList.printScore(Animal.TYPE_PRACTICE);
this.languageTabLayout.show();
}).bind(this)
);
@@ -249,27 +253,24 @@ MainMenu.prototype.makeAppGroupTab = function() {
typingPracticeGroupTab.reserveSubText("연습");
this.appGroupTabLayout.add(typingPracticeGroupTab);
var typingTestGroupTab = new AppGroupTab(
var typingExamGroupTab = new AppGroupTab(
(function() {
console.log("typing test");
this.selectedAppGroup = MainMenu.APP_GROUP_TYPING_TEST;
console.log("typing exam");
this.selectedAppGroup = MainMenu.APP_GROUP_TYPING_EXAM;
this.animalRecordList.show();
this.animalRecordList.printScore(Animal.TYPE_EXAM);
this.languageTabLayout.show();
}).bind(this)
);
typingTestGroupTab.reserveIcon("keyboard");
typingTestGroupTab.reserveSubText("시험");
this.appGroupTabLayout.add(typingTestGroupTab);
typingExamGroupTab.reserveIcon("keyboard");
typingExamGroupTab.reserveSubText("시험");
this.appGroupTabLayout.add(typingExamGroupTab);
// var typingPlayGroupTab = new AppGroupTab( (function() { console.log("typing test"); }).bind(this) );
var typingPlayGroupTab = new AppGroupTab(
(function() { console.log("typing play"); }).bind(this)
);
var typingPlayGroupTab = new AppGroupTab(
(function() {
console.log("typing play");
this.selectedAppGroup = MainMenu.APP_GROUP_TYPING_PLAY;
this.animalRecordList.show();
this.animalRecordList.hide();
this.languageTabLayout.show();
}).bind(this)
);
@@ -277,14 +278,12 @@ MainMenu.prototype.makeAppGroupTab = function() {
typingPlayGroupTab.reserveSubText("놀이");
this.appGroupTabLayout.add(typingPlayGroupTab);
// var mousePlayGroupTab = new AppGroupTab( (function() { console.log("mouse play"); }).bind(this) );
var mousePlayGroupTab = new AppGroupTab(
(function() { console.log("mouse play"); this.animalRecordList.hide(); this.languageTabLayout.hide(); }).bind(this)
);
var typingFingerGroupTab = new AppGroupTab(
(function() {
console.log("typing finger position");
this.selectedAppGroup = MainMenu.APP_GROUP_FINGER_POSITION;
console.log("mouse play");
this.selectedAppGroup = MainMenu.APP_GROUP_MOUSE_PLAY;
this.animalRecordList.hide();
this.languageTabLayout.hide();
}).bind(this)
);
mousePlayGroupTab.reserveIcon("mouse");
@@ -296,19 +295,20 @@ MainMenu.prototype.makeAppGroupTab = function() {
// typingFingerGroupTab.setInputEnabled(false);
// typingPracticeGroupTab.setInputEnabled(false);
// typingTestGroupTab.setInputEnabled(false);
// typingExamGroupTab.setInputEnabled(false);
// typingPlayGroupTab.setInputEnabled(false);
// mousePlayGroupTab.setInputEnabled(false);
}
MainMenu.prototype.makeAnimalRecordList = function() {
this.animalRecordList = new AnimalRecordList(AnimalRecordList.TYPE_MENU);
this.animalRecordList.printScore(AnimalList.TYPE_TEST);
this.animalRecordList.printScore(Animal.TYPE_FINGER_POSITION);
}
MainMenu.prototype.makeLanguageTab = function() {
var languageTabHeight = 48;
this.languageTabLayout = new TabLayout(0, GAME_SCREEN_SIZE.y - languageTabHeight, GAME_SCREEN_SIZE.x, languageTabHeight);
// this.languageTabLayout = new TabLayout(0, GAME_SCREEN_SIZE.y - languageTabHeight, GAME_SCREEN_SIZE.x, languageTabHeight);
this.languageTabLayout = new TabLayout(0, 70, GAME_SCREEN_SIZE.x, languageTabHeight);
var koreanTab = new LanguageTab(
(function() {
@@ -332,6 +332,7 @@ MainMenu.prototype.makeLanguageTab = function() {
}
/*
MainMenu.prototype.makeMouseAppButtons = function(appList, activeAppList) {
// console.log(appList);
@@ -461,6 +462,7 @@ MainMenu.prototype.getButtonPosY = function(index, buttonCount, startPosY) {
var startY = startPosY - ( (gap / 2) * (rowCount - 1) );
return startY + gap * rowIndex;
}
*/
MainMenu.prototype.loadFailed = function(replyJSON) {
// console.log('login failed, jsonData : ' + JSON.stringify(replyJSON));
@@ -471,7 +473,7 @@ MainMenu.MAIN_MENU_HEIGHT = 70;
MainMenu.APP_GROUP_FINGER_POSITION = 0;
MainMenu.APP_GROUP_TYPING_PRACTICE = 1;
MainMenu.APP_GROUP_TYPING_TEST = 2;
MainMenu.APP_GROUP_TYPING_EXAM = 2;
MainMenu.APP_GROUP_TYPING_PLAY = 3;
MainMenu.APP_GROUP_MOUSE_PLAY = 4;