Commit dd8645f7 authored by 李维's avatar 李维

封装异步

parent edfb2551
......@@ -660,7 +660,7 @@ export default class NewClass extends middleLayerBase {
await this.playGetParterAnim();
if (this.isLogin == true && this.gameModel != 'free') {
this.unlockNextForder();
await this.unlockNextForder();
}
}
......@@ -686,38 +686,42 @@ export default class NewClass extends middleLayerBase {
star.active = true;
star.getComponent(dragonBones.ArmatureDisplay).playAnimation('normal', 1);
const animData = this.getData('NJ_game_select');
if (animData && animData.folderCover) {
cc.assetManager.loadRemote(animData.folderCover, async (err, res) => {
const apple = cc.find('middleLayer/coolcat/apple');
apple.active = true;
apple.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(res);
const sx = 200 / apple.width;
const sy = 200 / apple.height;
const sl = Math.min(sx, sy);
apple.scale = sl;
cc.tween(apple)
.set({ scale: 0 })
.to(0.5, { scale: sl }, { easing: 'backOut' })
.to(0.1, { angle: 20 })
.to(0.2, { angle: -20 })
.to(0.1, { angle: 0 })
.delay(1)
.to(0.1, { angle: 20 })
.to(0.2, { angle: -20 })
.to(0.1, { angle: 0 })
.delay(1)
.to(0.1, { angle: 0 })
.call(() => {
this.hideGetParterAnim();
})
.start()
})
} else {
setTimeout(() => {
this.hideGetParterAnim();
}, 1000);
}
return new Promise((resovle, reject) => {
const animData = this.getData('NJ_game_select');
if (animData && animData.folderCover) {
cc.assetManager.loadRemote(animData.folderCover, async (err, res) => {
const apple = cc.find('middleLayer/coolcat/apple');
apple.active = true;
apple.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(res);
const sx = 200 / apple.width;
const sy = 200 / apple.height;
const sl = Math.min(sx, sy);
apple.scale = sl;
cc.tween(apple)
.set({ scale: 0 })
.to(0.5, { scale: sl }, { easing: 'backOut' })
.to(0.1, { angle: 20 })
.to(0.2, { angle: -20 })
.to(0.1, { angle: 0 })
.delay(1)
.to(0.1, { angle: 20 })
.to(0.2, { angle: -20 })
.to(0.1, { angle: 0 })
.delay(1)
.to(0.1, { angle: 0 })
.call(() => {
resovle(true);
this.hideGetParterAnim();
})
.start()
})
} else {
setTimeout(() => {
resovle(true);
this.hideGetParterAnim();
}, 1000);
}
})
}
hideGetParterAnim() {
......
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