Add: StageTimer
This commit is contained in:
@@ -52,6 +52,16 @@ var TypingExamination = {
|
||||
this.averageTypingSpeedText = new AverageTypingSpeed();
|
||||
// this.contentProgressText = new ContentProgress();
|
||||
|
||||
this.stageTimer = new StageTimer(
|
||||
TypingExamination.GAME_TIME_SEC,
|
||||
(function() {
|
||||
this.setClickEnable(false);
|
||||
this.timeOver();
|
||||
}).bind(this)
|
||||
);
|
||||
this.stageTimer.setDisplayType(StageTimer.DISPLAY_TYPE_NON_SEC);
|
||||
|
||||
|
||||
|
||||
// typing content
|
||||
var typingContentBG = new TypingContentBG();
|
||||
@@ -66,7 +76,11 @@ var TypingExamination = {
|
||||
var TYPING_CONTENT_Y = 340;
|
||||
var RECORD_POSITION_X = 900;
|
||||
|
||||
textStyleBasic.font = "bold 38px Arial";
|
||||
var FONT_SIZE = 24;
|
||||
var BIG_FONT_SIZE = 32;
|
||||
var TYPING_TEXT_OFFSET_HEIGHT = 40;
|
||||
|
||||
// textStyleBasic.font = "bold 38px Arial";
|
||||
// textStyleBasic.backgroundColor = "rgba(0, 0, 0, 0.25)";
|
||||
|
||||
|
||||
@@ -78,6 +92,7 @@ var TypingExamination = {
|
||||
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2)
|
||||
.addColor(TypingExamination.COLOR_CONTENT_INPUT, 0);
|
||||
this.textTypingContent.anchor.set(0, 0.5);
|
||||
this.textTypingContent.fontSize = BIG_FONT_SIZE;
|
||||
|
||||
textStyleBasic.backgroundColor = null;
|
||||
this.textTypingLine = game.add.text(
|
||||
@@ -92,13 +107,13 @@ var TypingExamination = {
|
||||
|
||||
var TYPING_OFFSET_Y = 70;
|
||||
var TYPING_PREVIEW_OFFSET_Y = 70;
|
||||
var TYPING_TEXT_OFFSET_HEIGHT = 50;
|
||||
textStyleBasic.font = "38px Arial";
|
||||
textStyleBasic.backgroundColor = null;
|
||||
|
||||
|
||||
// done text
|
||||
var textDoneColor = [ '#99994d', '#77774d', '#66664d' ];
|
||||
// var textDoneColor = [ '#99994d', '#88884d', '#77774d', '#66664d' ];
|
||||
var textDoneColor = [ '#dddd4d', '#dddd4d', '#dddd4d', '#dddd4d' ];
|
||||
this.textTypingContentsDone = [];
|
||||
this.textTypingRecordsDone = [];
|
||||
for(var i = 0; i < TypingExamination.TYPING_CONTENT_DONE_COUNT; i++) {
|
||||
@@ -106,21 +121,24 @@ var TypingExamination = {
|
||||
TYPING_CONTENT_X, TYPING_CONTENT_Y - TYPING_OFFSET_Y - i * TYPING_TEXT_OFFSET_HEIGHT,
|
||||
"", textStyleBasic
|
||||
)
|
||||
// .setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2)
|
||||
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2)
|
||||
.addColor(textDoneColor[i], 0);
|
||||
this.textTypingContentsDone[i].anchor.set(0, 0.5);
|
||||
this.textTypingContentsDone[i].fontSize = FONT_SIZE;
|
||||
|
||||
this.textTypingRecordsDone[i] = game.add.text(
|
||||
RECORD_POSITION_X, TYPING_CONTENT_Y - TYPING_OFFSET_Y - i * TYPING_TEXT_OFFSET_HEIGHT,
|
||||
"", textStyleBasic
|
||||
)
|
||||
// .setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2)
|
||||
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2)
|
||||
.addColor(textDoneColor[i], 0);
|
||||
this.textTypingRecordsDone[i].anchor.set(0.5);
|
||||
this.textTypingRecordsDone[i].fontSize = FONT_SIZE;
|
||||
}
|
||||
|
||||
// preview text
|
||||
var textPreviewColor = [ '#999999', '#888888', '#777777' ];
|
||||
// var textPreviewColor = [ '#999999', '#888888', '#777777', '#666666' ];
|
||||
var textPreviewColor = [ '#dddddd', '#dddddd', '#dddddd', '#dddddd' ];
|
||||
this.textTypingContentPreview = [];
|
||||
for(var i = 0; i < TypingExamination.TYPING_CONTENT_PREVIEW_COUNT; i++) {
|
||||
this.textTypingContentPreview[i] = game.add.text(
|
||||
@@ -128,18 +146,19 @@ var TypingExamination = {
|
||||
TYPING_CONTENT_Y + TYPING_OFFSET_Y + TYPING_PREVIEW_OFFSET_Y + i * TYPING_TEXT_OFFSET_HEIGHT,
|
||||
"", textStyleBasic
|
||||
)
|
||||
// .setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2)
|
||||
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2)
|
||||
.addColor(textPreviewColor[i], 0);
|
||||
this.textTypingContentPreview[i].anchor.set(0, 0.5);
|
||||
this.textTypingContentPreview[i].fontSize = FONT_SIZE;
|
||||
}
|
||||
|
||||
|
||||
// input text
|
||||
this.inputTextContent = new InputTypeText(TYPING_CONTENT_X, TYPING_CONTENT_Y + 70);
|
||||
this.inputTextContent = new InputTypeText(TYPING_CONTENT_X - 10, TYPING_CONTENT_Y + 70);
|
||||
this.inputTextContent.anchor.set(0, 0.5);
|
||||
this.inputTextContent.canvasInput.value('');
|
||||
this.inputTextContent.canvasInput.focus();
|
||||
this.inputTextContent.canvasInput.fontSize(38);
|
||||
this.inputTextContent.canvasInput.fontSize(BIG_FONT_SIZE);
|
||||
this.inputTextContent.canvasInput.placeHolder("");
|
||||
// inputTextContent.canvasInput._onkeydown = this.checkInputText;
|
||||
// inputTextContent.canvasInput._onkeyup = function() {
|
||||
@@ -226,11 +245,13 @@ var TypingExamination = {
|
||||
this.showTypingExaminationContents();
|
||||
this.showPlayingWordNumber();
|
||||
// this.updateKeyboard();
|
||||
|
||||
this.stageTimer.start();
|
||||
},
|
||||
|
||||
timeOver: function() {
|
||||
var timeOverText = new TimeOverText();
|
||||
this.stopAndGoResult();
|
||||
// this.stopAndGoResult();
|
||||
},
|
||||
|
||||
gameOver: function() {
|
||||
@@ -826,10 +847,12 @@ var TypingExamination = {
|
||||
}
|
||||
|
||||
|
||||
TypingExamination.GAME_TIME_SEC = 60 * 5; // 5 minutes
|
||||
|
||||
TypingExamination.SPACE_INDICATOR = " · ";
|
||||
|
||||
TypingExamination.TYPING_CONTENT_PREVIEW_COUNT = 3; // 3;
|
||||
TypingExamination.TYPING_CONTENT_DONE_COUNT = 3; // 3;
|
||||
TypingExamination.TYPING_CONTENT_PREVIEW_COUNT = 4; // 3;
|
||||
TypingExamination.TYPING_CONTENT_DONE_COUNT = 4; // 3;
|
||||
TypingExamination.TYPING_COUNT_PLUS_ENTER = 1;
|
||||
|
||||
TypingExamination.OFFSET_RIGHT_ALIGN = 10;
|
||||
|
||||
Reference in New Issue
Block a user