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

fix: 重启后大星星消失问题

parent 75e92b5f
// import { getSprNode } from "./util"; // import { getSprNode } from "./util";
import { getSprNode, playAudioByUrl, randomSortByArr, playAudio, showTrebleFirework, RandomInt, asyncDelay, exchangeNodePos } from "./util"; import { getSprNode, playAudioByUrl, randomSortByArr, playAudio, showTrebleFirework, RandomInt, asyncDelay, exchangeNodePos, onHomeworkFinish } from "./util";
cc.Class({ cc.Class({
extends: cc.Component, extends: cc.Component,
...@@ -87,19 +87,8 @@ cc.Class({ ...@@ -87,19 +87,8 @@ cc.Class({
func(this.getDefaultData()); func(this.getDefaultData());
}, },
onHomeworkFinish() {
const middleLayer = cc.find('middleLayer');
if (middleLayer) {
const middleLayerComponent = middleLayer.getComponent('middleLayer');
if (middleLayerComponent.role == 'student') {
middleLayerComponent.onHomeworkFinish(() => { });
}
return;
}
},
getDefaultData() { getDefaultData() {
const dataJson = '{"groupArr":[{"ques":"","optionArr":[{"type":"text","isRight":"1","text":"pad"},{"type":"text","isRight":"0","text":"bdpq"},{"type":"text","isRight":"0","text":"ooo"}]},{"ques":"","optionArr":[{"type":"text","isRight":"1","text":"pad"},{"type":"text","isRight":"0","text":"ggff"},{"type":"text","isRight":"0","text":"OOO"}]},{"ques":"","optionArr":[{"type":"text","isRight":"1","text":"pad"},{"type":"text","isRight":"0","text":"ggff"},{"type":"text","isRight":"0","text":"OOO"}]},{"ques":"","optionArr":[{"type":"text","isRight":"1","text":"pad"},{"type":"text","isRight":"0","text":"ggff"},{"type":"text","isRight":"0","text":"OOO"}]},{"ques":"","optionArr":[{"type":"text","isRight":"1","text":"pad"},{"type":"text","isRight":"0","text":"ggff"},{"type":"text","isRight":"0","text":"OOO"}]},{"ques":"","optionArr":[{"type":"text","isRight":"1","text":"pad"},{"type":"text","isRight":"0","text":"ggff"},{"type":"text","isRight":"0","text":"OOO"}]},{"ques":"","optionArr":[{"type":"text","isRight":"1","text":"pad"},{"type":"text","isRight":"0","text":"ggff"},{"type":"text","isRight":"0","text":"OOO"}]},{"ques":"","optionArr":[{"type":"text","isRight":"1","text":"pad"},{"type":"text","isRight":"0","text":"ggff"},{"type":"text","isRight":"0","text":"OOO"}]},{"ques":"","optionArr":[{"type":"text","isRight":"1","text":"pad"},{"type":"text","isRight":"0","text":"ggff"},{"type":"text","isRight":"0","text":"OOO"}]},{"ques":"","optionArr":[{"type":"text","isRight":"1","text":"pad"},{"type":"text","isRight":"0","text":"ggff"},{"type":"text","isRight":"0","text":"OOO"}]}]}'; const dataJson = '{"groupArr":[{"ques":"","optionArr":[{"type":"text","isRight":"1","text":"pad"},{"type":"text","isRight":"0","text":"bdpq"},{"type":"text","isRight":"0","text":"ooo"}]},{"ques":"","optionArr":[{"type":"text","isRight":"1","text":"pad"},{"type":"text","isRight":"0","text":"ggff"},{"type":"text","isRight":"0","text":"OOO"}]}]}';
const data1 = JSON.parse(dataJson); const data1 = JSON.parse(dataJson);
return data1; return data1;
}, },
...@@ -630,6 +619,7 @@ cc.Class({ ...@@ -630,6 +619,7 @@ cc.Class({
const bigStarBg = this.bigStarArr[this.groupIndex]; const bigStarBg = this.bigStarArr[this.groupIndex];
const starBig = bigStarBg.starBig; const starBig = bigStarBg.starBig;
starBig.scale = 1;
const star = bigStarBg.star; const star = bigStarBg.star;
star.active = true; star.active = true;
star.scaleX = 0.7 / bigStarBg.scale; star.scaleX = 0.7 / bigStarBg.scale;
...@@ -718,7 +708,7 @@ cc.Class({ ...@@ -718,7 +708,7 @@ cc.Class({
cc.tween(this) cc.tween(this)
.delay(0.2) .delay(0.2)
.call(() => { .call(() => {
this.onHomeworkFinish(); onHomeworkFinish();
this.showRestartBtn(); this.showRestartBtn();
}) })
.start(); .start();
......
...@@ -293,3 +293,14 @@ export function showTrebleFirework(baseNode, rabbonList) { ...@@ -293,3 +293,14 @@ export function showTrebleFirework(baseNode, rabbonList) {
showFireworks(left); showFireworks(left);
showFireworks(right); showFireworks(right);
} }
export function onHomeworkFinish() {
const middleLayer = cc.find('middleLayer');
if (middleLayer) {
const middleLayerComponent = middleLayer.getComponent('middleLayer');
if (middleLayerComponent.role == 'student') {
middleLayerComponent.onHomeworkFinish(() => { });
}
return;
}
}
\ 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