Commit d2e528a9 authored by 李维's avatar 李维

dev commit

parent 6d69b7f4
...@@ -141,6 +141,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -141,6 +141,7 @@ export class PlayComponent implements OnInit, OnDestroy {
m_currentInputIndex = 0; m_currentInputIndex = 0;
m_submited = false; m_submited = false;
m_wordLetterInputCatch = []; m_wordLetterInputCatch = [];
m_canInput = true;
// ------------------------------------ // ------------------------------------
...@@ -339,15 +340,18 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -339,15 +340,18 @@ export class PlayComponent implements OnInit, OnDestroy {
this.subscribeMapDownEvent(btnNext.id, ()=>{ this.subscribeMapDownEvent(btnNext.id, ()=>{
this.switchQuestion(this.m_currentQuestionIndex, this.m_currentQuestionIndex + 1); this.switchQuestion(this.m_currentQuestionIndex, this.m_currentQuestionIndex + 1);
jelly(btnNext.ref) this.showJellyAnimation(btnNext.id, ()=>{
this.g_enableMapDown = true; this.g_enableMapDown = true;
}) })
})
this.subscribeMapDownEvent(btnPre.id, ()=>{ this.subscribeMapDownEvent(btnPre.id, ()=>{
this.switchQuestion(this.m_currentQuestionIndex, this.m_currentQuestionIndex - 1); this.switchQuestion(this.m_currentQuestionIndex, this.m_currentQuestionIndex - 1);
jelly(btnPre.ref) this.showJellyAnimation(btnPre.id, ()=>{
this.g_enableMapDown = true; this.g_enableMapDown = true;
}) })
})
element.ref.addChild(labelIndex.ref) element.ref.addChild(labelIndex.ref)
element.ref.addChild(questionText.ref) element.ref.addChild(questionText.ref)
...@@ -401,14 +405,19 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -401,14 +405,19 @@ export class PlayComponent implements OnInit, OnDestroy {
for(let i=1; i<=letttes.length; i++) { for(let i=1; i<=letttes.length; i++) {
let le = createWord(letttes[i-1], baseX, baseY) let le = createWord(letttes[i-1], baseX, baseY)
this.subscribeMapDownEvent(le.id, ()=>{ this.subscribeMapDownEvent(le.id, ()=>{
jelly(le.ref) this.showJellyAnimation(le.id, ()=>{
this.g_enableMapDown = true;
})
if(!this.m_canInput) {
return
}
let target = this.g_cartoon.getCartoonElement(this.m_currentInput) let target = this.g_cartoon.getCartoonElement(this.m_currentInput)
if(this.m_openShift) { if(this.m_openShift) {
target.setContentText(letttes[i-1].toUpperCase()) target.setContentText(letttes[i-1].toUpperCase())
} else { } else {
target.setContentText(letttes[i-1].toLocaleLowerCase()) target.setContentText(letttes[i-1].toLocaleLowerCase())
} }
this.g_enableMapDown = true;
this.jumpToNextActive(this.m_currentQuestionIndex); this.jumpToNextActive(this.m_currentQuestionIndex);
}) })
allLetterRefs.push(le.ref.children[1]) allLetterRefs.push(le.ref.children[1])
...@@ -457,9 +466,10 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -457,9 +466,10 @@ export class PlayComponent implements OnInit, OnDestroy {
le.text = le.text.toLocaleLowerCase() le.text = le.text.toLocaleLowerCase()
}) })
} }
jelly(btnShift.ref) this.showJellyAnimation(btnShift.id, ()=>{
this.g_enableMapDown = true; this.g_enableMapDown = true;
}) })
})
this.render(element.ref) this.render(element.ref)
} }
...@@ -605,15 +615,12 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -605,15 +615,12 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
container.active = (status=false) => { container.active = (status=false) => {
console.log("DVDV")
if(status) { if(status) {
if(container.getContentText() == "") { if(container.getContentText() == "") {
bgFocus.ref.alpha = 1; container.switchStatus("focus")
// bgDisable.ref.alpha = 0;
} }
} else { } else {
bgFocus.ref.alpha = 0; container.switchStatus("disable")
// bgDisable.ref.alpha = 1;
} }
if(status) { if(status) {
this.m_currentInput = `block_${x}_${y}`; this.m_currentInput = `block_${x}_${y}`;
...@@ -669,7 +676,6 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -669,7 +676,6 @@ export class PlayComponent implements OnInit, OnDestroy {
if(!this.m_submited && questionIndex==fromIndex) { if(!this.m_submited && questionIndex==fromIndex) {
container.setContentText(contentSaved) container.setContentText(contentSaved)
} }
console.log("==A==")
if(groupIndex!= this.m_currentQuestionIndex) { if(groupIndex!= this.m_currentQuestionIndex) {
if(container.getContentText() == "") { if(container.getContentText() == "") {
container.switchStatus("init") container.switchStatus("init")
...@@ -695,11 +701,16 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -695,11 +701,16 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
} }
} }
console.log(this.m_currentInput)
} }
this.subscribeMapDownEvent(container.id, ()=>{ this.subscribeMapDownEvent(container.id, ()=>{
container.switchStatus("wrong") if(container.canSetActive()) {
if(this.m_currentInput) {
let currentAcitveNode = this.g_cartoon.getCartoonElement(this.m_currentInput)
currentAcitveNode.active(false)
}
container.active(true);
}
this.g_enableMapDown = true; this.g_enableMapDown = true;
}) })
return container return container
...@@ -763,15 +774,18 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -763,15 +774,18 @@ export class PlayComponent implements OnInit, OnDestroy {
}, (w, h)=>{ }, (w, h)=>{
return { return {
x: this.g_canvasWidth / 2 + 855 * this.g_mapScale / 2 + 118 * this.g_mapScale, x: this.g_canvasWidth / 2 + 855 * this.g_mapScale / 2 + 118 * this.g_mapScale,
y: this.g_canvasHeight / 2 + 800 * this.g_mapScale y: this.g_canvasHeight / 2 + 700 * this.g_mapScale
} }
}) })
submit.ref.alpha = 0;
submit.switchActive = (status) => { submit.switchActive = (status) => {
if(status) { if(status) {
submit.ref.alpha = 1; submit.ref.alpha = 1;
this.m_canInput = false;
} else { } else {
submit.ref.alpha = 0; submit.ref.alpha = 0;
this.m_canInput = true;
} }
} }
...@@ -781,7 +795,9 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -781,7 +795,9 @@ export class PlayComponent implements OnInit, OnDestroy {
this.m_blockFirstSubmit[this.m_currentQuestionIndex] = false; this.m_blockFirstSubmit[this.m_currentQuestionIndex] = false;
this.m_currentInputIndex = 0; this.m_currentInputIndex = 0;
let status = this.updateStatusByGroupIndex(this.m_currentQuestionIndex); let status = this.updateStatusByGroupIndex(this.m_currentQuestionIndex);
this.switchQuestion(this.m_currentQuestionIndex, this.m_currentQuestionIndex+1) // console.log(status)
// this.switchQuestion(this.m_currentQuestionIndex, this.m_currentQuestionIndex+1)
submit.switchActive(false)
// if(this.m_currentQuestionIndex == this.g_formData.dataArray.length-1) { // if(this.m_currentQuestionIndex == this.g_formData.dataArray.length-1) {
// // 最后一题提交以后 弹出结束按钮 // // 最后一题提交以后 弹出结束按钮
// let btn = this.g_cartoon.getCartoonElement("FinishButton") // let btn = this.g_cartoon.getCartoonElement("FinishButton")
...@@ -797,7 +813,9 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -797,7 +813,9 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
this.subscribeMapDownEvent(submit.id, ()=> { this.subscribeMapDownEvent(submit.id, ()=> {
if(submit.ref.alpha == 1) {
handleSubmit() handleSubmit()
}
this.g_enableMapDown = true; this.g_enableMapDown = true;
}) })
...@@ -867,7 +885,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -867,7 +885,7 @@ export class PlayComponent implements OnInit, OnDestroy {
// 跳转下一个焦点输入框 // 跳转下一个焦点输入框
jumpToNextActive(index) { jumpToNextActive(index) {
console.log("jumpToNextActive") console.log("jumpToNextActive m_currentInputIndex", this.m_currentInputIndex)
let blocks = this.m_blockGroup[index]; let blocks = this.m_blockGroup[index];
this.m_hasActiveBlock = false; this.m_hasActiveBlock = false;
...@@ -886,13 +904,12 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -886,13 +904,12 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
checkNextActive(); checkNextActive();
console.log(this.m_currentInputIndex)
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);
console.log("使能提交按钮")
} }
// 切换当前输入从头开始 // 切换当前输入从头开始
...@@ -1942,8 +1959,8 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1942,8 +1959,8 @@ export class PlayComponent implements OnInit, OnDestroy {
showJellyAnimation(element_id, callback?){ showJellyAnimation(element_id, callback?){
let element = this.g_cartoon.getCartoonElement(element_id).ref let element = this.g_cartoon.getCartoonElement(element_id).ref
tweenChange(element,{ scaleX: this.g_mapScale * element.initScaleX * 1.1 , scaleY: this.g_mapScale * element.initScaleY * 1.1 }, 0.1, ()=>{ tweenChange(element,{ scaleX: element.initScaleX * 1.02 , scaleY: element.initScaleY * 1.02 }, 0.05, ()=>{
tweenChange(element,{ scaleX: this.g_mapScale * element.initScaleX * 0.9 , scaleY: this.g_mapScale * element.initScaleY * 0.9 }, 0.1, ()=>{ tweenChange(element,{ scaleX: element.initScaleX * 0.98 , scaleY: element.initScaleY * 0.98 }, 0.05, ()=>{
tweenChange(element,{ scaleX: element.initScaleX , scaleY: element.initScaleY }, 0.1, ()=>{ tweenChange(element,{ scaleX: element.initScaleX , scaleY: element.initScaleY }, 0.1, ()=>{
callback && callback() callback && callback()
}) })
......
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