Commit cef31024 authored by 李维's avatar 李维

Bug fix

parent d2e528a9
...@@ -601,7 +601,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -601,7 +601,7 @@ export class PlayComponent implements OnInit, OnDestroy {
bgRight.ref.alpha = 0; bgRight.ref.alpha = 0;
bgFocus.ref.alpha = 1; bgFocus.ref.alpha = 1;
bgWrong.ref.alpha = 0; bgWrong.ref.alpha = 0;
text.ref.fontColor = "#b17d5a" text.ref.fontColor = "#ffffff"
break; break;
case "wrong": case "wrong":
bgInit.ref.alpha = 0; bgInit.ref.alpha = 0;
...@@ -616,11 +616,9 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -616,11 +616,9 @@ export class PlayComponent implements OnInit, OnDestroy {
container.active = (status=false) => { container.active = (status=false) => {
if(status) { if(status) {
if(container.getContentText() == "") {
container.switchStatus("focus") container.switchStatus("focus")
}
} else { } else {
container.switchStatus("disable") container.switchStatus("right")
} }
if(status) { if(status) {
this.m_currentInput = `block_${x}_${y}`; this.m_currentInput = `block_${x}_${y}`;
...@@ -642,6 +640,10 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -642,6 +640,10 @@ export class PlayComponent implements OnInit, OnDestroy {
container.setContentText = (letter) => { container.setContentText = (letter) => {
text.ref.text = letter?letter:""; text.ref.text = letter?letter:"";
if(!this.checkAllFill()) {
let btnSub = this.g_cartoon.getCartoonElement("button_submit")
btnSub.switchActive(true)
}
} }
container.getContentText = () => { container.getContentText = () => {
...@@ -673,41 +675,50 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -673,41 +675,50 @@ export class PlayComponent implements OnInit, OnDestroy {
container.checkWhenSwitchQuestion = (withRed, fromIndex, groupIndex, contentSaved?) => { container.checkWhenSwitchQuestion = (withRed, fromIndex, groupIndex, contentSaved?) => {
container.active(false); container.active(false);
// 没有点击提交就切换,清空 // 没有点击提交就切换,清空
if(!this.m_submited && questionIndex==fromIndex) { // if(!this.m_submited && questionIndex==fromIndex) {
container.setContentText(contentSaved) // container.setContentText(contentSaved)
} // }
if(groupIndex!= this.m_currentQuestionIndex) { if(groupIndex!= this.m_currentQuestionIndex) {
if(container.getContentText() == "") { if(container.getContentText() == "") {
container.switchStatus("init") container.switchStatus("init")
} else if(letter != container.getContentText()) {
container.switchStatus("wrong")
} else { } else {
container.switchStatus("right") container.switchStatus("disable")
} }
// if(container.getContentText() == "") {
// container.switchStatus("init")
// } else if(letter != container.getContentText()) {
// container.switchStatus("wrong")
// } else {
// container.switchStatus("right")
// }
} else { } else {
if(container.getContentText() == "") { // if(container.getContentText() == "") {
container.switchStatus("right"); // container.switchStatus("right");
if(!this.m_hasActiveBlock) { // } else {
this.m_hasActiveBlock = true; // container.switchStatus("right");
container.active(true) // this.m_hasErrorLetter = true;
} // container.switchStatus("wrong");
} else if(withRed && (letter != container.getContentText())) { // if(!this.m_hasActiveBlock) {
this.m_hasErrorLetter = true; // this.m_hasActiveBlock = true;
container.switchStatus("wrong"); // this.m_currentInputIndex = groupIndex;
// container.active(true)
// }
// }
container.switchStatus("right")
if(!this.m_hasActiveBlock) { if(!this.m_hasActiveBlock) {
this.m_hasActiveBlock = true; this.m_hasActiveBlock = true;
this.m_currentInputIndex = groupIndex;
container.active(true) container.active(true)
} }
} }
} }
}
this.subscribeMapDownEvent(container.id, ()=>{ this.subscribeMapDownEvent(container.id, ()=>{
if(container.canSetActive()) { if(container.canSetActive()) {
if(this.m_currentInput) { if(this.m_currentInput) {
let currentAcitveNode = this.g_cartoon.getCartoonElement(this.m_currentInput) let currentAcitveNode = this.g_cartoon.getCartoonElement(this.m_currentInput)
currentAcitveNode.active(false) currentAcitveNode.active(false)
this.m_currentInputIndex = li
console.log(this.m_currentInputIndex)
} }
container.active(true); container.active(true);
} }
...@@ -749,11 +760,12 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -749,11 +760,12 @@ export class PlayComponent implements OnInit, OnDestroy {
this.m_blockFirstSubmit[i] = true; this.m_blockFirstSubmit[i] = true;
} }
let indexArr = new Array(this.g_formData.dataArray.length).fill(0)
for(let j=0; j<rolNum; j++) { for(let j=0; j<rolNum; j++) {
for(let i=0; i<colNum; i++) { for(let i=0; i<colNum; i++) {
let qi = this.g_formData.grid[j][i].index let qi = this.g_formData.grid[j][i].index
if(qi>=0) { if(qi>=0) {
let newBlock = createBlock(this.g_formData.grid[j][i].text, qi, i, sX+i*step, sY+j*step, 900/colNum-5, 900/colNum-5) let newBlock = createBlock(this.g_formData.grid[j][i].text, qi, indexArr[qi]++, sX+i*step, sY+j*step, 900/colNum-5, 900/colNum-5)
this.m_wordAll[qi] += this.g_formData.grid[j][i].text this.m_wordAll[qi] += this.g_formData.grid[j][i].text
this.m_allBlocks.push(newBlock) this.m_allBlocks.push(newBlock)
element.ref.addChild(newBlock.ref) element.ref.addChild(newBlock.ref)
...@@ -761,6 +773,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -761,6 +773,7 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
} }
} }
console.log(indexArr)
this.render(element.ref) this.render(element.ref)
} }
...@@ -830,7 +843,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -830,7 +843,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.m_blockGroup.forEach((group, groupIndex) => { this.m_blockGroup.forEach((group, groupIndex) => {
group.forEach((block, index) => { group.forEach((block, index) => {
block.checkWhenSwitchQuestion(true, fromIndex, groupIndex, this.m_wordLetterInputCatch[index]?this.m_wordLetterInputCatch[index]:"") block.checkWhenSwitchQuestion(false, fromIndex, groupIndex, this.m_wordLetterInputCatch[index]?this.m_wordLetterInputCatch[index]:"")
}); });
}); });
...@@ -907,26 +920,34 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -907,26 +920,34 @@ export class PlayComponent implements OnInit, OnDestroy {
if(this.m_currentInputIndex>=blocks.length) { if(this.m_currentInputIndex>=blocks.length) {
// 没有获取焦点的输入框,启用提交功能 // 没有获取焦点的输入框,启用提交功能
if(!this.m_hasActiveBlock) { // if(!this.m_hasActiveBlock) {
let btn = this.g_cartoon.getCartoonElement("button_submit") // let btn = this.g_cartoon.getCartoonElement("button_submit")
btn.switchActive(true); // btn.switchActive(true);
} // }
// 切换当前输入从头开始 // 切换当前输入从头开始
this.m_currentInputIndex = -1; this.m_currentInputIndex = -1;
checkNextActive(); checkNextActive();
// 判断是否需要激活(绿色不需要激活,红色或者蓝色没有文字需要激活)
if(blocks[this.m_currentInputIndex].canSetActive()) {
blocks[this.m_currentInputIndex].active(true)
} }
} else {
// 判断是否需要激活(绿色不需要激活,红色或者蓝色没有文字需要激活) // 判断是否需要激活(绿色不需要激活,红色或者蓝色没有文字需要激活)
if(blocks[this.m_currentInputIndex].canSetActive()) { if(blocks[this.m_currentInputIndex].canSetActive()) {
blocks[this.m_currentInputIndex].active(true) blocks[this.m_currentInputIndex].active(true)
} }
} }
}
checkAllFill() {
let empty = false;
this.m_blockGroup.forEach(group => {
group.forEach(block => {
if(!empty) {
if(block.getContentText() == "") {
empty = true;
}
}
});
})
return empty;
}
......
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