Commit 2ea67568 authored by Guo Yuhang's avatar Guo Yuhang

add:finish taget

Signed-off-by: Guo Yuhang's avatar郭宇航 <guoyuhang@iplayabc.com>
parent 5420c4eb
...@@ -4,6 +4,8 @@ import { DefaultData } from '../script/DefaultData'; ...@@ -4,6 +4,8 @@ import { DefaultData } from '../script/DefaultData';
import EventMgr from '../script/EventMgr'; import EventMgr from '../script/EventMgr';
import VerletRender from "../script/verlet_render"; import VerletRender from "../script/verlet_render";
import BezierRender from "../script/bezier_render"; import BezierRender from "../script/bezier_render";
import { onHomeworkFinish } from "../script/utils";
const POS = { const POS = {
LeftPage: { x: -239, y: -5 }, LeftPage: { x: -239, y: -5 },
RightPage: { x: 239, y: -5 }, RightPage: { x: 239, y: -5 },
...@@ -440,8 +442,8 @@ cc.Class({ ...@@ -440,8 +442,8 @@ cc.Class({
// }) // })
// let spf2 = spf1; // let spf2 = spf1;
cc.tween(page1) cc.tween(page1)
.to(1, {opacity: 0}) .to(1, { opacity: 0 })
.start(); .start();
let page2 = this.pageList[GameData.pageIndex - 1]; let page2 = this.pageList[GameData.pageIndex - 1];
if (page2) { if (page2) {
...@@ -449,39 +451,39 @@ cc.Class({ ...@@ -449,39 +451,39 @@ cc.Class({
// spf2 = this.capture.doCapture(page2); // spf2 = this.capture.doCapture(page2);
// page2.opacity = 0; // page2.opacity = 0;
// this.scheduleOnce(() => { // this.scheduleOnce(() => {
page2.x = POS.RightPage.x; page2.x = POS.RightPage.x;
// }) // })
if (page0) { if (page0) {
cc.tween(page0) cc.tween(page0)
// .delay(1) // .delay(1)
.to(1, {opacity: 0}) .to(1, { opacity: 0 })
.start(); .start();
} }
cc.tween(page2) cc.tween(page2)
// .delay(1) // .delay(1)
.to(1, {opacity: 255}) .to(1, { opacity: 255 })
.call(() => { .call(() => {
this.resetPages() this.resetPages()
}) })
.start(); .start();
} }
let page3 = this.pageList[GameData.pageIndex - 2] let page3 = this.pageList[GameData.pageIndex - 2]
if (page3) { if (page3) {
// this.scheduleOnce(() => { // this.scheduleOnce(() => {
page3.opacity = 0; page3.opacity = 0;
// }) // })
cc.tween(page3) cc.tween(page3)
// .delay(1) // .delay(1)
.to(1, {opacity: 255}) .to(1, { opacity: 255 })
.call(() => { .call(() => {
onHomeworkFinish();
}) })
.start(); .start();
} }
// let node = cc.instantiate(this.pfbItemTurnPage2); // let node = cc.instantiate(this.pfbItemTurnPage2);
...@@ -541,8 +543,8 @@ cc.Class({ ...@@ -541,8 +543,8 @@ cc.Class({
// let spf2 = spf1; // let spf2 = spf1;
cc.tween(page1) cc.tween(page1)
.to(1, {opacity: 0}) .to(1, { opacity: 0 })
.start(); .start();
let page2 = this.pageList[GameData.pageIndex + 2] let page2 = this.pageList[GameData.pageIndex + 2]
...@@ -551,26 +553,26 @@ cc.Class({ ...@@ -551,26 +553,26 @@ cc.Class({
// spf2 = this.capture.doCapture(page2, true); // spf2 = this.capture.doCapture(page2, true);
// page2.opacity = 0; // page2.opacity = 0;
// this.scheduleOnce(() => { // this.scheduleOnce(() => {
page2.x = POS.LeftPage.x; page2.x = POS.LeftPage.x;
// }) // })
cc.tween(page0) cc.tween(page0)
// .delay(1) // .delay(1)
.to(1, {opacity: 0}) .to(1, { opacity: 0 })
.start(); .start();
cc.tween(page2) cc.tween(page2)
// .delay(1) // .delay(1)
.to(1, {opacity: 255}) .to(1, { opacity: 255 })
.call(() => { .call(() => {
this.resetPages() this.resetPages()
}) })
.start(); .start();
} }
let page3 = this.pageList[GameData.pageIndex + 3] let page3 = this.pageList[GameData.pageIndex + 3]
if (page3) { if (page3) {
// this.scheduleOnce(() => { // this.scheduleOnce(() => {
page3.opacity = 255; page3.opacity = 255;
// }) // })
} }
......
...@@ -196,4 +196,15 @@ async function rabbonFall(node) { ...@@ -196,4 +196,15 @@ async function rabbonFall(node) {
const offsetX = RandomInt(-200, 200) * time; const offsetX = RandomInt(-200, 200) * time;
await asyncTweenBy(node, time, { x: offsetX, angle: offsetX * 60 / 200 }); await asyncTweenBy(node, time, { x: offsetX, angle: offsetX * 60 / 200 });
rabbonFall(node); rabbonFall(node);
} }
\ No newline at end of file export function onHomeworkFinish() {
const middleLayer = cc.find('middleLayer');
if (middleLayer) {
const middleLayerComponent = middleLayer.getComponent('middleLayer');
if (middleLayerComponent.role == 'student') {
middleLayerComponent.onHomeworkFinish(() => { });
}
} else {
console.log('onHomeworkFinish');
}
}
\ 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