Commit 17ba377f authored by 李维's avatar 李维

dev commit

parent 808f229f
......@@ -2,7 +2,7 @@
"name": "ng-template-generator",
"version": "0.0.1",
"scripts": {
"start": "ng serve",
"start": "ng serve --host 0.0.0.0",
"build": "ng build --build--optimizer --aot --base-href /JGT/v3/",
"publish": "node ./bin/publish.js",
"ng": "ng",
......
......@@ -411,6 +411,7 @@ export class PlayComponent implements OnInit, OnDestroy {
let le = createWord(letttes[i-1], baseX, baseY)
this.subscribeMapDownEvent(le.id, async ()=>{
if(!this.m_canInput) {
this.g_enableMapDown = true;
return
}
let target = this.g_cartoon.getCartoonElement(this.m_currentInput)
......@@ -579,7 +580,8 @@ export class PlayComponent implements OnInit, OnDestroy {
bgRight.ref.alpha = 0;
bgFocus.ref.alpha = 0;
bgWrong.ref.alpha = 0;
text.ref.fontColor = "#b17d5a"
text.ref.fontColor = "#b17d5a";
container.modified = false;
break;
case "disable":
bgInit.ref.alpha = 0;
......@@ -587,7 +589,8 @@ export class PlayComponent implements OnInit, OnDestroy {
bgRight.ref.alpha = 0;
bgFocus.ref.alpha = 0;
bgWrong.ref.alpha = 0;
text.ref.fontColor = "#b17d5a"
text.ref.fontColor = "#b17d5a";
container.modified = false;
break;
case "right":
bgInit.ref.alpha = 0;
......@@ -603,7 +606,8 @@ export class PlayComponent implements OnInit, OnDestroy {
bgRight.ref.alpha = 0;
bgFocus.ref.alpha = 1;
bgWrong.ref.alpha = 0;
text.ref.fontColor = "#ffffff"
text.ref.fontColor = "#ffffff";
container.modified = false;
break;
case "wrong":
bgInit.ref.alpha = 0;
......@@ -611,7 +615,8 @@ export class PlayComponent implements OnInit, OnDestroy {
bgRight.ref.alpha = 0;
bgFocus.ref.alpha = 0;
bgWrong.ref.alpha = 1;
text.ref.fontColor = "#ffffff"
text.ref.fontColor = "#ffffff";
container.modified = false;
break;
}
}
......@@ -620,6 +625,7 @@ export class PlayComponent implements OnInit, OnDestroy {
if(status) {
container.switchStatus("focus")
} else {
console.log("3f")
container.switchStatus("right")
}
if(status) {
......@@ -633,13 +639,15 @@ export class PlayComponent implements OnInit, OnDestroy {
}
return true
}
container.modified = false;
container.setContentText = (letter) => {
text.ref.text = letter?letter:"";
if(!this.checkAllFill()) {
let btnSub = this.g_cartoon.getCartoonElement("button_submit")
btnSub.switchActive(true)
}
container.modified = true;
}
container.getContentText = () => {
......@@ -650,32 +658,70 @@ export class PlayComponent implements OnInit, OnDestroy {
container.active(false);
if(letter != container.getContentText()) {
this.m_hasErrorLetter = true;
container.switchStatus("wrong");
if(!this.m_hasActiveBlock) {
this.m_hasActiveBlock = true;
this.m_currentInputIndex = groupIndex;
container.active(true)
console.log(this.m_currentQuestionIndex, groupIndex)
if(this.m_currentQuestionIndex == groupIndex) {
if(!this.m_hasActiveBlock) {
container.switchStatus("focus");
this.m_hasActiveBlock = true;
this.m_currentInputIndex = groupIndex;
container.active(true)
} else {
console.log("R")
container.switchStatus("wrong");
}
} else {
container.switchStatus("wrong");
}
} else {
container.isCorrect = true;
container.switchStatus("right")
if(this.m_currentInputIndex == groupIndex) {
console.log("V")
container.switchStatus("right")
} else {
container.switchStatus("disable")
}
}
}
container.checkWhenSwitchQuestion = (withRed, fromIndex, groupIndex, contentSaved?) => {
container.active(false);
// container.active(false);
console.log(groupIndex, this.m_currentQuestionIndex)
if(groupIndex!= this.m_currentQuestionIndex) {
if(container.getContentText() == "") {
container.switchStatus("init")
} else {
container.switchStatus("disable")
if(this.m_submitedTimes == 0) {
console.log("DVDVDVDV")
container.switchStatus("disable")
} else {
console.log("modified", container.modified)
if(container.isCorrect || container.modified) {
container.switchStatus("disable")
} else {
container.switchStatus("wrong")
}
}
}
} else {
container.switchStatus("right")
if(!this.m_hasActiveBlock) {
this.m_hasActiveBlock = true;
container.active(true)
console.log("A")
if(this.m_submitedTimes == 0 ) {
container.switchStatus("right")
if(!this.m_hasActiveBlock) {
this.m_hasActiveBlock = true;
container.active(true)
}
} else {
if(container.isCorrect) {
container.switchStatus("right")
} else {
container.switchStatus("wrong")
}
if(!this.m_hasActiveBlock && !container.isCorrect) {
this.m_hasActiveBlock = true;
container.active(true)
}
}
}
}
......@@ -762,10 +808,10 @@ export class PlayComponent implements OnInit, OnDestroy {
submit.switchActive = (status) => {
if(status) {
submit.ref.alpha = 1;
this.m_canInput = false;
// this.m_canInput = false;
} else {
submit.ref.alpha = 0;
this.m_canInput = true;
// this.m_canInput = true;
}
}
......@@ -851,9 +897,10 @@ export class PlayComponent implements OnInit, OnDestroy {
// submit响应事件,会标红错误
updateStatusByGroupIndex(index) {
console.log("DVDVDVVVVVVVVVVVVVVVVV")
let blocks = this.m_blockGroup[index];
this.m_hasErrorLetter = false;
blocks.forEach((item, index) => {
blocks.forEach((item, i) => {
item.checkStatus(true, index)
});
......@@ -875,6 +922,7 @@ export class PlayComponent implements OnInit, OnDestroy {
if(!blocks[this.m_currentInputIndex]) {
return;
}
let checkNextActive = () => {
// 当遇到绿色块 或者 索引小于题目数量时,循环
let count = 0;
......@@ -883,6 +931,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.m_currentInput = null;
this.m_currentInputIndex++;
count++;
console.log(blocks[this.m_currentInputIndex]?blocks[this.m_currentInputIndex].isCorrect:"-")
} while(count<blocks.length && this.m_currentInputIndex<blocks.length && blocks[this.m_currentInputIndex].isCorrect)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment