Commit db3ff374 authored by 范雪寒's avatar 范雪寒

fix: 不隐藏问题

parent 14dddb0a
...@@ -249,10 +249,12 @@ cc.Class({ ...@@ -249,10 +249,12 @@ cc.Class({
next(); next();
}); });
window.courseware.onEvent('hideOption', (data, next) => { window.courseware.onEvent('hideOption', (data, next) => {
this.hideOption();
this.updateStatus(data.status); this.updateStatus(data.status);
next(); next();
}); });
window.courseware.onEvent('hideQuestion', (data, next) => { window.courseware.onEvent('hideQuestion', (data, next) => {
this.hideQuestion();
this.updateStatus(data.status); this.updateStatus(data.status);
next(); next();
}); });
...@@ -294,9 +296,7 @@ cc.Class({ ...@@ -294,9 +296,7 @@ cc.Class({
}); });
const questionLayout = cc.find('Canvas/bg/book/question/questionNode/questionLayout'); const questionLayout = cc.find('Canvas/bg/book/question/questionNode/questionLayout');
if (!questionLayout) { if (questionLayout) {
return;
}
const starOn = cc.find('starNode/ImageStarOn', questionLayout); const starOn = cc.find('starNode/ImageStarOn', questionLayout);
const starOff = cc.find('starNode/ImageStarOff', questionLayout); const starOff = cc.find('starNode/ImageStarOff', questionLayout);
if (this._status.quesion.selected) { if (this._status.quesion.selected) {
...@@ -306,10 +306,11 @@ cc.Class({ ...@@ -306,10 +306,11 @@ cc.Class({
starOn.opacity = 0; starOn.opacity = 0;
starOff.opacity = 255; starOff.opacity = 255;
} }
}
const tipNode = cc.find('Canvas/bg/tips'); const tipNode = cc.find('Canvas/bg/tips');
const btnNext = cc.find('Canvas/bg/btnNext'); const btnNext = cc.find('Canvas/bg/btnNext');
const allOptionSelected = this._status.options.all(optionData => optionData.selected); const allOptionSelected = this._status.options.every(optionData => optionData.selected);
if (this._status.quesion.selected && allOptionSelected) { if (this._status.quesion.selected && allOptionSelected) {
tipNode.active = false; tipNode.active = false;
btnNext.active = true; btnNext.active = true;
...@@ -425,13 +426,13 @@ cc.Class({ ...@@ -425,13 +426,13 @@ cc.Class({
await asyncTweenTo(label, 0.15, { scale: 1.1 }, { easing: 'sineIn' }); await asyncTweenTo(label, 0.15, { scale: 1.1 }, { easing: 'sineIn' });
await asyncTweenTo(label, 0.1, { scale: 1 }, { easing: 'sineOut' }); await asyncTweenTo(label, 0.1, { scale: 1 }, { easing: 'sineOut' });
await asyncDelay(2); await asyncDelay(2);
this.hideOption();
this.sendServerEvent('hideOption', { data: { idx: idx }, status: this._status }); this.sendServerEvent('hideOption', { data: { idx: idx }, status: this._status });
}, },
hideOption() { hideOption() {
const idx = this._status.currentShowOptionIdx; const idx = this._status.currentShowOptionIdx;
if (idx === null) { if (idx === null) {
console.log('idx = ' + idx);
return; return;
} }
...@@ -450,15 +451,17 @@ cc.Class({ ...@@ -450,15 +451,17 @@ cc.Class({
const movePos = maskBase.convertToNodeSpaceAR( const movePos = maskBase.convertToNodeSpaceAR(
optionBase.convertToWorldSpaceAR(optionNode.oldPosition) optionBase.convertToWorldSpaceAR(optionNode.oldPosition)
); );
cc.tween(optionNode) if (!optionNode.hideAction) {
optionNode.hideAction = cc.tween(optionNode)
.to(0.6, { x: movePos.x, y: movePos.y, scale: 1 }, { easing: 'sineInOut' }) .to(0.6, { x: movePos.x, y: movePos.y, scale: 1 }, { easing: 'sineInOut' })
.call(() => { .call(() => {
optionNode.parent = optionBase; optionNode.parent = optionBase;
optionNode.setPosition(optionNode.oldPosition); optionNode.setPosition(optionNode.oldPosition);
optionNode.hideAction = null;
this._status.currentShowOptionIdx = null;
}) })
.start(); .start();
}
this._status.currentShowOptionIdx = null;
}, },
async showQuestion() { async showQuestion() {
...@@ -495,12 +498,14 @@ cc.Class({ ...@@ -495,12 +498,14 @@ cc.Class({
await asyncTweenTo(label, 0.2, { scale: 1.0 }, { easing: 'sineInOut' }); await asyncTweenTo(label, 0.2, { scale: 1.0 }, { easing: 'sineInOut' });
} }
await asyncDelay(2); await asyncDelay(2);
this.hideQuestion();
this.sendServerEvent('hideQuestion', { data: null, status: this._status }); this.sendServerEvent('hideQuestion', { data: null, status: this._status });
}, },
async hideQuestion() { async hideQuestion() {
const questionNode = cc.find('Canvas/bg/maskBase/questionNode'); const questionNode = cc.find('Canvas/bg/maskBase/questionNode');
if (!questionNode) {
return;
}
const mask = cc.find('Canvas/bg/maskBase/mask'); const mask = cc.find('Canvas/bg/maskBase/mask');
cc.tween(mask).to(0.5, { opacity: 0 }).start(); cc.tween(mask).to(0.5, { opacity: 0 }).start();
...@@ -514,15 +519,18 @@ cc.Class({ ...@@ -514,15 +519,18 @@ cc.Class({
questionBase.convertToWorldSpaceAR(questionNode.oldPosition) questionBase.convertToWorldSpaceAR(questionNode.oldPosition)
); );
cc.tween(questionNode) if (!questionNode.hideAction) {
questionNode.hideAction = cc.tween(questionNode)
.to(0.6, { x: newPos.x, y: newPos.y, scale: 1 }, { easing: 'sineInOut' }) .to(0.6, { x: newPos.x, y: newPos.y, scale: 1 }, { easing: 'sineInOut' })
.call(() => { .call(() => {
questionNode.parent = questionBase; questionNode.parent = questionBase;
questionNode.x = questionNode.oldPosition.x; questionNode.x = questionNode.oldPosition.x;
questionNode.y = questionNode.oldPosition.y; questionNode.y = questionNode.oldPosition.y;
this._status.currentShowQuestion = false; this._status.currentShowQuestion = false;
questionNode.hideAction = null;
}) })
.start(); .start();
}
}, },
playAudioByNodeName(name) { playAudioByNodeName(name) {
......
{"ios":{"sceneName":"AK09","version":"f9be7"},"android":{"sceneName":"AK09","version":"f9be7"}} {"ios":{"sceneName":"AK09","version":"b2a2b"},"android":{"sceneName":"AK09","version":"b2a2b"}}
\ No newline at end of file \ No newline at end of file
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