Commit 883e98bc authored by wildfirecode's avatar wildfirecode

Merge branch 'dev' of gitlab2.dui88.com:wanghongyuan/xiaoxiaole into dev

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