Add: apply korean/english word list

This commit is contained in:
2019-01-06 13:42:54 +09:00
parent d784839524
commit b2bc09469d
3 changed files with 59 additions and 29 deletions
+39 -12
View File
@@ -3,22 +3,49 @@ function ExtractWordManager() {
} }
ExtractWordManager.prototype.init = function() { ExtractWordManager.prototype.init = function() {
this.contents = []; this.koreanWordList = [];
this.koreanWordList[0] = koreanBasicWordList;
this.koreanWordList[1] = koreanLeftUpperWordList;
this.koreanWordList[2] = koreanRightUpperWordList;
this.koreanWordList[3] = koreanSecondFingerWordList;
this.koreanWordList[4] = koreanLeftLowerWordList;
this.koreanWordList[5] = koreanRightLowerWordList;
this.koreanWordList[6] = koreanLeftUpperDoubleWordList;
this.koreanWordList[7] = koreanRightUpperDoubleWordList;
// testContent = koreanWordList;
// testContent = koreanSentenceList;
this.englishWordList = [];
this.englishWordList[0] = englishBasicWordList;
this.wordList = []; this.englishWordList[1] = englishLeftUpperWordList;
this.englishWordList[2] = englishRightUpperWordList;
this.wordList[0] = "hello"; this.englishWordList[3] = englishSecondFingerWordList;
this.wordList[1] = "world"; this.englishWordList[4] = englishLeftLowerWordList;
this.englishWordList[5] = englishRightLowerWordList;
this.wordIndex = 1; // testContent = englishWordList;
// testContent = englishSentenceList;
} }
ExtractWordManager.prototype.getWord = function(wordLevel, difficulty) { ExtractWordManager.prototype.getWord = function(wordLevel, wordLength) {
this.wordIndex = 1 - this.wordIndex; if(isKoreanTypingApp())
return this.wordList[this.wordIndex]; return this.getKoreanWord(wordLevel, wordLength);
else
return this.getEnglishWord(wordLevel, wordLength);
}
ExtractWordManager.prototype.getRandomWord = function(wordList) {
var index = Math.floor(Math.random() * wordList.length);
return wordList[index];
}
ExtractWordManager.prototype.getKoreanWord = function(wordLevel, wordLength) {
return this.getRandomWord(this.koreanWordList[wordLevel]);
}
ExtractWordManager.prototype.getEnglishWord = function(wordLevel, wordLength) {
return this.getRandomWord(this.englishWordList[wordLevel]);
} }
ExtractWordManager.prototype.removeWord = function(wordLevel, word) { ExtractWordManager.prototype.removeWord = function(wordLevel, word) {
@@ -48,7 +48,7 @@ function FlyingSaucer(lineIndex) {
FlyingSaucer.prototype.initVariables = function() { FlyingSaucer.prototype.initVariables = function() {
this.isActivated = false; this.isActivated = false;
this.wordLevel = 0; this.wordLevel = 0;
this.difficulty = 0; this.wordLength = 0;
this.standardScore = 0; this.standardScore = 0;
this.speed = FlyingSaucer.DEFAULT_SPEED; this.speed = FlyingSaucer.DEFAULT_SPEED;
this.jetStatus = FlyingSaucer.JET_STATUS_HIGH; this.jetStatus = FlyingSaucer.JET_STATUS_HIGH;
@@ -131,7 +131,7 @@ FlyingSaucer.prototype.changeJetColor = function(color) {
} }
FlyingSaucer.prototype.changeCockpitColor = function(color) { FlyingSaucer.prototype.changeCockpitColor = function(color) {
this.cockpit.tint = FlyingSaucer.COKCPIT_COLOR[this.wordLevel - 1]; this.cockpit.tint = FlyingSaucer.COKCPIT_COLOR[this.wordLevel];
} }
@@ -190,8 +190,8 @@ FlyingSaucer.prototype.moveInitialPos = function() {
FlyingSaucer.prototype.startAttack = function() { FlyingSaucer.prototype.startAttack = function() {
this.wordLevel = this.gameLevelManager.getWordLevel(); this.wordLevel = this.gameLevelManager.getWordLevel();
this.difficulty = this.gameLevelManager.getDifficulty(); this.wordLength = this.gameLevelManager.getWordLength(this.wordLevel);
this.word = this.extractWordManager.getWord(this.wordLevel, this.difficulty); this.word = this.extractWordManager.getWord(this.wordLevel, this.wordLength);
this.setWord(this.word); this.setWord(this.word);
this.standardScore = this.gameLevelManager.getStandardScore(this.wordLevel, this.speed); this.standardScore = this.gameLevelManager.getStandardScore(this.wordLevel, this.speed);
// console.log(this.standardScore); // console.log(this.standardScore);
@@ -316,5 +316,5 @@ FlyingSaucer.JET_COLOR_MIDDLE = 0xffff00;
FlyingSaucer.JET_COLOR_LOW = 0xff0000; FlyingSaucer.JET_COLOR_LOW = 0xff0000;
FlyingSaucer.COKCPIT_COLOR = [ FlyingSaucer.COKCPIT_COLOR = [
0xff0000, 0xff6600, 0xff0000, 0x00ffff, 0x00ffff, 0x6666ff, 0xff00ff 0xff0000, 0xff6600, 0xffff00, 0x00ffff, 0x00ffff, 0x6666ff, 0xff00ff
] ]
@@ -1,6 +1,6 @@
function GameLevelManager() { function GameLevelManager() {
this.wordLevel = 1; this.wordLevel = 0;
this.difficulty = 1; this.wordLength = GameLevelManager.MIN_WORD_LENGTH;
this.clearPoint = 0.1; this.clearPoint = 0.1;
} }
@@ -8,25 +8,25 @@ GameLevelManager.prototype.getWordLevel = function() {
return this.wordLevel; return this.wordLevel;
} }
GameLevelManager.prototype.getDifficulty = function() { GameLevelManager.prototype.getWordLength = function() {
return this.difficulty; return this.wordLength;
} }
GameLevelManager.prototype.getStandardScore = function(wordLevel, speed) { GameLevelManager.prototype.getStandardScore = function(wordLevel, speed) {
return wordLevel * speed; return (wordLevel + 1) * (speed + 1);
} }
GameLevelManager.prototype.clearWord = function(wordLevel, landingRatio) { GameLevelManager.prototype.clearWord = function(wordLevel, landingRatio) {
// console.log("wordLevel : " + wordLevel); console.log("wordLevel : " + wordLevel);
// console.log("clearTiming : " + clearTiming); console.log("landingRatio : " + landingRatio);
if(this.wordLevel == GameLevelManager.MAX_KOR_WORD_LEVEL || wordLevel < this.wordLevel) { if(this.wordLevel == GameLevelManager.MAX_KOR_WORD_LEVEL || wordLevel < this.wordLevel) {
this.difficulty++; this.wordLength++;
return; return;
} }
if(landingRatio < GameLevelManager.LEVEL_UP_LANDING_RATIO) { if(landingRatio < GameLevelManager.LEVEL_UP_LANDING_RATIO) {
this.difficulty++; this.wordLength++;
return; return;
} }
@@ -34,12 +34,15 @@ GameLevelManager.prototype.clearWord = function(wordLevel, landingRatio) {
} }
GameLevelManager.prototype.goNextWordLevel = function() { GameLevelManager.prototype.goNextWordLevel = function() {
console.log("goNextWordLevel");
this.wordLevel++; this.wordLevel++;
this.difficulty = 1; this.wordLength = 1;
} }
GameLevelManager.LEVEL_UP_LANDING_RATIO = 0.7; GameLevelManager.LEVEL_UP_LANDING_RATIO = 0.7;
GameLevelManager.WARNING_LANDING_RATIO = 0.1; GameLevelManager.WARNING_LANDING_RATIO = 0.1;
GameLevelManager.MAX_KOR_WORD_LEVEL = 7; GameLevelManager.MAX_KOR_WORD_LEVEL = 5;
GameLevelManager.MIN_WORD_LENGTH = 2;