Fix: font, font family
This commit is contained in:
@@ -74,10 +74,9 @@ var TypingExamination = {
|
||||
|
||||
var TYPING_CONTENT_X = 60;
|
||||
var TYPING_CONTENT_Y = 340;
|
||||
var RECORD_POSITION_X = 900;
|
||||
var RECORD_POSITION_X = 960;
|
||||
|
||||
var FONT_SIZE = 24;
|
||||
var BIG_FONT_SIZE = 32;
|
||||
var FONT_SIZE = 32;
|
||||
var TYPING_TEXT_OFFSET_HEIGHT = 40;
|
||||
|
||||
// textStyleBasic.font = "bold 38px Arial";
|
||||
@@ -85,6 +84,7 @@ var TypingExamination = {
|
||||
|
||||
|
||||
// current text
|
||||
textStyleBasic.font = "38px Courier New";
|
||||
this.textTypingContent = game.add.text(
|
||||
TYPING_CONTENT_X, TYPING_CONTENT_Y,
|
||||
"", textStyleBasic
|
||||
@@ -92,31 +92,33 @@ 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;
|
||||
this.textTypingContent.fontSize = FONT_SIZE;
|
||||
|
||||
textStyleBasic.font = "38px Arial";
|
||||
textStyleBasic.backgroundColor = null;
|
||||
this.textTypingLine = game.add.text(
|
||||
RECORD_POSITION_X, TYPING_CONTENT_Y,
|
||||
"", textStyleBasic
|
||||
)
|
||||
// .setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2)
|
||||
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||
// .addColor(TypingExamination.COLOR_CONTENT_INPUT, 0);
|
||||
this.textTypingLine.anchor.set(0.5);
|
||||
this.textTypingLine.anchor.set(1, 0.5);
|
||||
|
||||
|
||||
|
||||
var TYPING_OFFSET_Y = 70;
|
||||
var TYPING_PREVIEW_OFFSET_Y = 70;
|
||||
textStyleBasic.font = "38px Arial";
|
||||
// textStyleBasic.font = "38px Arial";
|
||||
textStyleBasic.backgroundColor = null;
|
||||
|
||||
|
||||
// done text
|
||||
// var textDoneColor = [ '#99994d', '#88884d', '#77774d', '#66664d' ];
|
||||
var textDoneColor = [ '#dddd4d', '#dddd4d', '#dddd4d', '#dddd4d' ];
|
||||
var textDoneColor = [ '#99994d', '#88884d', '#77774d', '#66664d' ];
|
||||
// var textDoneColor = [ '#99994d', '#99994d', '#99994d', '#99994d' ];
|
||||
this.textTypingContentsDone = [];
|
||||
this.textTypingRecordsDone = [];
|
||||
for(var i = 0; i < TypingExamination.TYPING_CONTENT_DONE_COUNT; i++) {
|
||||
textStyleBasic.font = "38px Courier New";
|
||||
this.textTypingContentsDone[i] = game.add.text(
|
||||
TYPING_CONTENT_X, TYPING_CONTENT_Y - TYPING_OFFSET_Y - i * TYPING_TEXT_OFFSET_HEIGHT,
|
||||
"", textStyleBasic
|
||||
@@ -126,21 +128,23 @@ var TypingExamination = {
|
||||
this.textTypingContentsDone[i].anchor.set(0, 0.5);
|
||||
this.textTypingContentsDone[i].fontSize = FONT_SIZE;
|
||||
|
||||
textStyleBasic.font = "38px Arial";
|
||||
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)
|
||||
.addColor(textDoneColor[i], 0);
|
||||
this.textTypingRecordsDone[i].anchor.set(0.5);
|
||||
this.textTypingRecordsDone[i].anchor.set(1, 0.5);
|
||||
this.textTypingRecordsDone[i].fontSize = FONT_SIZE;
|
||||
}
|
||||
|
||||
// preview text
|
||||
// var textPreviewColor = [ '#999999', '#888888', '#777777', '#666666' ];
|
||||
var textPreviewColor = [ '#dddddd', '#dddddd', '#dddddd', '#dddddd' ];
|
||||
var textPreviewColor = [ '#999999', '#888888', '#777777', '#666666' ];
|
||||
// var textPreviewColor = [ '#999999', '#999999', '#999999', '#999999' ];
|
||||
this.textTypingContentPreview = [];
|
||||
for(var i = 0; i < TypingExamination.TYPING_CONTENT_PREVIEW_COUNT; i++) {
|
||||
textStyleBasic.font = "38px Courier New";
|
||||
this.textTypingContentPreview[i] = game.add.text(
|
||||
TYPING_CONTENT_X,
|
||||
TYPING_CONTENT_Y + TYPING_OFFSET_Y + TYPING_PREVIEW_OFFSET_Y + i * TYPING_TEXT_OFFSET_HEIGHT,
|
||||
@@ -154,11 +158,14 @@ var TypingExamination = {
|
||||
|
||||
|
||||
// input text
|
||||
this.inputTextContent = new InputTypeText(TYPING_CONTENT_X - 10, TYPING_CONTENT_Y + 70);
|
||||
this.inputTextContent = new InputText(TYPING_CONTENT_X - 10, TYPING_CONTENT_Y + 70, 800, 50);
|
||||
this.inputTextContent.anchor.set(0, 0.5);
|
||||
this.inputTextContent.canvasInput.value('');
|
||||
this.inputTextContent.canvasInput.focus();
|
||||
this.inputTextContent.canvasInput.fontSize(BIG_FONT_SIZE);
|
||||
this.inputTextContent.canvasInput.fontSize(FONT_SIZE);
|
||||
// this.inputTextContent.canvasInput.fontWeight("");
|
||||
this.inputTextContent.canvasInput.fontFamily("Courier New");
|
||||
// this.inputTextContent.canvasInput.fontFamily("Courier New");
|
||||
this.inputTextContent.canvasInput.placeHolder("");
|
||||
// inputTextContent.canvasInput._onkeydown = this.checkInputText;
|
||||
// inputTextContent.canvasInput._onkeyup = function() {
|
||||
|
||||
@@ -31,7 +31,6 @@ var Loading = {
|
||||
|
||||
// Hand.loadResources();
|
||||
Animal.loadResources();
|
||||
// game.load.text("literature", "./../../game/typing/literature_list/korean_national_anthem.txt");
|
||||
|
||||
|
||||
// game.load.image('a', '../../../resources/image/icon/fullscreen_white.png');
|
||||
|
||||
@@ -128,7 +128,31 @@ TypingTextManager.prototype.makeShortSentences = function(sentence) {
|
||||
for(var i = 0; i < wordCount; i++) {
|
||||
// console.log(words[i]);
|
||||
// console.log(shortSentences[sentenceIndex].length);
|
||||
// console.log(words[i]);
|
||||
|
||||
|
||||
|
||||
var wordLength = words[i].length;
|
||||
if(wordLength > TypingTextManager.SENTENCE_MAX_CHARACTER) {
|
||||
console.log(words[i]);
|
||||
if(shortSentences[sentenceIndex].legnth > 0)
|
||||
sentenceIndex++;
|
||||
|
||||
var loopCount = Math.ceil(wordLength / TypingTextManager.SENTENCE_MAX_CHARACTER);
|
||||
|
||||
for(var j = 0; j < loopCount; j++) {
|
||||
var startIndex = j * TypingTextManager.SENTENCE_MAX_CHARACTER;
|
||||
var endIndex = (j + 1) * TypingTextManager.SENTENCE_MAX_CHARACTER;
|
||||
var partialText = words[i].substring(startIndex, endIndex);
|
||||
// console.log(partialText);
|
||||
shortSentences[sentenceIndex] = partialText;
|
||||
sentenceIndex++;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(shortSentences[sentenceIndex].length + words[i].length < TypingTextManager.SENTENCE_MAX_CHARACTER)
|
||||
if(i < wordCount - 1)
|
||||
shortSentences[sentenceIndex] = shortSentences[sentenceIndex].concat(words[i], " ");
|
||||
@@ -181,4 +205,4 @@ TypingTextManager.ENGLISH_LETTER_RIGHT = [
|
||||
];
|
||||
|
||||
|
||||
TypingTextManager.SENTENCE_MAX_CHARACTER = 35; // 27;
|
||||
TypingTextManager.SENTENCE_MAX_CHARACTER = 28;
|
||||
Reference in New Issue
Block a user