Commit 0009ac82 authored by wjf's avatar wjf

l

parent 279a5f09
......@@ -253,13 +253,16 @@ export default class MainScene extends Scene {
for (let i = 0; i < svgas.length; i++) {
parser.load(resPath + 'resource/assets/svgas/' + svgas[i] + ".svga", (videoItem) => {
var mv = new window["SVGA"].EgretMovieClip(videoItem);
mv.lockStep=true;
mv.x = (750 - 520) / 2;
mv.y = 500;
mv.stop();
let fun;
mv.addEventListener(egret.Event.COMPLETE, fun = function (e) {
e.target.stop()
this.removeChild(e.target)
if(e.target.parent){
this.removeChild(e.target)
}
}, this)
this.movieClips[svgas[i]] = mv;
}, function (error) {
......@@ -596,10 +599,9 @@ export default class MainScene extends Scene {
//购买弹框
PanelCtrl.instance.show("Buy3", {})
} else {
//再写
//再写,成功后请求home接口,然后执行updateScene
NetManager.ins.hc_useProp((s) => {
if(s){
if (s) {
}
}, PropType.CHANCE_NUM)
}
......@@ -1860,6 +1862,11 @@ export default class MainScene extends Scene {
if (sv && this.movieClips[sv]) {
this.addChild(this.movieClips[sv])
this.movieClips[sv].gotoAndPlay(1, true)
setTimeout(()=>{
if(this.movieClips[sv].parent){
this.removeChild(this.movieClips[sv])
}
},667)
}
this.oneStepScore = 0;
}
......
......@@ -35,7 +35,7 @@ export const Chapters: ChapterData[] = [
],
connectedLats: [[27, 45], [28, 46], [29, 47]]
},
baseElementTypes: [0, 1, 2, 3],
baseElementTypes: [0, 1, 2, 3, 4],
effectInitProbability: 0.15,
stepCount: 30,
passTarget: {
......
......@@ -2,6 +2,7 @@
/**
* 直接通过替换source替换图片的动画帧
* 暂时这些动画帧只播放一次,所以简化
* 默认按时间间隔播放
* 图片都以素材为中心为原点
*/
export class ImageAni extends eui.Image {
......@@ -10,6 +11,11 @@ export class ImageAni extends eui.Image {
totalFrames: number;
isPlay: boolean;
startTime: number
/**
* 所有时间,帧数按每秒30
*/
allTime: number
/**
* 播放完的回调
*/
......@@ -28,22 +34,36 @@ export class ImageAni extends eui.Image {
this.currentFrame = 0;
this.totalFrames = sourceAll.length;
this.addEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this)
}
this.allTime = this.sourceAll.length / 30 * 1000;
}
//需要做锁步
private count = 0;
onEnterFrame() {
if (!this.isPlay) {
this.count = 0
// this.count = 0
return
}
this.count++;
if (this.count % 2 == 0) {
this.currentFrame++;
if (this.currentFrame == this.totalFrames/*-1*/) {
this.currentFrame = 0;
this.isPlay = false
this.callback && this.callback();
}
// this.count++;
// if (this.count % 2 == 0) {
// this.currentFrame++;
// if (this.currentFrame == this.totalFrames/*-1*/) {
// this.currentFrame = 0;
// this.isPlay = false
// this.callback && this.callback();
// }
// this.texture = RES.getRes(this.sourceAll[this.currentFrame])
// this.x = -this.texture.textureWidth / 2;
// this.y = -this.texture.textureHeight / 2;
// }
var dataNow = Date.now();
var deltaTime = dataNow - this.startTime;
var scale = deltaTime / this.allTime;
if (scale >= 1) {
this.isPlay = false
this.callback && this.callback();
} else {
this.currentFrame = (scale * this.sourceAll.length) >> 0;
this.texture = RES.getRes(this.sourceAll[this.currentFrame])
this.x = -this.texture.textureWidth / 2;
this.y = -this.texture.textureHeight / 2;
......@@ -54,7 +74,8 @@ export class ImageAni extends eui.Image {
* 回调是播放完后做回收用的
*/
play(callback) {
this.isPlay = true
this.startTime = Date.now();
this.isPlay = true;
this.currentFrame = 0;
this.texture = RES.getRes(this.sourceAll[this.currentFrame])
this.x = -this.texture.textureWidth / 2;
......
......@@ -62,6 +62,7 @@ export class GuideMsg extends egret.DisplayObjectContainer {
} else {
parser.load(resPath + 'resource/assets/svgas/' + 'guide' + num + '.svga', (videoItem) => {
var mv = new window["SVGA"].EgretMovieClip(videoItem);
mv.lockStep = true;
mv.x = 3;
mv.y = -263;
this.moiveClip = mv;
......
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