Commit dd8645f7 authored by 李维's avatar 李维

封装异步

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