Fix: AnimalRecordList, Animal.TYPE_FINGER_POSITION / TYPE_PRACTICE / (TYPE_EXAM)
This commit is contained in:
+24
-22
@@ -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 }
|
||||
];
|
||||
@@ -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";
|
||||
@@ -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";
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user