Commit c1fc2956 authored by wildfirecode's avatar wildfirecode

1

parent 89af0506
......@@ -225,9 +225,9 @@
</e:Group>
<e:Group id="boxLayer" x="0" y="0" visible="false">
<e:Rect width="750" height="1624" fillAlpha="0.7" x="0" y="0"/>
<e:Group id="boxani">
<e:Group id="boxani" width="750" height="1624">
<e:Image source="common_box_btn_png" y="957.41" x="189" scaleX="1" scaleY="1"/>
</e:Group>
<e:Label text="点击开宝箱" y="791" size="37" horizontalCenter="0" bold="true"/>
</e:Group>
<e:Group id="guide" visible="false" locked="true">
<e:Rect width="750" height="1624" x="0" y="0" alpha="0.7"/>
......
......@@ -37,6 +37,7 @@ import getIconGroup from "./getIconGroup";
import getSignBtn from "./getSignBtn";
import getAdBtn from "./getAdBtn";
import getInviteBtn from "./getInviteBtn";
import { play2, play1 } from "../panels/help/svgaTool";
let doHelpFlag = false;
// let doScratchHelpFlag = false;
......@@ -87,6 +88,8 @@ export default class MapScene extends Scene {
parmas.push({ netCallback: netCallback, code: code });
}
return true;
// play2()
}
// 邀请有礼角标倒计时
......@@ -1035,56 +1038,50 @@ export default class MapScene extends Scene {
}
private _mc;
private stopFunc;
async onTap_boxLayer() {
NetManager.ins.clickLog(getlogItem(1));
const data = getHomeData();
if (data.canReceiveTreasureBoxNum > 0) {
this['boxLayer'].visible = true;
this['boxani'].y = this.stage.stageHeight / 2 - 1624 / 2;
if (!this._mc)
this._mc = await loadSvga(getResPath() + 'resource/assets/svgas/box.svga', this['boxani']);
this._mc.stop();
this._mc.gotoAndStop(1);
this._mc.anchorOffsetX = 750 / 2;
this._mc.anchorOffsetY = 500 + 50 + 30;
this._mc.x = 750 / 2;
this._mc.y = 500 + 50 + 30;
// this._mc.stop();
// this._mc.gotoAndStop(1);
// this._mc.anchorOffsetX = 750 / 2;
// this._mc.anchorOffsetY = 500 + 50 + 30;
// this._mc.x = 750 / 2;
// this._mc.y = 500 + 50 + 30;
this._mc.visible = false;
await wait(50);
this._mc.visible = true;
const a = 100, b = 10;
egret.Tween.get(this._mc, { loop: true }).set({ rotation: b })
.to({ rotation: -b }, a).to({ rotation: b }, a)
.to({ rotation: -b }, a).to({ rotation: b }, a)
.to({ rotation: -b }, a).to({ rotation: b }, a)
.to({ rotation: 0 }, a / 2)
.wait(1000);
this.stopFunc = play1(this._mc, 1, 120);
}
}
async playAni() {
if (this._mc) {
egret.Tween.removeTweens(this._mc);
this._mc.gotoAndPlay(1, true);
await this.onPlaySTOP();
await play2(this._mc,121,240);
}
this['boxLayer'].visible = false;
}
async onPlaySTOP() {
return new Promise((r) => {
const func = () => {
if (this._mc.currentFrame >= 100) {
this._mc.removeEventListener(egret.Event.ENTER_FRAME, func, this);
this._mc.stop();
r();
}
}
this._mc.addEventListener(egret.Event.ENTER_FRAME, func, this);
});
}
// async onPlaySTOP() {
// return new Promise((r) => {
// const func = () => {
// if (this._mc.currentFrame >= 100) {
// this._mc.removeEventListener(egret.Event.ENTER_FRAME, func, this);
// this._mc.stop();
// r();
// }
// }
// this._mc.addEventListener(egret.Event.ENTER_FRAME, func, this);
// });
// }
async onTap_box() {
console.log(1)
......
//播放完之后,在一个区间循环
// export const play1 = (mv, start, end, loopStart, loopEnd) => {
// const func1 = () => {
// if (mv.currentFrame == end)
// };
// mv.gotoAndPlay(start);
// mv.addEventListener(egret.Event.ENTER_FRAME, func1, this);
// mv.addEventListener(egret.Event.ENTER_FRAME, () => {
// if (this.mv1.currentFrame == this.mv1_end)
// this.mv1.gotoAndPlay(this.mv1_start);
// if (this.mv1.currentFrame == 420) {
// this.mv1_start = 421;
// this.mv1_end = this.mv1.totalFrames;
// }
// }, this);
// }
export const play1 = (mv, loopStart, loopEnd) => {
const func1 = () => {
if (mv.currentFrame == loopEnd)
mv.gotoAndPlay(loopStart);
};
mv.gotoAndPlay(loopStart);
mv.addEventListener(egret.Event.ENTER_FRAME, func1, this);
return () => {
mv.removeEventListener(egret.Event.ENTER_FRAME, func1, this);
}
}
......
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