Commit b18f63e5 authored by wildfirecode's avatar wildfirecode

1

parent 6f84012c
......@@ -254,7 +254,7 @@ export default class MainScene extends Scene {
//记录是否有红包炸弹弹框
redBombPanelMark: boolean;
start(data) {
async start(data) {
super.start();
//第几关
this.chapter = (data && data.chapter) ? data.chapter : 1;
......@@ -284,8 +284,11 @@ export default class MainScene extends Scene {
//设置栏置顶
this.addChild(this["settingAll"])
this.addChild(this['redrainbg']);
this['redrainbg'].visible=false;
this.addLoading();
//先判断是否添加节日元素,如果加节日元素,就按initFestivalEle里的来
if(!this.initFestivalEle()) {
const initFestivalEleResult = await this.initFestivalEle();
if(!initFestivalEleResult) {
//检查一次三消
if(this.threeMatch()) {
this.eliminate();
......@@ -306,7 +309,7 @@ export default class MainScene extends Scene {
this.initSvgas();
//AiControl初始化,
AiControl.ins.init(this.lattices);
this.addLoading();
}
async addLoading(){
......@@ -318,6 +321,26 @@ export default class MainScene extends Scene {
await loadSvga(getResPath() + 'resource/assets/svgas/loading_progress.svga', this['container3']);
}
startPlayLoadingAni(){
const setProgress = (per: number)=> {
egret.Tween.get(this['progressmask2']).to({ scaleX: per / 100 }, 100);
this['percentTxt'].text = `${per}%`
}
return new Promise((r)=>{
let timer,current = 0;
timer = setInterval(() => {
current ++;
setProgress(current);
if (current >= 100) {
clearInterval(timer);
wait(500).then(r);
}
}, 1000/30);
});
}
/**
* 加载所有用到的svga
*/
......@@ -734,7 +757,7 @@ export default class MainScene extends Scene {
}
//初始化节日元素
initFestivalEle(): boolean {
async initFestivalEle() {
//添加节日元素,条件可能会变
if(
fesChapterData.indexOf(this.chapter >> 0) > -1 &&
......@@ -743,6 +766,10 @@ export default class MainScene extends Scene {
this.lattices[festivalIndex] && //格子必须有
(Tool.judgeSetFesEle(this.lattices[festivalIndex]) || !this.lattices[festivalIndex].element) //没有元素也行
) {
this['redrainbg'].visible=true;
await this.startPlayLoadingAni();
this['redrainbg'].visible=false;
var p = Tool.getPositionByIndex(festivalIndex);
//添加节日红包目标
this.festivalTarget = new FestivalTarget(this.festivalTargetNum);
......
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