Fix: button classes revised
This commit is contained in:
@@ -86,21 +86,41 @@ function isTypingTestStage() {
|
||||
return false;
|
||||
}
|
||||
|
||||
function isEnglishTypingStage() {
|
||||
if(sessionStorageManager.playingAppName.indexOf("english") > -1)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function isKoreanTypingStage() {
|
||||
if(sessionStorageManager.playingAppName.indexOf("korean") > -1)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function isTypingWordStage() {
|
||||
let appName = sessionStorageManager.playingAppName;
|
||||
|
||||
if((isTypingPracticeStage() || isTypingTestStage()) && appName.indexOf("_word") > -1)
|
||||
if(appName.indexOf("_word") > -1)
|
||||
return true;
|
||||
|
||||
// if((isTypingPracticeStage() || isTypingTestStage()) && appName.indexOf("_word") > -1)
|
||||
// return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function isTypingSentenceStage() {
|
||||
let appName = sessionStorageManager.playingAppName;
|
||||
|
||||
if((isTypingPracticeStage() || isTypingTestStage()) && appName.indexOf("_sentence") > -1)
|
||||
if(appName.indexOf("_sentence") > -1)
|
||||
return true;
|
||||
|
||||
// if((isTypingPracticeStage() || isTypingTestStage()) && appName.indexOf("_sentence") > -1)
|
||||
// return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -155,15 +155,15 @@ Animal.ANIMATION_TYPE_DAMAGE = 1;
|
||||
|
||||
Animal.SPECIES_DATA = [
|
||||
{ "species" : "snail", "runningFPS" : 1.1, "practiceTypingCount" : 0, "testTypingCount" : 0 },
|
||||
{ "species" : "turtle", "runningFPS" : 5.5, "practiceTypingCount" : 5, "testTypingCount" : 20 },
|
||||
{ "species" : "cat", "runningFPS" : 10.1, "practiceTypingCount" : 10, "testTypingCount" : 50 },
|
||||
{ "species" : "lion", "runningFPS" : 15.5, "practiceTypingCount" : 15, "testTypingCount" : 100 },
|
||||
{ "species" : "rabbit", "runningFPS" : 20.2, "practiceTypingCount" : 20, "testTypingCount" : 200 },
|
||||
{ "species" : "ostrich", "runningFPS" : 25.5, "practiceTypingCount" : 30, "testTypingCount" : 300 },
|
||||
{ "species" : "horse", "runningFPS" : 30.3, "practiceTypingCount" : 40, "testTypingCount" : 400 },
|
||||
{ "species" : "dog", "runningFPS" : 35.5, "practiceTypingCount" : 50, "testTypingCount" : 500 },
|
||||
{ "species" : "cheetah", "runningFPS" : 40.4, "practiceTypingCount" : 60, "testTypingCount" : 600 },
|
||||
{ "species" : "eagle", "runningFPS" : 45.5, "practiceTypingCount" : 80, "testTypingCount" : 700 }
|
||||
{ "species" : "turtle", "runningFPS" : 2.2, "practiceTypingCount" : 5, "testTypingCount" : 20 },
|
||||
{ "species" : "cat", "runningFPS" : 4.4, "practiceTypingCount" : 10, "testTypingCount" : 50 },
|
||||
{ "species" : "lion", "runningFPS" : 6.9, "practiceTypingCount" : 15, "testTypingCount" : 100 },
|
||||
{ "species" : "rabbit", "runningFPS" : 9.3, "practiceTypingCount" : 20, "testTypingCount" : 200 },
|
||||
{ "species" : "ostrich", "runningFPS" : 12.8, "practiceTypingCount" : 30, "testTypingCount" : 300 },
|
||||
{ "species" : "horse", "runningFPS" : 16.2, "practiceTypingCount" : 40, "testTypingCount" : 400 },
|
||||
{ "species" : "dog", "runningFPS" : 20.1, "practiceTypingCount" : 50, "testTypingCount" : 500 },
|
||||
{ "species" : "cheetah", "runningFPS" : 25.4, "practiceTypingCount" : 60, "testTypingCount" : 600 },
|
||||
{ "species" : "eagle", "runningFPS" : 30.5, "practiceTypingCount" : 80, "testTypingCount" : 700 }
|
||||
];
|
||||
|
||||
Animal.SPRITE_NAMES = {
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
class AppButton {
|
||||
|
||||
constructor(setting, iconName, buttonText, clickEvent) {
|
||||
this.button = new RoundRectButton(setting, iconName, buttonText, clickEvent);
|
||||
}
|
||||
}
|
||||
|
||||
AppButton.TYPE_MOUSE_APP = 0;
|
||||
AppButton.TYPE_TYPING_PRACTICE = 1;
|
||||
AppButton.TYPE_TYPING_APP = 2;
|
||||
|
||||
AppButton.NONE_ICON = "";
|
||||
AppButton.NONE_BUTTON_TEXT = "";
|
||||
@@ -1,4 +1,4 @@
|
||||
class BackButton {
|
||||
class BackButton extends RoundRectButton {
|
||||
|
||||
constructor(clickEvent) {
|
||||
let setting = new RoundRectButtonSetting(30, 30, 50, 50);
|
||||
@@ -24,10 +24,7 @@ class BackButton {
|
||||
"#333"
|
||||
);
|
||||
|
||||
let button = new RoundRectButton(
|
||||
setting,
|
||||
RoundRectButton.NONE_ICON, "<", clickEvent
|
||||
);
|
||||
super(setting, RoundRectButton.NONE_ICON, "<", clickEvent);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,11 +1,9 @@
|
||||
class FullscreenButton {
|
||||
class FullscreenButton extends RoundRectButton {
|
||||
|
||||
constructor(game) {
|
||||
this.game = game;
|
||||
constructor() {
|
||||
game.scale.fullScreenScaleMode = Phaser.ScaleManager.EXACT_FIT;
|
||||
|
||||
this.game.scale.fullScreenScaleMode = Phaser.ScaleManager.EXACT_FIT;
|
||||
|
||||
let setting = new RoundRectButtonSetting(this.game.world.width - 30, 30, 50, 50);
|
||||
let setting = new RoundRectButtonSetting(game.world.width - 30, 30, 50, 50);
|
||||
setting.fontStyle.boundsAlignH = "center"; // left, center. right
|
||||
setting.fontStyle.boundsAlignV = "middle"; // top, middle, bottom
|
||||
setting.strokeWidthPx = 3;
|
||||
@@ -28,23 +26,22 @@ class FullscreenButton {
|
||||
"#333"
|
||||
);
|
||||
|
||||
let button = new RoundRectButton(
|
||||
setting, RoundRectButton.NONE_ICON, RoundRectButton.NONE_BUTTON_TEXT,
|
||||
() => this.clickEvent()
|
||||
super(
|
||||
setting,
|
||||
RoundRectButton.NONE_ICON, RoundRectButton.NONE_BUTTON_TEXT,
|
||||
() => {
|
||||
if(game.scale.isFullScreen) {
|
||||
game.scale.stopFullScreen();
|
||||
} else {
|
||||
game.scale.startFullScreen();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
let icon_fullscreen = game.add.sprite(0, 0, 'icon_fullscreen');
|
||||
icon_fullscreen.width = 20;
|
||||
icon_fullscreen.height = 20;
|
||||
button.setIcon(icon_fullscreen);
|
||||
}
|
||||
|
||||
clickEvent() {
|
||||
if(this.game.scale.isFullScreen) {
|
||||
this.game.scale.stopFullScreen();
|
||||
} else {
|
||||
this.game.scale.startFullScreen();
|
||||
}
|
||||
this.setIcon(icon_fullscreen);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,32 +1,17 @@
|
||||
class GameAppButton extends AppButton {
|
||||
class GameAppButton extends RoundRectButton {
|
||||
|
||||
constructor(x, y, type, iconName, buttonText, clickEvent) {
|
||||
let setting = new RoundRectButtonSetting(x, y, GameAppButton.BUTTON_WIDTH, GameAppButton.BUTTON_HEIGHT);
|
||||
console.log(type);
|
||||
let setting = new RoundRectButtonSetting(
|
||||
x, y,
|
||||
GameAppButton.BUTTON_WIDTH, GameAppButton.BUTTON_HEIGHT
|
||||
);
|
||||
setting.fontStyle.boundsAlignH = "center"; // left, center. right
|
||||
setting.fontStyle.boundsAlignV = "middle"; // top, middle, bottom
|
||||
setting.strokeWidthPx = 5;
|
||||
|
||||
if(type === AppButton.TYPE_MOUSE_APP) {
|
||||
} if(type === AppButton.TYPE_TYPING_PRACTICE) {
|
||||
setting.setStrokeColor(
|
||||
0x444488,
|
||||
0x6666aa,
|
||||
0x6666aa,
|
||||
0x333333
|
||||
);
|
||||
setting.setButtonColor(
|
||||
0xaaaadd,
|
||||
0xddddff,
|
||||
0xddddff,
|
||||
0x666666
|
||||
);
|
||||
setting.setTextColor(
|
||||
"#844",
|
||||
"#a66",
|
||||
"#a66",
|
||||
"#333"
|
||||
);
|
||||
} else { // TYPE_TYPING_APP
|
||||
switch(type) {
|
||||
case GameAppButton.TYPE_MOUSE_APP:
|
||||
setting.setStrokeColor(
|
||||
0xaa6666,
|
||||
0x884444,
|
||||
@@ -45,6 +30,28 @@ class GameAppButton extends AppButton {
|
||||
"#844",
|
||||
"#333"
|
||||
);
|
||||
break;
|
||||
case GameAppButton.TYPE_TYPING_PRACTICE:
|
||||
case GameAppButton.TYPE_TYPING_APP:
|
||||
setting.setStrokeColor(
|
||||
0x444488,
|
||||
0x6666aa,
|
||||
0x6666aa,
|
||||
0x333333
|
||||
);
|
||||
setting.setButtonColor(
|
||||
0xaaaadd,
|
||||
0xddddff,
|
||||
0xddddff,
|
||||
0x666666
|
||||
);
|
||||
setting.setTextColor(
|
||||
"#844",
|
||||
"#a66",
|
||||
"#a66",
|
||||
"#333"
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
super(setting, iconName, buttonText, clickEvent);
|
||||
@@ -52,6 +59,10 @@ class GameAppButton extends AppButton {
|
||||
|
||||
}
|
||||
|
||||
GameAppButton.TYPE_MOUSE_APP = 0;
|
||||
GameAppButton.TYPE_TYPING_PRACTICE = 1;
|
||||
GameAppButton.TYPE_TYPING_APP = 2;
|
||||
|
||||
GameAppButton.BUTTON_WIDTH = 150;
|
||||
GameAppButton.BUTTON_HEIGHT = 150;
|
||||
|
||||
@@ -59,4 +70,4 @@ GameAppButton.BUTTON_GAP = 20;
|
||||
GameAppButton.MARGIN_VERTICAL = 100;
|
||||
|
||||
GameAppButton.BUTTON_UPPER_POS_Y = 200;
|
||||
GameAppButton.BUTTON_LOWER_POS_Y = 540;
|
||||
GameAppButton.BUTTON_LOWER_POS_Y = 460;
|
||||
@@ -0,0 +1,48 @@
|
||||
class TypingPracticeButton extends RoundRectButton {
|
||||
|
||||
constructor(x, y, iconName, buttonText, clickEvent) {
|
||||
let setting = new RoundRectButtonSetting(x, y, TypingPracticeButton.BUTTON_WIDTH, TypingPracticeButton.BUTTON_HEIGHT);
|
||||
setting.fontStyle.boundsAlignH = "center"; // left, center. right
|
||||
setting.fontStyle.boundsAlignV = "middle"; // top, middle, bottom
|
||||
setting.strokeWidthPx = 5;
|
||||
|
||||
setting.setStrokeColor(
|
||||
0x444488,
|
||||
0x6666aa,
|
||||
0x6666aa,
|
||||
0x333333
|
||||
);
|
||||
setting.setButtonColor(
|
||||
0xaaaadd,
|
||||
0xddddff,
|
||||
0xddddff,
|
||||
0x666666
|
||||
);
|
||||
setting.setTextColor(
|
||||
"#844",
|
||||
"#a66",
|
||||
"#a66",
|
||||
"#333"
|
||||
);
|
||||
|
||||
|
||||
super(setting, iconName, buttonText, clickEvent);
|
||||
|
||||
if(iconName.length > 0) {
|
||||
let icon_fullscreen = game.add.sprite(0, 0, iconName);
|
||||
icon_fullscreen.width = 80;
|
||||
icon_fullscreen.height = 80;
|
||||
this.button.setIcon(icon_fullscreen);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TypingPracticeButton.BUTTON_WIDTH = 200;
|
||||
TypingPracticeButton.BUTTON_HEIGHT = 100;
|
||||
|
||||
TypingPracticeButton.BUTTON_GAP = 10;
|
||||
TypingPracticeButton.MARGIN_VERTICAL = 100;
|
||||
|
||||
TypingPracticeButton.BUTTON_UPPER_POS_Y = 200;
|
||||
TypingPracticeButton.BUTTON_LOWER_POS_Y = 480;
|
||||
@@ -0,0 +1,53 @@
|
||||
class TypingTabButton extends RoundRectButton {
|
||||
|
||||
constructor(x, y, iconName, buttonText, clickEvent) {
|
||||
let setting = new RoundRectButtonSetting(
|
||||
x, y,
|
||||
TypingTabButton.BUTTON_WIDTH, TypingTabButton.BUTTON_HEIGHT
|
||||
);
|
||||
setting.fontStyle.boundsAlignH = "center"; // left, center. right
|
||||
setting.fontStyle.boundsAlignV = "middle"; // top, middle, bottom
|
||||
setting.strokeWidthPx = 5;
|
||||
|
||||
setting.setStrokeColor(
|
||||
0x444488,
|
||||
0x6666aa,
|
||||
0x6666aa,
|
||||
0x333333
|
||||
);
|
||||
setting.setButtonColor(
|
||||
0xaaaadd,
|
||||
0xddddff,
|
||||
0xddddff,
|
||||
0x666666
|
||||
);
|
||||
setting.setTextColor(
|
||||
"#844",
|
||||
"#a66",
|
||||
"#a66",
|
||||
"#333"
|
||||
);
|
||||
|
||||
super(setting, iconName, buttonText, clickEvent);
|
||||
|
||||
|
||||
if(iconName.length > 0) {
|
||||
let icon_fullscreen = game.add.sprite(0, 0, iconName);
|
||||
icon_fullscreen.width = 80;
|
||||
icon_fullscreen.height = 80;
|
||||
this.button.setIcon(icon_fullscreen);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TypingTabButton.BUTTON_WIDTH = 500;
|
||||
TypingTabButton.BUTTON_HEIGHT = 80;
|
||||
|
||||
TypingTabButton.BUTTON_GAP = 20;
|
||||
TypingTabButton.MARGIN_VERTICAL = 100;
|
||||
|
||||
TypingTabButton.PRACTICE_BUTTON_POS_X = GAME_SCREEN_SIZE.x / 4;
|
||||
TypingTabButton.TEST_BUTTON_POS_X = GAME_SCREEN_SIZE.x / 4 * 3;
|
||||
|
||||
TypingTabButton.BUTTON_POS_Y = GAME_SCREEN_SIZE.y - (TypingTabButton.BUTTON_HEIGHT / 3 * 4);
|
||||
@@ -1,68 +0,0 @@
|
||||
class TypingPracticeButton extends AppButton {
|
||||
|
||||
constructor(x, y, type, iconName, buttonText, clickEvent) {
|
||||
let setting = new RoundRectButtonSetting(x, y, TypingPracticeButton.BUTTON_WIDTH, TypingPracticeButton.BUTTON_HEIGHT);
|
||||
setting.fontStyle.boundsAlignH = "center"; // left, center. right
|
||||
setting.fontStyle.boundsAlignV = "middle"; // top, middle, bottom
|
||||
setting.strokeWidthPx = 5;
|
||||
|
||||
if(type === LANGUAGE_KOREAN) {
|
||||
setting.setStrokeColor(
|
||||
0xaa6666,
|
||||
0x884444,
|
||||
0x884444,
|
||||
0x333333
|
||||
);
|
||||
setting.setButtonColor(
|
||||
0xffdddd,
|
||||
0xddaaaa,
|
||||
0xddaaaa,
|
||||
0x666666
|
||||
);
|
||||
setting.setTextColor(
|
||||
"#a66",
|
||||
"#844",
|
||||
"#844",
|
||||
"#333"
|
||||
);
|
||||
} else { // LANGUAGE_ENGLISH
|
||||
setting.setStrokeColor(
|
||||
0x444488,
|
||||
0x6666aa,
|
||||
0x6666aa,
|
||||
0x333333
|
||||
);
|
||||
setting.setButtonColor(
|
||||
0xaaaadd,
|
||||
0xddddff,
|
||||
0xddddff,
|
||||
0x666666
|
||||
);
|
||||
setting.setTextColor(
|
||||
"#844",
|
||||
"#a66",
|
||||
"#a66",
|
||||
"#333"
|
||||
);
|
||||
}
|
||||
|
||||
super(setting, iconName, buttonText, clickEvent);
|
||||
|
||||
if(iconName.length > 0) {
|
||||
let icon_fullscreen = game.add.sprite(0, 0, iconName);
|
||||
icon_fullscreen.width = 80;
|
||||
icon_fullscreen.height = 80;
|
||||
this.button.setIcon(icon_fullscreen);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TypingPracticeButton.BUTTON_WIDTH = 200;
|
||||
TypingPracticeButton.BUTTON_HEIGHT = 100;
|
||||
|
||||
TypingPracticeButton.BUTTON_GAP = 20;
|
||||
TypingPracticeButton.MARGIN_VERTICAL = 100;
|
||||
|
||||
TypingPracticeButton.BUTTON_UPPER_POS_Y = 200;
|
||||
TypingPracticeButton.BUTTON_LOWER_POS_Y = 540;
|
||||
+29
-35
@@ -20,7 +20,7 @@ class MenuApp {
|
||||
|
||||
new WelcomePlayerText(sessionStorageManager.playerName);
|
||||
|
||||
let fullscreenButton = new FullscreenButton(this.game);
|
||||
let fullscreenButton = new FullscreenButton();
|
||||
|
||||
|
||||
// bottom
|
||||
@@ -47,7 +47,7 @@ class MenuApp {
|
||||
}
|
||||
|
||||
loadSucceeded(replyJSON) {
|
||||
// console.log(replyJSON);
|
||||
console.log(replyJSON);
|
||||
|
||||
self.makeMouseAppButtons(replyJSON.MouseAppList);
|
||||
self.makeTypingButtons(
|
||||
@@ -68,7 +68,7 @@ class MenuApp {
|
||||
|
||||
let app = mouseAppJSON[i];
|
||||
new GameAppButton(
|
||||
posX, posY, AppButton.TYPE_MOUSE_APP,
|
||||
posX, posY, GameAppButton.TYPE_MOUSE_APP,
|
||||
"icon_fullscreen", app.KoreanName,
|
||||
() => {
|
||||
sessionStorageManager.playingAppID = app.AppID;
|
||||
@@ -88,11 +88,33 @@ class MenuApp {
|
||||
let isTypingPracticeAppExist = typingPracticeAppCount > 0 ? true : false;
|
||||
let isTypingTestAppExist = typingTestAppCount > 0 ? true : false;
|
||||
|
||||
let typingAppTotalCount = Object.keys(typingAppJSON).length
|
||||
+ (isTypingPracticeAppExist ? 1 : 0)
|
||||
+ (isTypingTestAppExist ? 1 : 0);
|
||||
let typingAppTotalCount = Object.keys(typingAppJSON).length;
|
||||
let typingAppIndex = 0;
|
||||
|
||||
|
||||
// typing tab buttons
|
||||
let typingPracticeTabButton = new TypingTabButton(
|
||||
TypingTabButton.PRACTICE_BUTTON_POS_X, TypingTabButton.BUTTON_POS_Y,
|
||||
"", "타자 연습",
|
||||
() => {
|
||||
location.href = '../../web/client/menu_typing_practice.html';
|
||||
}
|
||||
);
|
||||
if(typingPracticeAppCount === 0)
|
||||
typingPracticeTabButton.inputEnabled = false;
|
||||
|
||||
let typingTestTabButton = new TypingTabButton(
|
||||
TypingTabButton.TEST_BUTTON_POS_X, TypingTabButton.BUTTON_POS_Y,
|
||||
"", "타자 시험",
|
||||
() => {
|
||||
location.href = '../../web/client/menu_typing_test.html';
|
||||
}
|
||||
);
|
||||
if(typingTestAppCount === 0)
|
||||
typingTestTabButton.inputEnabled = false;
|
||||
|
||||
|
||||
// typing app buttons
|
||||
for(let typingButtonIndex = 0; typingButtonIndex < typingAppTotalCount; typingButtonIndex++) {
|
||||
|
||||
let posX = self.getButtonPosX(
|
||||
@@ -102,39 +124,11 @@ class MenuApp {
|
||||
typingButtonIndex, typingAppTotalCount, GameAppButton.BUTTON_LOWER_POS_Y
|
||||
);
|
||||
|
||||
if(isTypingPracticeAppExist) {
|
||||
isTypingPracticeAppExist = false;
|
||||
|
||||
new GameAppButton(
|
||||
posX, posY, AppButton.TYPE_TYPING_PRACTICE,
|
||||
"", "타자 연습",
|
||||
() => {
|
||||
location.href = '../../web/client/menu_typing_practice.html';
|
||||
}
|
||||
);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if(isTypingTestAppExist) {
|
||||
isTypingTestAppExist = false;
|
||||
|
||||
new GameAppButton(
|
||||
posX, posY, AppButton.TYPE_TYPING_PRACTICE,
|
||||
"", "타자 시험",
|
||||
() => {
|
||||
location.href = '../../web/client/menu_typing_test.html';
|
||||
}
|
||||
);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
let app = typingAppJSON[typingAppIndex];
|
||||
let isKoreanTypingApp = app.AppID < 32 ? true : false;
|
||||
|
||||
new GameAppButton(
|
||||
posX, posY, AppButton.TYPE_TYPING_APP,
|
||||
posX, posY, GameAppButton.TYPE_TYPING_APP,
|
||||
"icon_fullscreen",
|
||||
// (isKoreanTypingApp ? "(한글)" : "(영문)") + "\n" + app.KoreanName,
|
||||
app.KoreanName,
|
||||
|
||||
@@ -19,6 +19,25 @@ class MenuTypingPractice {
|
||||
let fullscreenButton = new FullscreenButton(this.game);
|
||||
|
||||
|
||||
// typing tab buttons
|
||||
let typingPracticeTabButton = new TypingTabButton(
|
||||
TypingTabButton.PRACTICE_BUTTON_POS_X, TypingTabButton.BUTTON_POS_Y,
|
||||
"", "타자 연습",
|
||||
() => {
|
||||
location.href = '../../web/client/menu_typing_practice.html';
|
||||
}
|
||||
);
|
||||
typingPracticeTabButton.inputEnabled = false;
|
||||
|
||||
let typingTestTabButton = new TypingTabButton(
|
||||
TypingTabButton.TEST_BUTTON_POS_X, TypingTabButton.BUTTON_POS_Y,
|
||||
"", "타자 시험",
|
||||
() => {
|
||||
location.href = '../../web/client/menu_typing_test.html';
|
||||
}
|
||||
);
|
||||
// typingTestTabButton.inputEnabled = false;
|
||||
|
||||
// bottom
|
||||
let screenBottom = new ScreenBottom();
|
||||
screenBottom.makeBottomLine();
|
||||
@@ -41,24 +60,33 @@ class MenuTypingPractice {
|
||||
|
||||
}
|
||||
|
||||
hasApp(appID, appList) {
|
||||
for(let i = 0; i < appList.length; i++) {
|
||||
if(appList[i].AppID === appID)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
downloadListSucceeded(replyJSON) {
|
||||
console.log(replyJSON);
|
||||
// console.log(replyJSON);
|
||||
|
||||
let buttonWidthGap = TypingPracticeButton.BUTTON_WIDTH + MenuTypingPractice.BUTTON_GAP;
|
||||
|
||||
let koreanTypingPracticeAppCount = Object.keys(replyJSON.Korean).length;
|
||||
let englishTypingPracticeAppCount = Object.keys(replyJSON.English).length;
|
||||
let koreanTypingPracticeAppCount = Object.keys(replyJSON.KoreanAppList).length;
|
||||
let englishTypingPracticeAppCount = Object.keys(replyJSON.EnglishAppList).length;
|
||||
|
||||
for(let i = 0; i < koreanTypingPracticeAppCount; i++) {
|
||||
let activeApp = replyJSON.Korean[i];
|
||||
let activeApp = replyJSON.KoreanAppList[i];
|
||||
|
||||
let posX = self.getButtonPosX(i, koreanTypingPracticeAppCount);
|
||||
let posY = self.getButtonPosY(i, koreanTypingPracticeAppCount,
|
||||
TypingPracticeButton.BUTTON_UPPER_POS_Y
|
||||
);
|
||||
|
||||
new TypingPracticeButton(
|
||||
posX, posY, LANGUAGE_KOREAN,
|
||||
let typingPracticeButton = new TypingPracticeButton(
|
||||
posX, posY,
|
||||
TypingPracticeButton.NONE_ICON,
|
||||
activeApp.KoreanName,
|
||||
() => {
|
||||
@@ -68,10 +96,13 @@ class MenuTypingPractice {
|
||||
location.href = '../../web/client/start.html';
|
||||
}
|
||||
);
|
||||
|
||||
if(!self.hasApp(activeApp.AppID, replyJSON.KoreanActiveAppList))
|
||||
typingPracticeButton.inputEnabled = false;
|
||||
}
|
||||
|
||||
for(let i = 0; i < englishTypingPracticeAppCount; i++) {
|
||||
let activeApp = replyJSON.English[i];
|
||||
let activeApp = replyJSON.EnglishAppList[i];
|
||||
|
||||
let posX = self.getButtonPosX(i, englishTypingPracticeAppCount);
|
||||
let posY = self.getButtonPosY(i, englishTypingPracticeAppCount,
|
||||
@@ -79,7 +110,7 @@ class MenuTypingPractice {
|
||||
);
|
||||
|
||||
new TypingPracticeButton(
|
||||
posX, posY, LANGUAGE_ENGLISH,
|
||||
posX, posY,
|
||||
TypingPracticeButton.NONE_ICON,
|
||||
activeApp.KoreanName,
|
||||
() => {
|
||||
@@ -89,6 +120,9 @@ class MenuTypingPractice {
|
||||
location.href = '../../web/client/start.html';
|
||||
}
|
||||
);
|
||||
|
||||
if(!self.hasApp(activeApp.AppID, replyJSON.EnglishActiveAppList))
|
||||
typingPracticeButton.inputEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,24 @@ class MenuTypingTest {
|
||||
screenBottom.printBottomCenterText("메뉴 > 타자 시험");
|
||||
screenBottom.printBottomRightText(sessionStorageManager.playerName);
|
||||
|
||||
// typing tab buttons
|
||||
let typingPracticeTabButton = new TypingTabButton(
|
||||
TypingTabButton.PRACTICE_BUTTON_POS_X, TypingTabButton.BUTTON_POS_Y,
|
||||
"", "타자 연습",
|
||||
() => {
|
||||
location.href = '../../web/client/menu_typing_practice.html';
|
||||
}
|
||||
);
|
||||
// typingPracticeTabButton.inputEnabled = false;
|
||||
|
||||
let typingTestTabButton = new TypingTabButton(
|
||||
TypingTabButton.TEST_BUTTON_POS_X, TypingTabButton.BUTTON_POS_Y,
|
||||
"", "타자 시험",
|
||||
() => {
|
||||
location.href = '../../web/client/menu_typing_test.html';
|
||||
}
|
||||
);
|
||||
typingTestTabButton.inputEnabled = false;
|
||||
|
||||
this.makeActiveTypingTestAppButtons();
|
||||
}
|
||||
@@ -41,26 +59,33 @@ class MenuTypingTest {
|
||||
|
||||
}
|
||||
|
||||
hasApp(appID, appList) {
|
||||
for(let i = 0; i < appList.length; i++) {
|
||||
if(appList[i].AppID === appID)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
downloadListSucceeded(replyJSON) {
|
||||
// console.log(replyJSON);
|
||||
|
||||
let buttonWidthGap = TypingPracticeButton.BUTTON_WIDTH + MenuTypingTest.BUTTON_GAP;
|
||||
|
||||
let koreanTypingTestAppCount = Object.keys(replyJSON.Korean).length;
|
||||
let englishTypingTestAppCount = Object.keys(replyJSON.English).length;
|
||||
let koreanTypingPracticeAppCount = Object.keys(replyJSON.KoreanAppList).length;
|
||||
let englishTypingPracticeAppCount = Object.keys(replyJSON.EnglishAppList).length;
|
||||
|
||||
// let startX = game.world.width / 2 - (buttonWidthGap * koreanTypingTestAppCount / 2) - (buttonWidthGap / 2);
|
||||
// let koreanTypingTestAppIndex = 0;
|
||||
for(let i = 0; i < koreanTypingTestAppCount; i++) {
|
||||
let activeApp = replyJSON.Korean[i];
|
||||
for(let i = 0; i < koreanTypingPracticeAppCount; i++) {
|
||||
let activeApp = replyJSON.KoreanAppList[i];
|
||||
|
||||
let posX = self.getButtonPosX(i, koreanTypingTestAppCount);
|
||||
let posY = self.getButtonPosY(i, koreanTypingTestAppCount,
|
||||
let posX = self.getButtonPosX(i, koreanTypingPracticeAppCount);
|
||||
let posY = self.getButtonPosY(i, koreanTypingPracticeAppCount,
|
||||
TypingPracticeButton.BUTTON_UPPER_POS_Y
|
||||
);
|
||||
|
||||
new TypingPracticeButton(
|
||||
posX, posY, LANGUAGE_KOREAN,
|
||||
let typingTestButton = new TypingPracticeButton(
|
||||
posX, posY,
|
||||
TypingPracticeButton.NONE_ICON,
|
||||
activeApp.KoreanName,
|
||||
() => {
|
||||
@@ -70,19 +95,21 @@ class MenuTypingTest {
|
||||
location.href = '../../web/client/start.html';
|
||||
}
|
||||
);
|
||||
|
||||
if(!self.hasApp(activeApp.AppID, replyJSON.KoreanActiveAppList))
|
||||
typingTestButton.inputEnabled = false;
|
||||
}
|
||||
|
||||
// startX = game.world.width / 2 - (buttonWidthGap * englishTypingTestAppCount / 2) - (buttonWidthGap / 2);
|
||||
for(let i = 0; i < englishTypingTestAppCount; i++) {
|
||||
let activeApp = replyJSON.English[i];
|
||||
for(let i = 0; i < englishTypingPracticeAppCount; i++) {
|
||||
let activeApp = replyJSON.EnglishAppList[i];
|
||||
|
||||
let posX = self.getButtonPosX(i, englishTypingTestAppCount);
|
||||
let posY = self.getButtonPosY(i, englishTypingTestAppCount,
|
||||
let posX = self.getButtonPosX(i, englishTypingPracticeAppCount);
|
||||
let posY = self.getButtonPosY(i, englishTypingPracticeAppCount,
|
||||
TypingPracticeButton.BUTTON_LOWER_POS_Y
|
||||
);
|
||||
|
||||
new TypingPracticeButton(
|
||||
posX, posY, LANGUAGE_ENGLISH,
|
||||
let typingTestButton = new TypingPracticeButton(
|
||||
posX, posY,
|
||||
TypingPracticeButton.NONE_ICON,
|
||||
activeApp.KoreanName,
|
||||
() => {
|
||||
@@ -92,6 +119,9 @@ class MenuTypingTest {
|
||||
location.href = '../../web/client/start.html';
|
||||
}
|
||||
);
|
||||
|
||||
if(!self.hasApp(activeApp.AppID, replyJSON.EnglishActiveAppList))
|
||||
typingTestButton.inputEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ class TypingContentBG {
|
||||
let CONTENT_Y = 140;
|
||||
|
||||
let bar = game.add.graphics();
|
||||
if(sessionStorageManager.playingAppName.indexOf("korean") > -1) {
|
||||
if(isKoreanTypingStage()) {
|
||||
bar.beginFill(TypingContentBG.COLOR_CONTENT_BG, 1);
|
||||
bar.drawRect(0, CONTENT_Y, GAME_SCREEN_SIZE.x, 120);
|
||||
} else {
|
||||
@@ -24,16 +24,25 @@ class TypingContentBG {
|
||||
let CONTENT_Y = 260;
|
||||
|
||||
let bar = game.add.graphics();
|
||||
if(sessionStorageManager.playingAppName.indexOf("korean") > -1) {
|
||||
if(isKoreanTypingStage()) {
|
||||
bar.beginFill(TypingContentBG.COLOR_CONTENT_BG, 1);
|
||||
bar.drawRect(0, CONTENT_Y, GAME_SCREEN_SIZE.x, 120);
|
||||
} else {
|
||||
bar.beginFill(TypingContentBG.COLOR_CONTENT_BG, 1);
|
||||
bar.drawRect(0, CONTENT_Y, GAME_SCREEN_SIZE.x, 40);
|
||||
bar.beginFill(TypingContentBG.COLOR_CONTENT_ALPHABET_BG, 1);
|
||||
bar.drawRect(0, CONTENT_Y + 40, GAME_SCREEN_SIZE.x, 50);
|
||||
bar.beginFill(TypingContentBG.COLOR_CONTENT_BG, 1);
|
||||
bar.drawRect(0, CONTENT_Y + 90, GAME_SCREEN_SIZE.x, 30);
|
||||
if(isTypingSentenceStage()) {
|
||||
bar.beginFill(TypingContentBG.COLOR_CONTENT_BG, 1);
|
||||
bar.drawRect(0, CONTENT_Y, GAME_SCREEN_SIZE.x, 46);
|
||||
bar.beginFill(TypingContentBG.COLOR_CONTENT_ALPHABET_BG, 1);
|
||||
bar.drawRect(0, CONTENT_Y + 46, GAME_SCREEN_SIZE.x, 30);
|
||||
bar.beginFill(TypingContentBG.COLOR_CONTENT_BG, 1);
|
||||
bar.drawRect(0, CONTENT_Y + 76, GAME_SCREEN_SIZE.x, 44);
|
||||
} else {
|
||||
bar.beginFill(TypingContentBG.COLOR_CONTENT_BG, 1);
|
||||
bar.drawRect(0, CONTENT_Y, GAME_SCREEN_SIZE.x, 40);
|
||||
bar.beginFill(TypingContentBG.COLOR_CONTENT_ALPHABET_BG, 1);
|
||||
bar.drawRect(0, CONTENT_Y + 40, GAME_SCREEN_SIZE.x, 50);
|
||||
bar.beginFill(TypingContentBG.COLOR_CONTENT_BG, 1);
|
||||
bar.drawRect(0, CONTENT_Y + 90, GAME_SCREEN_SIZE.x, 30);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,10 +35,11 @@ class TypingTest {
|
||||
|
||||
let TYPING_CONTENT_Y = 320;
|
||||
|
||||
if(isTypingWordStage())
|
||||
textStyleBasic.font = "bold 84px Arial";
|
||||
else // Sentence stage
|
||||
if( (isKoreanTypingStage() && isTypingSentenceStage())
|
||||
|| (isEnglishTypingStage() && isTypingSentenceStage()) )
|
||||
textStyleBasic.font = "bold 48px Arial";
|
||||
else
|
||||
textStyleBasic.font = "bold 84px Arial";
|
||||
|
||||
this.textTypingContent = game.add.text(
|
||||
game.world.centerX, TYPING_CONTENT_Y,
|
||||
@@ -48,7 +49,7 @@ class TypingTest {
|
||||
.addColor(TypingTest.COLOR_CONTENT_INPUT, 0);
|
||||
this.textTypingContent.anchor.set(0.5);
|
||||
|
||||
let TYPING_OFFSET_Y = 100;
|
||||
let TYPING_OFFSET_Y = 90;
|
||||
textStyleBasic.font = "32px Arial";
|
||||
|
||||
let textDoneColor = [ '#99994d', '#77774d', '#66664d' ];
|
||||
|
||||
Reference in New Issue
Block a user