Commit 29a3ae94 authored by 李维's avatar 李维

dev commit

parent 00a8b820
...@@ -140,6 +140,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -140,6 +140,7 @@ export class PlayComponent implements OnInit, OnDestroy {
m_submitedTimes = 0; m_submitedTimes = 0;
m_wordLetterInputCatch = []; m_wordLetterInputCatch = [];
m_canInput = true; m_canInput = true;
m_totalScrollHeight = 0;
// ------------------------------------ // ------------------------------------
...@@ -666,14 +667,14 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -666,14 +667,14 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
container.checkStatus = (withRed=false, groupIndex) => { container.checkStatus = (withRed=false, groupIndex) => {
container.active(false); // container.active(false);
if(letter != container.getContentText()) { if(letter != container.getContentText()) {
this.m_hasErrorLetter = true; this.m_hasErrorLetter = true;
if(this.m_currentQuestionIndex == groupIndex) { if(this.m_currentQuestionIndex == groupIndex) {
if(!this.m_hasActiveBlock) { if(!this.m_hasActiveBlock) {
container.switchStatus("focus"); container.switchStatus("focus");
this.m_hasActiveBlock = true; this.m_hasActiveBlock = true;
this.m_currentInputIndex = groupIndex; this.m_currentQuestionIndex = groupIndex;
container.active(true) container.active(true)
} else { } else {
container.switchStatus("wrong"); container.switchStatus("wrong");
...@@ -683,7 +684,8 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -683,7 +684,8 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
} else { } else {
container.isCorrect = true; container.isCorrect = true;
if(this.m_currentInputIndex == groupIndex) { console.log(this.m_currentQuestionIndex + " - " + groupIndex)
if(this.m_currentQuestionIndex == groupIndex) {
container.switchStatus("right") container.switchStatus("right")
} else { } else {
container.switchStatus("disable") container.switchStatus("disable")
...@@ -870,7 +872,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -870,7 +872,7 @@ export class PlayComponent implements OnInit, OnDestroy {
let checkMiddle = this.g_cartoon.createCartoonElementImageFunc(`checkpannel_checnk_middle`, "check_middle", (w, h)=>{ let checkMiddle = this.g_cartoon.createCartoonElementImageFunc(`checkpannel_checnk_middle`, "check_middle", (w, h)=>{
return { return {
sx: 1 * bgMiddle.ref.scaleX, sx: 1,
sy: 1, sy: 1,
} }
}, (w, h)=>{ }, (w, h)=>{
...@@ -883,7 +885,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -883,7 +885,7 @@ export class PlayComponent implements OnInit, OnDestroy {
let checkTop = this.g_cartoon.createCartoonElementImageFunc(`checkpannel_checnk_top`, "check_top", (w, h)=>{ let checkTop = this.g_cartoon.createCartoonElementImageFunc(`checkpannel_checnk_top`, "check_top", (w, h)=>{
return { return {
sx: 1 * bgMiddleMask.ref.scaleX, sx: 1,
sy: 186 / h, sy: 186 / h,
} }
}, (w, h)=>{ }, (w, h)=>{
...@@ -896,7 +898,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -896,7 +898,7 @@ export class PlayComponent implements OnInit, OnDestroy {
let checkBottom = this.g_cartoon.createCartoonElementImageFunc(`checkpannel_checnk_bottom`, "check_bottom", (w, h)=>{ let checkBottom = this.g_cartoon.createCartoonElementImageFunc(`checkpannel_checnk_bottom`, "check_bottom", (w, h)=>{
return { return {
sx: 1 * bgMiddleMask.ref.scaleX, sx: 1,
sy: 79 / h, sy: 79 / h,
} }
}, (w, h)=>{ }, (w, h)=>{
...@@ -958,7 +960,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -958,7 +960,7 @@ export class PlayComponent implements OnInit, OnDestroy {
if(progress>1) { if(progress>1) {
progress = 1 progress = 1
} }
this.g_cartoon.getCartoonElement("slider-background").initSlider(scrollContent.windowHeight, 985*5, progress) this.g_cartoon.getCartoonElement("slider-background").initSlider(scrollContent.windowHeight, this.m_totalScrollHeight, progress)
}, ()=>{ }, ()=>{
this.g_enableMapUp = true; this.g_enableMapUp = true;
this.g_enableMapDown = true; this.g_enableMapDown = true;
...@@ -1164,7 +1166,9 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1164,7 +1166,9 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
showCheckPannel(checkResult) { showCheckPannel(checkResult) {
let lastY = 0
const creatItem = (height, withSplit, data) => { const creatItem = (height, withSplit, data) => {
let padding = 30;
let scrollContent = this.g_cartoon.getCartoonElement("check_scroll_pannel") let scrollContent = this.g_cartoon.getCartoonElement("check_scroll_pannel")
let totalHeight = height let totalHeight = height
let text = this.g_cartoon.createCartoonElementLabel("text", data.text, "DroidSansFallback", "#FFFFFF", 48) let text = this.g_cartoon.createCartoonElementLabel("text", data.text, "DroidSansFallback", "#FFFFFF", 48)
...@@ -1174,13 +1178,17 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1174,13 +1178,17 @@ export class PlayComponent implements OnInit, OnDestroy {
text.ref.refreshSize(); text.ref.refreshSize();
text.ref.x = 0 text.ref.x = 0
text.ref.baseY = totalHeight text.ref.baseY = totalHeight
console.log("=====================")
console.log("文字高度", (text.ref.lineNum + 1) * 64)
totalHeight += (text.ref.lineNum + 1) * 64; totalHeight += (text.ref.lineNum + 1) * 64;
scrollContent.ref.addChild(text.ref) scrollContent.ref.addChild(text.ref)
let wordColorBG = this.g_cartoon.createCartoonElementShapeRect("eeeeee", 360, 64, data.right?"#007b3e":"#d71818"); let wordColorBG = this.g_cartoon.createCartoonElementShapeRect("eeeeee", 360, 64, data.right?"#007b3e":"#d71818");
wordColorBG.ref.radius = 10 wordColorBG.ref.radius = 10
wordColorBG.ref.y = totalHeight + 64 wordColorBG.ref.y = totalHeight + padding + 64 / 2
totalHeight += 64*2; totalHeight += padding + 64;
console.log("单词高度", 64)
lastY = totalHeight + padding + 64 / 2;
let word = this.g_cartoon.createCartoonElementLabel("text-label", data.word, "DroidSansFallback", "#FFFFFF", 44) let word = this.g_cartoon.createCartoonElementLabel("text-label", data.word, "DroidSansFallback", "#FFFFFF", 44)
word.ref.x = 360 / 2 word.ref.x = 360 / 2
...@@ -1200,7 +1208,9 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1200,7 +1208,9 @@ export class PlayComponent implements OnInit, OnDestroy {
y: totalHeight + 50 + 60 y: totalHeight + 50 + 60
} }
}) })
totalHeight += 150; console.log("正确提示", 120)
lastY = totalHeight + 50 + 60
totalHeight += 120 + padding;
let word = this.g_cartoon.createCartoonElementLabel("text-label", data.rightWord, "DroidSansFallback", "#ffe9b1", 44) let word = this.g_cartoon.createCartoonElementLabel("text-label", data.rightWord, "DroidSansFallback", "#ffe9b1", 44)
word.ref.x = 0 word.ref.x = 0
...@@ -1222,10 +1232,9 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1222,10 +1232,9 @@ export class PlayComponent implements OnInit, OnDestroy {
y: totalHeight + 50 y: totalHeight + 50
} }
}) })
totalHeight += 60; totalHeight += padding + 10;
scrollContent.ref.addChild(splitLine.ref); scrollContent.ref.addChild(splitLine.ref);
} }
totalHeight += 20;
return totalHeight return totalHeight
} }
...@@ -1235,12 +1244,15 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1235,12 +1244,15 @@ export class PlayComponent implements OnInit, OnDestroy {
let totalHeight = 0; let totalHeight = 0;
let totalNum = checkResult.length; let totalNum = checkResult.length;
lastY = 0
checkResult.forEach((element, index) => { checkResult.forEach((element, index) => {
totalHeight = creatItem(totalHeight, !(index==(totalNum-1)), element) totalHeight = creatItem(totalHeight, !(index==(totalNum-1)), element)
}); });
sliderBG.initSlider(scrollContent.windowHeight, 985*5, 0)
let checkPannel = this.g_cartoon.getCartoonElement("checkpannel_container"); let checkPannel = this.g_cartoon.getCartoonElement("checkpannel_container");
this.m_totalScrollHeight = lastY;
console.log(totalHeight)
sliderBG.initSlider(scrollContent.windowHeight, lastY * checkPannel.ref.scaleY, 0)
checkPannel.in() checkPannel.in()
} }
...@@ -1270,32 +1282,18 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1270,32 +1282,18 @@ export class PlayComponent implements OnInit, OnDestroy {
const handleSubmit = async () => { const handleSubmit = async () => {
this.m_submitedTimes++; this.m_submitedTimes++;
if(this.m_submitedTimes>=2) {
let qp = this.g_cartoon.getCartoonElement("question_container")
let keyboard = this.g_cartoon.getCartoonElement("keyboard_container")
await qp.out()
await keyboard.out()
await this.showCheckPannel([
{text: "Across 1. running water flowing on the Earth", word: "storfish", right: true, rightWord: "Sea house"},
{text: "Across 1. running water flowing on the Earth", word: "storfish", right: false, rightWord: "Sea house"},
{text: "Across 1. running water flowing on the Earth", word: "storfish", right: false, rightWord: "Sea house"},
{text: "Across 1. running water flowing on the Earth", word: "storfish", right: false, rightWord: "Sea house"},
{text: "Across 1. running water flowing on the Earth", word: "storfish", right: false, rightWord: "Sea house"},
{text: "Across 1. running water flowing on the Earth", word: "storfish", right: false, rightWord: "Sea house"},
{text: "Across 1. running water flowing on the Earth", word: "storfish", right: false, rightWord: "Sea house"},
{text: "Across 1. running water flowing on the Earth", word: "storfish", right: false, rightWord: "Sea house"},
{text: "Across 1. running water flowing on the Earth", word: "storfish", right: false, rightWord: "Sea house"},
{text: "Across 1. running water flowing on the Earth", word: "storfish", right: false, rightWord: "Sea house"}
])
this.g_cartoon.getCartoonElement("background_mask").ref.alpha = 0
this.g_enableMapDown = true;
}
this.m_currentInputIndex = 0; this.m_currentInputIndex = 0;
let hasIncorrect = false; let result = [];
let status = false; let status = false;
let hasIncorrect = false;
this.m_hasActiveBlock = false; this.m_hasActiveBlock = false;
this.m_blockGroup.forEach((group, index) => { this.m_blockGroup.forEach((group, index) => {
status = this.updateStatusByGroupIndex(index) status = this.updateStatusByGroupIndex(index)
if(status) {
result.push({text: "Across 1. running water flowing on the Earth", word: "storfish", right: true, rightWord: ""})
} else {
result.push({text: "Across 1. running water flowing on the Earth", word: "storfish", right: false, rightWord: "Sea house"})
}
if(!hasIncorrect && !status) { if(!hasIncorrect && !status) {
hasIncorrect = true; hasIncorrect = true;
} }
...@@ -1305,6 +1303,17 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1305,6 +1303,17 @@ export class PlayComponent implements OnInit, OnDestroy {
} else{ } else{
console.log("全部正确") console.log("全部正确")
} }
if(this.m_submitedTimes>=2 || (this.m_submitedTimes<2 && !hasIncorrect)) {
let qp = this.g_cartoon.getCartoonElement("question_container")
let keyboard = this.g_cartoon.getCartoonElement("keyboard_container")
await qp.out()
await keyboard.out()
await this.showCheckPannel(result)
this.g_cartoon.getCartoonElement("background_mask").ref.alpha = 0
this.g_enableMapDown = true;
}
// console.log(status) // console.log(status)
// this.switchQuestion(this.m_currentQuestionIndex, this.m_currentQuestionIndex+1) // this.switchQuestion(this.m_currentQuestionIndex, this.m_currentQuestionIndex+1)
submit.switchActive(false) submit.switchActive(false)
......
...@@ -46,7 +46,7 @@ const localImages = { ...@@ -46,7 +46,7 @@ const localImages = {
'btn_shift_shadow': 'assets/play/btn_shift_shadow.png', 'btn_shift_shadow': 'assets/play/btn_shift_shadow.png',
'bg_block_right': 'assets/play/bg_block_right.png', 'bg_block_right': 'assets/play/bg_block_right.png',
'bg_check_middle': 'assets/play/bg_block_right_disable.png', 'bg_block_disable': 'assets/play/bg_block_right_disable.png',
'bg_block_init': 'assets/play/bg_block_init.png', 'bg_block_init': 'assets/play/bg_block_init.png',
'bg_block_focus': 'assets/play/bg_block_focus.png', 'bg_block_focus': 'assets/play/bg_block_focus.png',
'bg_block_wrong': 'assets/play/bg_block_wrong.png', 'bg_block_wrong': 'assets/play/bg_block_wrong.png',
......
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