Commit c11f5126 authored by Tt's avatar Tt

完成

parent 828ebdc3
This diff is collapsed.
......@@ -56,7 +56,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 初始化页面
initView() {
this.img_dengdai.opacity = 100;
this.img_dengpao.opacity = 100;
}
// 事件监听
initEvent() {
......@@ -76,7 +77,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
@property(cc.Node) item_battery_img: cc.Node = null;
@property(cc.Node) img_left: cc.Node = null;
@property(cc.Node) img_right: cc.Node = null;
@property(cc.Node) ani_star: cc.Node = null;
@property(cc.Node) img_dengpao: cc.Node = null;
@property(cc.Node) img_dengdai: cc.Node = null;
initCanvas() {
this.img_dengdai.opacity = 100;
this.img_dengpao.opacity = 100;
let img = pg.view.find(this.layout_canvas, 'img');
pg.view.setNetImg(img, this.currentQuestion.bgItem.url, { w: 1220, h: 790 }, false)
......@@ -125,7 +132,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
let delayTime = 1.5;
if (this.current == 0) {
this.scheduleOnce(() => {
this.playLocalAudio('bettery')
this.playLocalAudio('bettery').then(() => {
pg.audio.playLocalBgm(pg.view.find(this, 'res/audio/bgm'))
})
}, delayTime)
} else {
this.playLocalAudio('bettery')
......@@ -298,21 +307,41 @@ export default class SceneComponent extends MyCocosSceneComponent {
onMeetSuccess(node, targetData) {
this.playLocalAudio('right')
node.off(cc.Node.EventType.TOUCH_START, this.onTouchStart, this);
node.off(cc.Node.EventType.TOUCH_MOVE, this.onTouchMove, this);
node.off(cc.Node.EventType.TOUCH_END, this.onTouchEnd, this);
node.off(cc.Node.EventType.TOUCH_CANCEL, this.onTouchEnd, this);
node.x = targetData.pos.x;
node.y = targetData.pos.y;
pg.view.setColor(pg.view.find(node, 'text'), '#1D8B38')
let item = pg.view.clone(this.ani_star);
node.addChild(item);
item.x = -15;
item.y = -15;
item.active = true;
pg.view.playDBAnimation(item, 'normal', 1)
node.parent = this.layout_items;
// 处理完成就结束了
this.successArr.push(targetData);
// 处理完成
if (this.successArr.length == this.currentQuestion.hotZoneItemArr.length) {
this.nextStage();
cc.tween(this.img_dengdai).repeat(2, cc.tween().to(0.2, { opacity: 255 }).to(0.2, { opacity: 50 })).to(0.2, { opacity: 255 }).start();
cc.tween(this.img_dengpao).repeatForever(cc.tween().to(0.2, { opacity: 255 }).to(0.2, { opacity: 50 })).start();
this.scheduleOnce(() => {
cc.Tween.stopAllByTarget(this.img_dengdai)
cc.Tween.stopAllByTarget(this.img_dengpao)
this.img_dengdai.opacity = 100;
this.img_dengpao.opacity = 100;
this.nextStage();
}, 2)
}
}
onMeetFail(node) {
this.playLocalAudio('error')
node.x = node.cPos.x;
node.y = node.cPos.y;
}
......
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