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,27 +296,26 @@ cc.Class({ ...@@ -294,27 +296,26 @@ 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 starOff = cc.find('starNode/ImageStarOff', questionLayout);
const starOn = cc.find('starNode/ImageStarOn', questionLayout); if (this._status.quesion.selected) {
const starOff = cc.find('starNode/ImageStarOff', questionLayout); starOn.opacity = 255;
if (this._status.quesion.selected) { starOff.opacity = 0;
starOn.opacity = 255; } else {
starOff.opacity = 0; starOn.opacity = 0;
} else { starOff.opacity = 255;
starOn.opacity = 0; }
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;
btnNext.on('click', () => { btnNext.on('click', () => {
}); });
} else { } else {
btnNext.active = false; btnNext.active = false;
...@@ -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) {
.to(0.6, { x: movePos.x, y: movePos.y, scale: 1 }, { easing: 'sineInOut' }) optionNode.hideAction = cc.tween(optionNode)
.call(() => { .to(0.6, { x: movePos.x, y: movePos.y, scale: 1 }, { easing: 'sineInOut' })
optionNode.parent = optionBase; .call(() => {
optionNode.setPosition(optionNode.oldPosition); optionNode.parent = optionBase;
}) optionNode.setPosition(optionNode.oldPosition);
.start(); optionNode.hideAction = null;
this._status.currentShowOptionIdx = null;
this._status.currentShowOptionIdx = null; })
.start();
}
}, },
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) {
.to(0.6, { x: newPos.x, y: newPos.y, scale: 1 }, { easing: 'sineInOut' }) questionNode.hideAction = cc.tween(questionNode)
.call(() => { .to(0.6, { x: newPos.x, y: newPos.y, scale: 1 }, { easing: 'sineInOut' })
questionNode.parent = questionBase; .call(() => {
questionNode.x = questionNode.oldPosition.x; questionNode.parent = questionBase;
questionNode.y = questionNode.oldPosition.y; questionNode.x = questionNode.oldPosition.x;
this._status.currentShowQuestion = false; questionNode.y = questionNode.oldPosition.y;
}) this._status.currentShowQuestion = false;
.start(); questionNode.hideAction = null;
})
.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