Commit 312b26d0 authored by zjz1994's avatar zjz1994

签到动效调整

parent 84cac247
...@@ -11,6 +11,12 @@ import { getlogItem } from "../Main"; ...@@ -11,6 +11,12 @@ import { getlogItem } from "../Main";
import Utils from "../Utils"; import Utils from "../Utils";
import { NetName } from "../../libs/tw/enum/NetName"; import { NetName } from "../../libs/tw/enum/NetName";
import { hortileLayout } from "../layout/hortileLayout"; import { hortileLayout } from "../layout/hortileLayout";
import getResPath from "../../libs/new_tc/getResPath";
//加载器
let svgaParser;
const movieClips: any = {};
export default class SignPanel extends Panel { export default class SignPanel extends Panel {
list: eui.List; list: eui.List;
...@@ -100,7 +106,7 @@ export default class SignPanel extends Panel { ...@@ -100,7 +106,7 @@ export default class SignPanel extends Panel {
this.hidePanel(); this.hidePanel();
}, window['signActivityId']) }, window['signActivityId'])
console.log(data); // console.log(data);
}; };
const list: any[] = [{}, {}, {}, {}, {}, {}, {}]; const list: any[] = [{}, {}, {}, {}, {}, {}, {}];
...@@ -150,6 +156,9 @@ export default class SignPanel extends Panel { ...@@ -150,6 +156,9 @@ export default class SignPanel extends Panel {
// }, this); // }, this);
// this.showlog(); // this.showlog();
// this.data.img = DataManager.ins.getData('getPlugOrderStatus').lottery.imgurl; // this.data.img = DataManager.ins.getData('getPlugOrderStatus').lottery.imgurl;
this.initSvgas();
} }
// { nums: '10元宝', type: 'money' }, // { nums: '10元宝', type: 'money' },
...@@ -161,7 +170,7 @@ export default class SignPanel extends Panel { ...@@ -161,7 +170,7 @@ export default class SignPanel extends Panel {
// { nums: '0.3元', type: 'quan30' } // { nums: '0.3元', type: 'quan30' }
private getConfigs() { private getConfigs() {
let config = DataManager.ins.getData(NetName.GET_CONFIG).data; let config = DataManager.ins.getData(NetName.GET_CONFIG).data;
console.log("签到原始数据",config); // console.log("签到原始数据",config);
let getSignConfig = config && config.signConf; let getSignConfig = config && config.signConf;
if (getSignConfig && getSignConfig.sixDaysBeforeOptions && getSignConfig.theSeventhDayOptions) { if (getSignConfig && getSignConfig.sixDaysBeforeOptions && getSignConfig.theSeventhDayOptions) {
...@@ -214,7 +223,7 @@ export default class SignPanel extends Panel { ...@@ -214,7 +223,7 @@ export default class SignPanel extends Panel {
isNotGift(theSeventhDayOptions: any[]) { isNotGift(theSeventhDayOptions: any[]) {
const results = theSeventhDayOptions.filter(item => item.rate == 100); const results = theSeventhDayOptions.filter(item => item.rate == 100);
let result; let result;
console.log("礼盒检测",results); // console.log("礼盒检测",results);
if (results.length == 1) { if (results.length == 1) {
result = results[0]; result = results[0];
return result; return result;
...@@ -376,7 +385,7 @@ export default class SignPanel extends Panel { ...@@ -376,7 +385,7 @@ export default class SignPanel extends Panel {
this['prizeimg'].source = 'signicon2_png'; this['prizeimg'].source = 'signicon2_png';
}else{ }else{
showprizeimg = false; showprizeimg = false;
console.log("之前应该有处理"); // console.log("之前应该有处理");
} }
...@@ -392,10 +401,30 @@ export default class SignPanel extends Panel { ...@@ -392,10 +401,30 @@ export default class SignPanel extends Panel {
} }
this["btn2"].visible = this.showsxbtn; this["btn2"].visible = this.showsxbtn;
//圆点炸开动画,1-44
//吸星动画底,1-121
//闪烁星星,1-84
if(movieClips['signxistar']){//必放底
this['lightbot'].addChild(movieClips['signxistar']);
// movieClips['signxistar'].gotoAndPlay(1,1);
movieClips['signxistar'].gotoAndStop(1);
movieClips['signxistar'].alpha = 0;
}
if(this.showsxbtn||!this['prizeimg'].visible){//手动关闭 if(this.showsxbtn||!this['prizeimg'].visible){//手动关闭
this['contmid'].visible = false; this['contmid'].visible = false;
this['giftbox'].visible = true; this['giftbox'].visible = true;
//礼盒动画播放完毕,弹出奖励,奖励弹出完毕弹出收下按钮 //礼盒动画播放完毕,弹出奖励,奖励弹出完毕弹出收下按钮
if(this.showsxbtn){//是第七天并且奖励是礼盒
if(movieClips['signgiftbox']){
this['giftbox'].addChild(movieClips['signgiftbox']);
movieClips['signgiftbox'].gotoAndPlay(1,1);
}
}else{//其他
this.playShineDot();
}
this['contmid'].visible = true; this['contmid'].visible = true;
this["btn2"].visible = false; this["btn2"].visible = false;
this.tweenGroup(this['contmid'],"open",function(){ this.tweenGroup(this['contmid'],"open",function(){
...@@ -407,7 +436,8 @@ export default class SignPanel extends Panel { ...@@ -407,7 +436,8 @@ export default class SignPanel extends Panel {
var prizeimgx = item['prizeimg'].x; var prizeimgx = item['prizeimg'].x;
var prizeimgy = item['prizeimg'].y; var prizeimgy = item['prizeimg'].y;
var wtopos = item.localToGlobal(prizeimgx,prizeimgy); var wtopos = item.localToGlobal(prizeimgx,prizeimgy);
var wstpos = this['contmid'].localToGlobal(this['prizeimg'].x-this['prizeimg'].width,this['prizeimg'].y); // console.log("位置需要缩进",this['prizeimg'].width);
var wstpos = this['contmid'].localToGlobal(this['prizeimg'].x,this['prizeimg'].y);
var wctrlpos = item.localToGlobal(0,item.height); var wctrlpos = item.localToGlobal(0,item.height);
var lstpos = this.globalToLocal(wstpos.x,wstpos.y); var lstpos = this.globalToLocal(wstpos.x,wstpos.y);
...@@ -429,12 +459,44 @@ export default class SignPanel extends Panel { ...@@ -429,12 +459,44 @@ export default class SignPanel extends Panel {
this.movep2 = new egret.Point(ltopos.x,ltopos.y); this.movep2 = new egret.Point(ltopos.x,ltopos.y);
this.itemEffect("shake"); this.itemEffect("shake");
this.playShineDot();
return;
await wait(1000); await wait(1000);
this["prizegroup"].visible = false; this["prizegroup"].visible = false;
egret.Tween.get(this).to({factor: 1}, 500).call(this.moveOver, this); egret.Tween.get(this).to({factor: 1}, 500).call(this.moveOver, this);
} }
} }
//播放上部闪光和圆点
playShineDot(){
if(movieClips['signshine']){
this['lightop'].addChild(movieClips['signshine']);
// movieClips['signshine'].gotoAndPlay(1,1);
movieClips['signshine'].gotoAndStop(1);
}
if(movieClips['signsandot']){
this['lightop'].addChild(movieClips['signsandot']);
// movieClips['signsandot'].gotoAndPlay(1,1);
movieClips['signsandot'].gotoAndStop(8);
}
egret.Tween.get(this["prizegroup"]).set({
alpha:0.3
})
.to({
alpha:1,
},150)
.call(()=>{
if(movieClips['signshine']){
movieClips['signshine'].alpha = 1;
movieClips['signshine'].gotoAndPlay(1,1);
}
if(movieClips['signsandot']){
movieClips['signsandot'].gotoAndPlay(1,1);
}
},this);
}
public get factor():number { public get factor():number {
return 0; return 0;
} }
...@@ -493,7 +555,7 @@ export default class SignPanel extends Panel { ...@@ -493,7 +555,7 @@ export default class SignPanel extends Panel {
}else if(effectype=="roasign"){//签到完成,修改状态时对号旋转归位 }else if(effectype=="roasign"){//签到完成,修改状态时对号旋转归位
todayitem.setSigned(); todayitem.setSigned();
var roaimg = todayitem["roaimg"]; var roaimg = todayitem["roaimg"];
console.log(this.todayidx,"旋转对号",roaimg); // console.log(this.todayidx,"旋转对号",roaimg);
egret.Tween.get(roaimg) egret.Tween.get(roaimg)
.set({ .set({
rotation:70, rotation:70,
...@@ -574,4 +636,105 @@ export default class SignPanel extends Panel { ...@@ -574,4 +636,105 @@ export default class SignPanel extends Panel {
},this); },this);
} }
} }
/**
* 加载所有用到的svga
*/
initSvgas() {
var resPath = getResPath();
if(!svgaParser) svgaParser = new window["SVGA"].Parser();
var svgas = ["signgiftbox", "signsandot", "signshine", "signxistar"];
for (let i = 0; i < svgas.length; i++) {
if (movieClips[svgas[i]]){
this.addMvListener(svgas[i]);
continue;
}
let mvname = svgas[i];
svgaParser.load(resPath + 'resource/assets/svgas/' + svgas[i] + ".svga", (videoItem) => {
var mv = new window["SVGA"].EgretMovieClip(videoItem);
// mv.lockStep = true;
mv.stop();
// console.log(mvname,mv);
var boxwidth = 750;
var boxheight = 1206;
var mvwidth:number;
var mvheight:number;
if(mvname=="signxistar"){//底图
mvwidth = 761;
mvheight = 625;
mv.x = (boxwidth-mvwidth)/2;
mv.y = (boxheight-mvheight)/2;
}else if(mvname=="signshine"){
mvwidth = 450;
mvheight = 450;
mv.x = (boxwidth-mvwidth)/2;
mv.y = (boxheight-mvheight)/2;
}else if(mvname=="signsandot"){
mvheight = 210;
mv.y = -mvheight;
}else if(mvname=="signgiftbox"){
}
movieClips[svgas[i]] = mv;
this.addMvListener(mvname);
}, function (error) {
// alert(error.message);
})
}
}
addMvListener(mvname){
let fun;
movieClips[mvname].addEventListener(egret.Event.COMPLETE, fun = function(e) {
e.target.stop()
if (e.target.parent) {
e.target.parent.removeChild(e.target)
}
if(mvname=="signxistar"){
this["prizegroup"].visible = false;
egret.Tween.get(this).to({factor: 1}, 500).call(this.moveOver, this);
}
// if(mvname=="signshine"){
// movieClips['signxistar'].alpha = 1;
// movieClips['signxistar'].gotoAndPlay(1,1);
// }
}, this)
if(mvname=="signshine"){
let fun1;
movieClips['signshine'].addEventListener(egret.Event.ENTER_FRAME,fun1 = function(e){
var curframe = movieClips['signshine'].currentFrame;
if(curframe==20){
egret.Tween.get(movieClips['signxistar'])
.set({
alpha:0
})
.to({
alpha:1,
},200)
.call(()=>{
movieClips['signxistar'].gotoAndPlay(1,1);
},this);
}
},this)
}
// if(mvname=="signxistar"){//开始收
// let fun1;
// movieClips['signxistar'].addEventListener(egret.Event.ENTER_FRAME,fun1 = function(e){
// var curframe = movieClips['signxistar'].currentFrame;
// if(curframe>=80){
// e.target.stop()
// if (e.target.parent) {
// e.target.parent.removeChild(e.target)
// }
// this["prizegroup"].visible = false;
// egret.Tween.get(this).to({factor: 1}, 500).call(this.moveOver, this);
// }
// },this)
// }
}
} }
\ No newline at end of file
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