Commit 11597950 authored by zhangjinzhou's avatar zhangjinzhou

调整游戏实现0914暂存

parent 608d2d6c
...@@ -29,10 +29,10 @@ export default class SceneCtrl { ...@@ -29,10 +29,10 @@ export default class SceneCtrl {
// console.log("sceneCtrl------change",type,data,onComplete); // console.log("sceneCtrl------change",type,data,onComplete);
if(type==ModuleTypes.MAIN_SCENE){//游戏页 if(type==ModuleTypes.MAIN_SCENE){//游戏页
// console.log("游戏界面单例处理"); // console.log("游戏界面单例处理");
if(this.mainscene){ // if(this.mainscene){
// console.log("使用已存在mainscene"); // // console.log("使用已存在mainscene");
this.showAfterLoadAtlas(this.mainscene,data,onComplete); // this.showAfterLoadAtlas(this.mainscene,data,onComplete);
}else{ // }else{
// console.log("第一次创建mainscene"); // console.log("第一次创建mainscene");
this.mainscene = new MainScene(); this.mainscene = new MainScene();
if (!window['development']) { if (!window['development']) {
...@@ -46,7 +46,7 @@ export default class SceneCtrl { ...@@ -46,7 +46,7 @@ export default class SceneCtrl {
} else { } else {
this.showAfterLoadAtlas(this.mainscene, data, onComplete); this.showAfterLoadAtlas(this.mainscene, data, onComplete);
} }
} // }
} }
else if(type==ModuleTypes.MAP_SCENE){//mapscene else if(type==ModuleTypes.MAP_SCENE){//mapscene
if(this.mapscene){ if(this.mapscene){
......
import getResPath from "../../libs/new_tc/getResPath";
export const baseScore = 20;
export default class gamePool {
//加载器
static svgaParser = new window["SVGA"].Parser();
//三个toast和bonusTime
static movieClips: any = {};
static cannoblockdata: any = null;
static cannomvdata: any = null;
static cannofire1mvdata: any = null;
static cannolightmvdata: any = null;
static cannoparticlemvdata: any = null;
static pongomvdata: any = null;
static pongolfootdata: any = null;
static pongorfootdata: any = null;
static pongojiodata: any = null;
static pongojioArr: Array<any> = [];
static wormlightdata: any = null;
static wormlightArr: Array<any> = [];
//草坪的特效
static lawndata: any = null;
static lawnArr: Array<any> = [];
static dangaodata: any = null;
static regoudata: any = null;
static tiantianquandata: any = null;
static xugaodata: any = null;
//樱花
static cherryAniData: any = {};
static cherryAniArr: any = {};
}
\ No newline at end of file
...@@ -124,6 +124,7 @@ import { Grass } from '../something/class/Grass'; ...@@ -124,6 +124,7 @@ import { Grass } from '../something/class/Grass';
import Food from '../something/class/Food'; import Food from '../something/class/Food';
import foodAni from '../something/anis/foodAni'; import foodAni from '../something/anis/foodAni';
import shuzhi from '../something/class/shuzhi'; import shuzhi from '../something/class/shuzhi';
import gamePool from '../configData/gamePool';
const aniClass = { const aniClass = {
"BoomAni": BoomAni, "BoomAni": BoomAni,
...@@ -163,38 +164,38 @@ export const effectBaseTimes = { ...@@ -163,38 +164,38 @@ export const effectBaseTimes = {
MM: 50 MM: 50
}; };
//加载器 //加载器
let svgaParser; // let svgaParser;
//三个toast和bonusTime //三个toast和bonusTime
const movieClips: any = {}; // const movieClips: any = {};
let cannoblockdata:any = null; // let cannoblockdata:any = null;
let cannomvdata:any = null; // let cannomvdata:any = null;
let cannofire1mvdata:any = null; // let cannofire1mvdata:any = null;
let cannolightmvdata:any = null; // let cannolightmvdata:any = null;
let cannoparticlemvdata:any = null; // let cannoparticlemvdata:any = null;
let pongomvdata:any = null; // let pongomvdata:any = null;
let pongolfootdata:any = null; // let pongolfootdata:any = null;
let pongorfootdata:any = null; // let pongorfootdata:any = null;
let pongojiodata:any = null; // let pongojiodata:any = null;
let pongojioArr:Array<any> = []; // let pongojioArr:Array<any> = [];
let wormlightdata:any = null; // let wormlightdata:any = null;
let wormlightArr:Array<any> = []; // let wormlightArr:Array<any> = [];
//草坪的特效 //草坪的特效
let lawndata:any = null; // let lawndata:any = null;
let lawnArr:Array<any> = []; // let lawnArr:Array<any> = [];
//红包炸弹弹框名字 //红包炸弹弹框名字
const redBombPanelName = "RedBombAlert"; const redBombPanelName = "RedBombAlert";
let dangaodata:any = null; // let dangaodata:any = null;
let regoudata:any = null; // let regoudata:any = null;
let tiantianquandata:any = null; // let tiantianquandata:any = null;
let xugaodata:any = null; // let xugaodata:any = null;
//樱花 //樱花
let cherryAniData:any = {}; // let cherryAniData:any = {};
let cherryAniArr:any = {}; // let cherryAniArr:any = {};
//所有可能被添加节日红包的关卡及索引,默认索引值都是40;如果没有就不放 //所有可能被添加节日红包的关卡及索引,默认索引值都是40;如果没有就不放
const fesChapterData: number[] = []; const fesChapterData: number[] = [];
...@@ -709,16 +710,16 @@ export default class MainScene extends Scene { ...@@ -709,16 +710,16 @@ export default class MainScene extends Scene {
*/ */
initSvgas() { initSvgas() {
var resPath = getResPath(); var resPath = getResPath();
if(!svgaParser) svgaParser = new window["SVGA"].Parser(); // if(!svgaParser) svgaParser = new window["SVGA"].Parser();
var svgas = ["amazing", "great", "wonderful", "bonusTime"]; var svgas = ["amazing", "great", "wonderful", "bonusTime"];
//如果有节日的加 //如果有节日的加
if (this.festivalTarget) svgas.push("redBombLight"); if (this.festivalTarget) svgas.push("redBombLight");
for (let i = 0; i < svgas.length; i++) { for (let i = 0; i < svgas.length; i++) {
if (movieClips[svgas[i]]) continue; if (gamePool.movieClips[svgas[i]]) continue;
let mvname = svgas[i]; let mvname = svgas[i];
svgaParser.load(resPath + 'resource/assets/svgas/' + svgas[i] + ".svga", (videoItem) => { gamePool.svgaParser.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.lockStep = true;
if (svgas[i] != "bonusTime") { if (svgas[i] != "bonusTime") {
...@@ -727,7 +728,7 @@ export default class MainScene extends Scene { ...@@ -727,7 +728,7 @@ export default class MainScene extends Scene {
} }
mv.stop(); mv.stop();
movieClips[svgas[i]] = mv; gamePool.movieClips[svgas[i]] = mv;
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()
...@@ -742,20 +743,20 @@ export default class MainScene extends Scene { ...@@ -742,20 +743,20 @@ export default class MainScene extends Scene {
//炮台的动画数据 //炮台的动画数据
if(cannomvdata){ if(gamePool.cannomvdata){
}else{ }else{
svgaParser.load(resPath + 'resource/assets/svgas/canno1.svga',(videoItem)=>{ gamePool.svgaParser.load(resPath + 'resource/assets/svgas/canno1.svga',(videoItem)=>{
cannomvdata = videoItem; gamePool.cannomvdata = videoItem;
}) })
} }
//炮台石头 //炮台石头
if(cannoblockdata){ if(gamePool.cannoblockdata){
}else{ }else{
svgaParser.load(resPath + 'resource/assets/svgas/cannoblock.svga',(videoItem)=>{ gamePool.svgaParser.load(resPath + 'resource/assets/svgas/cannoblock.svga',(videoItem)=>{
cannoblockdata = videoItem; gamePool.cannoblockdata = videoItem;
}) })
} }
} }
...@@ -764,7 +765,7 @@ export default class MainScene extends Scene { ...@@ -764,7 +765,7 @@ export default class MainScene extends Scene {
*/ */
initCannoSvgas(icanno:Element,icannobianhao:number){ initCannoSvgas(icanno:Element,icannobianhao:number){
var resPath = getResPath(); var resPath = getResPath();
if (!svgaParser) svgaParser = new window["SVGA"].Parser(); // if (!svgaParser) svgaParser = new window["SVGA"].Parser();
var svgas = ["cannofire1","cannolight"];//,"cannoparticle"];//新增大炮的动画 var svgas = ["cannofire1","cannolight"];//,"cannoparticle"];//新增大炮的动画
let icannoidx = icanno.index; let icannoidx = icanno.index;
let icannodir:forwardDirection = icanno._cannoDir; let icannodir:forwardDirection = icanno._cannoDir;
...@@ -795,13 +796,13 @@ export default class MainScene extends Scene { ...@@ -795,13 +796,13 @@ export default class MainScene extends Scene {
let mvdata:any; let mvdata:any;
let mv:any; let mv:any;
if(jsvgname=="cannofire1"){ if(jsvgname=="cannofire1"){
mvdata = cannofire1mvdata; mvdata = gamePool.cannofire1mvdata;
mv = Pool.takeOut(RecoverName.CANNOFIRE); mv = Pool.takeOut(RecoverName.CANNOFIRE);
}else if(jsvgname=="cannolight"){ }else if(jsvgname=="cannolight"){
mvdata = cannolightmvdata; mvdata = gamePool.cannolightmvdata;
mv = Pool.takeOut(RecoverName.CANNOLIGHT); mv = Pool.takeOut(RecoverName.CANNOLIGHT);
}else if(jsvgname=="cannoparticle"){ }else if(jsvgname=="cannoparticle"){
mvdata = cannoparticlemvdata; mvdata = gamePool.cannoparticlemvdata;
} }
if(mvdata){ if(mvdata){
if(!mv){ if(!mv){
...@@ -810,15 +811,15 @@ export default class MainScene extends Scene { ...@@ -810,15 +811,15 @@ export default class MainScene extends Scene {
} }
this.initCannoMv(mv,jsvgname,icannobianhao); this.initCannoMv(mv,jsvgname,icannobianhao);
}else{ }else{
svgaParser.load(resPath + 'resource/assets/svgas/' + jsvgname + ".svga", (videoItem) => { gamePool.svgaParser.load(resPath + 'resource/assets/svgas/' + jsvgname + ".svga", (videoItem) => {
let mv = new window["SVGA"].EgretMovieClip(videoItem); let mv = new window["SVGA"].EgretMovieClip(videoItem);
// mv.lockStep = true; // mv.lockStep = true;
if(jsvgname=="cannofire1"&&!cannofire1mvdata){ if(jsvgname=="cannofire1"&&!gamePool.cannofire1mvdata){
cannofire1mvdata = videoItem; gamePool.cannofire1mvdata = videoItem;
}else if(jsvgname=="cannolight"&&!cannolightmvdata){ }else if(jsvgname=="cannolight"&&!gamePool.cannolightmvdata){
cannolightmvdata = videoItem; gamePool.cannolightmvdata = videoItem;
}else if(jsvgname=="cannoparticle"&&!cannoparticlemvdata){ }else if(jsvgname=="cannoparticle"&&!gamePool.cannoparticlemvdata){
cannoparticlemvdata = videoItem; gamePool.cannoparticlemvdata = videoItem;
} }
this.initCannoMv(mv,jsvgname,icannobianhao); this.initCannoMv(mv,jsvgname,icannobianhao);
},function(error){ },function(error){
...@@ -833,13 +834,13 @@ export default class MainScene extends Scene { ...@@ -833,13 +834,13 @@ export default class MainScene extends Scene {
*/ */
initWormSvgas(){ initWormSvgas(){
var resPath = getResPath(); var resPath = getResPath();
if (!svgaParser) svgaParser = new window["SVGA"].Parser(); // if (!svgaParser) svgaParser = new window["SVGA"].Parser();
if(wormlightdata){ if(gamePool.wormlightdata){
}else{ }else{
svgaParser.load(resPath + 'resource/assets/svgas/wormholelight.svga', (videoItem) => { gamePool.svgaParser.load(resPath + 'resource/assets/svgas/wormholelight.svga', (videoItem) => {
if(!wormlightdata){ if(!gamePool.wormlightdata){
wormlightdata = videoItem; gamePool.wormlightdata = videoItem;
} }
}) })
} }
...@@ -847,13 +848,13 @@ export default class MainScene extends Scene { ...@@ -847,13 +848,13 @@ export default class MainScene extends Scene {
//草坪动画 //草坪动画
initLawn(call=null){ initLawn(call=null){
var resPath = getResPath(); var resPath = getResPath();
if (!svgaParser) svgaParser = new window["SVGA"].Parser(); // if (!svgaParser) svgaParser = new window["SVGA"].Parser();
if(lawndata){ if(gamePool.lawndata){
}else{ }else{
svgaParser.load(resPath + 'resource/assets/svgas/lawn.svga', (videoItem) => { gamePool.svgaParser.load(resPath + 'resource/assets/svgas/lawn.svga', (videoItem) => {
if(!lawndata){ if(!gamePool.lawndata){
lawndata = videoItem; gamePool.lawndata = videoItem;
} }
}) })
} }
...@@ -862,12 +863,12 @@ export default class MainScene extends Scene { ...@@ -862,12 +863,12 @@ export default class MainScene extends Scene {
* 加载猩猩脚印 * 加载猩猩脚印
*/ */
initPongoJioSvgas(call:any=null){ initPongoJioSvgas(call:any=null){
if(pongojiodata){ if(gamePool.pongojiodata){
}else{ }else{
if (!svgaParser) svgaParser = new window["SVGA"].Parser(); // if (!svgaParser) svgaParser = new window["SVGA"].Parser();
svgaParser.load(resPath + 'resource/assets/svgas/xingxingjio.svga', (videoItem) => { gamePool.svgaParser.load(resPath + 'resource/assets/svgas/xingxingjio.svga', (videoItem) => {
pongojiodata = videoItem; gamePool.pongojiodata = videoItem;
call&&call(); call&&call();
}) })
} }
...@@ -1577,15 +1578,15 @@ export default class MainScene extends Scene { ...@@ -1577,15 +1578,15 @@ export default class MainScene extends Scene {
canno.resetToCannoView(dirType,this); canno.resetToCannoView(dirType,this);
let cannobianhao:number = this.cannonums; let cannobianhao:number = this.cannonums;
//添加大炮 //添加大炮
if(cannomvdata){ if(gamePool.cannomvdata){
canno.createCanno(cannomvdata,cannobianhao); canno.createCanno(gamePool.cannomvdata,cannobianhao);
}else{ }else{
if (!svgaParser) svgaParser = new window["SVGA"].Parser(); // if (!svgaParser) svgaParser = new window["SVGA"].Parser();
svgaParser.load(resPath + 'resource/assets/svgas/canno1.svga',(videoItem)=>{ gamePool.svgaParser.load(resPath + 'resource/assets/svgas/canno1.svga',(videoItem)=>{
if(!cannomvdata){ if(!gamePool.cannomvdata){
cannomvdata = videoItem; gamePool.cannomvdata = videoItem;
} }
canno.createCanno(cannomvdata,cannobianhao); canno.createCanno(gamePool.cannomvdata,cannobianhao);
}) })
} }
this.cannonums += 1; this.cannonums += 1;
...@@ -1615,15 +1616,15 @@ export default class MainScene extends Scene { ...@@ -1615,15 +1616,15 @@ export default class MainScene extends Scene {
pongo.setPongoPart(inpart); pongo.setPongoPart(inpart);
this.lattices[i].element = pongo; this.lattices[i].element = pongo;
if(inpart=="tl"){ if(inpart=="tl"){
if(pongomvdata&&pongolfootdata&&pongorfootdata){ if(gamePool.pongomvdata&&gamePool.pongolfootdata&&gamePool.pongorfootdata){
this.waitDataCreatePongo(pongo); this.waitDataCreatePongo(pongo);
}else{ }else{
if (!svgaParser) svgaParser = new window["SVGA"].Parser(); // if (!svgaParser) svgaParser = new window["SVGA"].Parser();
var svgas = ["xingxing","leftxingxing","rightxingxing"]; var svgas = ["xingxing","leftxingxing","rightxingxing"];
for(let pg=0;pg<svgas.length;pg++){ for(let pg=0;pg<svgas.length;pg++){
let pgname = svgas[pg]; let pgname = svgas[pg];
if(pgname=="xingxing"){ if(pgname=="xingxing"){
if(pongomvdata){ if(gamePool.pongomvdata){
var iscreate = this.waitDataCreatePongo(pongo); var iscreate = this.waitDataCreatePongo(pongo);
if(iscreate){ if(iscreate){
break; break;
...@@ -1632,7 +1633,7 @@ export default class MainScene extends Scene { ...@@ -1632,7 +1633,7 @@ export default class MainScene extends Scene {
} }
} }
}else if(pgname=="leftxingxing"){ }else if(pgname=="leftxingxing"){
if(pongolfootdata){ if(gamePool.pongolfootdata){
var iscreate = this.waitDataCreatePongo(pongo); var iscreate = this.waitDataCreatePongo(pongo);
if(iscreate){ if(iscreate){
break; break;
...@@ -1641,7 +1642,7 @@ export default class MainScene extends Scene { ...@@ -1641,7 +1642,7 @@ export default class MainScene extends Scene {
} }
} }
}else if(pgname=="rightxingxing"){ }else if(pgname=="rightxingxing"){
if(pongorfootdata){ if(gamePool.pongorfootdata){
var iscreate = this.waitDataCreatePongo(pongo); var iscreate = this.waitDataCreatePongo(pongo);
if(iscreate){ if(iscreate){
break; break;
...@@ -1651,18 +1652,18 @@ export default class MainScene extends Scene { ...@@ -1651,18 +1652,18 @@ export default class MainScene extends Scene {
} }
} }
svgaParser.load(resPath + 'resource/assets/svgas/'+pgname+'.svga',(videoItem)=>{ gamePool.svgaParser.load(resPath + 'resource/assets/svgas/'+pgname+'.svga',(videoItem)=>{
if(pgname=="xingxing"){ if(pgname=="xingxing"){
if(!pongomvdata){ if(!gamePool.pongomvdata){
pongomvdata = videoItem; gamePool.pongomvdata = videoItem;
} }
}else if(pgname=="leftxingxing"){ }else if(pgname=="leftxingxing"){
if(!pongolfootdata){ if(!gamePool.pongolfootdata){
pongolfootdata = videoItem; gamePool.pongolfootdata = videoItem;
} }
}else if(pgname=="rightxingxing"){ }else if(pgname=="rightxingxing"){
if(!pongorfootdata){ if(!gamePool.pongorfootdata){
pongorfootdata = videoItem; gamePool.pongorfootdata = videoItem;
} }
} }
...@@ -1697,8 +1698,8 @@ export default class MainScene extends Scene { ...@@ -1697,8 +1698,8 @@ export default class MainScene extends Scene {
havecreate:Array<number> = []; havecreate:Array<number> = [];
//创建猩猩 //创建猩猩
waitDataCreatePongo(pongo:Element){ waitDataCreatePongo(pongo:Element){
if(pongomvdata&&pongolfootdata&&pongorfootdata){ if(gamePool.pongomvdata&&gamePool.pongolfootdata&&gamePool.pongorfootdata){
pongo.createPongo(pongomvdata,pongolfootdata,pongorfootdata); pongo.createPongo(gamePool.pongomvdata,gamePool.pongolfootdata,gamePool.pongorfootdata);
return true; return true;
}else{ }else{
return false; return false;
...@@ -1853,6 +1854,7 @@ export default class MainScene extends Scene { ...@@ -1853,6 +1854,7 @@ export default class MainScene extends Scene {
//侦听事件 //侦听事件
initEvents() { initEvents() {
console.error("加入事件监听233=====");
this.addEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this); this.addEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this);
this.settingBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_settingBtn, this) this.settingBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_settingBtn, this)
this.questionBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_questionBtn, this) this.questionBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_questionBtn, this)
...@@ -1879,6 +1881,7 @@ export default class MainScene extends Scene { ...@@ -1879,6 +1881,7 @@ export default class MainScene extends Scene {
removeEvents() { removeEvents() {
console.error("移除事件监听233====");
this.removeEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this); this.removeEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this);
this.settingBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_settingBtn, this); this.settingBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_settingBtn, this);
this.questionBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_questionBtn, this) this.questionBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_questionBtn, this)
...@@ -1918,6 +1921,8 @@ export default class MainScene extends Scene { ...@@ -1918,6 +1921,8 @@ export default class MainScene extends Scene {
Pool.recover(RecoverName.CANNOLIGHT,icannoeffectlight); Pool.recover(RecoverName.CANNOLIGHT,icannoeffectlight);
} }
} }
//回收格子
this.cannoEffect = new Array(); this.cannoEffect = new Array();
} }
destroy() { destroy() {
...@@ -3538,17 +3543,17 @@ export default class MainScene extends Scene { ...@@ -3538,17 +3543,17 @@ export default class MainScene extends Scene {
//连消基数为1 //连消基数为1
this.commonContinuityTimes = 1; this.commonContinuityTimes = 1;
this.effectContinuityTimes = 1; this.effectContinuityTimes = 1;
if(movieClips["bonusTime"]) { if(gamePool.movieClips["bonusTime"]) {
playSound(SoundType.bonusTime); playSound(SoundType.bonusTime);
let rect = new Rect(750, 1624, 0x000000); let rect = new Rect(750, 1624, 0x000000);
rect.alpha = 0.6; rect.alpha = 0.6;
this.addChild(rect); this.addChild(rect);
this.addChild(movieClips["bonusTime"]) this.addChild(gamePool.movieClips["bonusTime"])
movieClips["bonusTime"].gotoAndPlay(1, true) gamePool.movieClips["bonusTime"].gotoAndPlay(1, true)
setTimeout(() => { setTimeout(() => {
this.terminateSteps(); this.terminateSteps();
if(movieClips["bonusTime"].parent) { if(gamePool.movieClips["bonusTime"].parent) {
this.removeChild(movieClips["bonusTime"]) this.removeChild(gamePool.movieClips["bonusTime"])
} }
if(rect.parent){ if(rect.parent){
this.removeChild(rect); this.removeChild(rect);
...@@ -5022,12 +5027,12 @@ export default class MainScene extends Scene { ...@@ -5022,12 +5027,12 @@ export default class MainScene extends Scene {
playSound(SoundType.toast); playSound(SoundType.toast);
sv = "great"; sv = "great";
} }
if(sv && movieClips[sv]) { if(sv && gamePool.movieClips[sv]) {
this.effectContainer.addChild(movieClips[sv]) this.effectContainer.addChild(gamePool.movieClips[sv])
movieClips[sv].gotoAndPlay(1, true) gamePool.movieClips[sv].gotoAndPlay(1, true)
setTimeout(() => { setTimeout(() => {
if(movieClips[sv].parent) { if(gamePool.movieClips[sv].parent) {
this.effectContainer.removeChild(movieClips[sv]) this.effectContainer.removeChild(gamePool.movieClips[sv])
} }
}, 667) }, 667)
} }
...@@ -5700,12 +5705,12 @@ export default class MainScene extends Scene { ...@@ -5700,12 +5705,12 @@ export default class MainScene extends Scene {
var pos = Tool.getPositionByIndex(ikuang); var pos = Tool.getPositionByIndex(ikuang);
var kuangpos = this.elementContainer.localToGlobal(pos[0],pos[1]); var kuangpos = this.elementContainer.localToGlobal(pos[0],pos[1]);
if(pongojiodata){ if(gamePool.pongojiodata){
let ikuangmv; let ikuangmv;
if(pongojioArr.length>0){ if(gamePool.pongojioArr.length>0){
ikuangmv = pongojioArr.shift(); ikuangmv = gamePool.pongojioArr.shift();
}else{ }else{
ikuangmv = new window["SVGA"].EgretMovieClip(pongojiodata); ikuangmv = new window["SVGA"].EgretMovieClip(gamePool.pongojiodata);
} }
ikuangmv.addEventListener(egret.Event.COMPLETE,this.playCompleteJio,this); ikuangmv.addEventListener(egret.Event.COMPLETE,this.playCompleteJio,this);
this.effectContainer.addChild(ikuangmv); this.effectContainer.addChild(ikuangmv);
...@@ -5716,10 +5721,10 @@ export default class MainScene extends Scene { ...@@ -5716,10 +5721,10 @@ export default class MainScene extends Scene {
console.error("无猩猩脚印data,一般不用处理"); console.error("无猩猩脚印data,一般不用处理");
this.initPongoJioSvgas(function(){ this.initPongoJioSvgas(function(){
let ikuangmv; let ikuangmv;
if(pongojioArr.length>0){ if(gamePool.pongojioArr.length>0){
ikuangmv = pongojioArr.shift(); ikuangmv = gamePool.pongojioArr.shift();
}else{ }else{
ikuangmv = new window["SVGA"].EgretMovieClip(pongojiodata); ikuangmv = new window["SVGA"].EgretMovieClip(gamePool.pongojiodata);
} }
ikuangmv.addEventListener(egret.Event.COMPLETE,this.playCompleteJio,this); ikuangmv.addEventListener(egret.Event.COMPLETE,this.playCompleteJio,this);
this.effectContainer.addChild(ikuangmv); this.effectContainer.addChild(ikuangmv);
...@@ -5739,7 +5744,7 @@ export default class MainScene extends Scene { ...@@ -5739,7 +5744,7 @@ export default class MainScene extends Scene {
target.removeEventListener(egret.Event.COMPLETE,this.playCompleteJio,this); target.removeEventListener(egret.Event.COMPLETE,this.playCompleteJio,this);
if(target.parent){ if(target.parent){
target.parent.removeChild(target); target.parent.removeChild(target);
pongojioArr.push(target); gamePool.pongojioArr.push(target);
} }
} }
...@@ -5907,7 +5912,7 @@ export default class MainScene extends Scene { ...@@ -5907,7 +5912,7 @@ export default class MainScene extends Scene {
//炮台石头的动效 //炮台石头的动效
var blockmv = Pool.takeOut(RecoverName.CANNOBLOCKANI);//movieClips["cannoblock"]; var blockmv = Pool.takeOut(RecoverName.CANNOBLOCKANI);//movieClips["cannoblock"];
if(!blockmv){ if(!blockmv){
blockmv = new window["SVGA"].EgretMovieClip(cannoblockdata); blockmv = new window["SVGA"].EgretMovieClip(gamePool.cannoblockdata);
}else{ }else{
// console.log("复用炮台石头"); // console.log("复用炮台石头");
} }
...@@ -5983,15 +5988,15 @@ export default class MainScene extends Scene { ...@@ -5983,15 +5988,15 @@ export default class MainScene extends Scene {
//红包炸弹动效 //红包炸弹动效
redBombLightAni(index: number, callback: Function) { redBombLightAni(index: number, callback: Function) {
//如果有 //如果有
if(movieClips["redBombLight"]) { if(gamePool.movieClips["redBombLight"]) {
var p = Tool.getPositionByIndex(index); var p = Tool.getPositionByIndex(index);
movieClips["redBombLight"].x = p[0] - 358; gamePool.movieClips["redBombLight"].x = p[0] - 358;
movieClips["redBombLight"].y = p[1] - 137; gamePool.movieClips["redBombLight"].y = p[1] - 137;
this.effectContainer.addChild(movieClips["redBombLight"]) this.effectContainer.addChild(gamePool.movieClips["redBombLight"])
movieClips["redBombLight"].gotoAndPlay(1, true); gamePool.movieClips["redBombLight"].gotoAndPlay(1, true);
setTimeout(() => { setTimeout(() => {
if(movieClips["redBombLight"].parent) { if(gamePool.movieClips["redBombLight"].parent) {
movieClips["redBombLight"].parent.removeChild(movieClips["redBombLight"]) gamePool.movieClips["redBombLight"].parent.removeChild(gamePool.movieClips["redBombLight"])
} }
}, 56 / 60 * 1000) }, 56 / 60 * 1000)
} }
...@@ -6385,10 +6390,10 @@ export default class MainScene extends Scene { ...@@ -6385,10 +6390,10 @@ export default class MainScene extends Scene {
//黑洞星星动画 //黑洞星星动画
wormlightAnm(posx,posy){ wormlightAnm(posx,posy){
let onewormlight; let onewormlight;
if(wormlightArr.length>0){ if(gamePool.wormlightArr.length>0){
onewormlight = wormlightArr.shift(); onewormlight = gamePool.wormlightArr.shift();
}else{ }else{
onewormlight = new window["SVGA"].EgretMovieClip(wormlightdata); onewormlight = new window["SVGA"].EgretMovieClip(gamePool.wormlightdata);
} }
this.effectContainer.addChild(onewormlight); this.effectContainer.addChild(onewormlight);
// console.log(onewormlight); // console.log(onewormlight);
...@@ -6412,7 +6417,7 @@ export default class MainScene extends Scene { ...@@ -6412,7 +6417,7 @@ export default class MainScene extends Scene {
onewormlight.gotoAndStop(1); onewormlight.gotoAndStop(1);
if(onewormlight.parent){ if(onewormlight.parent){
onewormlight.parent.removeChild(onewormlight); onewormlight.parent.removeChild(onewormlight);
wormlightArr.push(onewormlight); gamePool.wormlightArr.push(onewormlight);
} }
} }
...@@ -6532,10 +6537,10 @@ export default class MainScene extends Scene { ...@@ -6532,10 +6537,10 @@ export default class MainScene extends Scene {
lawnAnm(posx,posy,grass:any,grassp:any,passpos:Array<number>,index:number){ lawnAnm(posx,posy,grass:any,grassp:any,passpos:Array<number>,index:number){
var pro = new Promise((resolve)=>{ var pro = new Promise((resolve)=>{
let onelawn; let onelawn;
if(lawnArr.length>0){ if(gamePool.lawnArr.length>0){
onelawn = lawnArr.shift(); onelawn = gamePool.lawnArr.shift();
}else{ }else{
onelawn = new window["SVGA"].EgretMovieClip(lawndata); onelawn = new window["SVGA"].EgretMovieClip(gamePool.lawndata);
} }
this.effectContainer.addChild(onelawn); this.effectContainer.addChild(onelawn);
onelawn.x = posx-80; onelawn.x = posx-80;
...@@ -6547,7 +6552,7 @@ export default class MainScene extends Scene { ...@@ -6547,7 +6552,7 @@ export default class MainScene extends Scene {
onelawn.gotoAndStop(1); onelawn.gotoAndStop(1);
if(onelawn.parent){ if(onelawn.parent){
onelawn.parent.removeChild(onelawn); onelawn.parent.removeChild(onelawn);
lawnArr.push(onelawn); gamePool.lawnArr.push(onelawn);
} }
} }
onelawn.addEventListener(egret.Event.COMPLETE,compfunc); onelawn.addEventListener(egret.Event.COMPLETE,compfunc);
...@@ -7342,16 +7347,16 @@ export default class MainScene extends Scene { ...@@ -7342,16 +7347,16 @@ export default class MainScene extends Scene {
var cutx:number = foodsize[0]; var cutx:number = foodsize[0];
var cuty:number = foodsize[1]; var cuty:number = foodsize[1];
if(type==ElementType.food1){ if(type==ElementType.food1){
mv = new window["SVGA"].EgretMovieClip(xugaodata); mv = new window["SVGA"].EgretMovieClip(gamePool.xugaodata);
}else if(type==ElementType.food2){ }else if(type==ElementType.food2){
mv = new window["SVGA"].EgretMovieClip(dangaodata); mv = new window["SVGA"].EgretMovieClip(gamePool.dangaodata);
}else if(type==ElementType.food3){ }else if(type==ElementType.food3){
mv = new window["SVGA"].EgretMovieClip(tiantianquandata); mv = new window["SVGA"].EgretMovieClip(gamePool.tiantianquandata);
}else if(type==ElementType.food4){ }else if(type==ElementType.food4){
mv = new window["SVGA"].EgretMovieClip(regoudata); mv = new window["SVGA"].EgretMovieClip(gamePool.regoudata);
} }
mv.stop(); mv.stop();
...@@ -7463,19 +7468,19 @@ export default class MainScene extends Scene { ...@@ -7463,19 +7468,19 @@ export default class MainScene extends Scene {
//加载食物动画 //加载食物动画
initFoodSvgas(){ initFoodSvgas(){
var resPath = getResPath(); var resPath = getResPath();
if (!svgaParser) svgaParser = new window["SVGA"].Parser(); // if (!svgaParser) svgaParser = new window["SVGA"].Parser();
var foodarr = ["dangao","regou","tiantianquan","xugao"]; var foodarr = ["dangao","regou","tiantianquan","xugao"];
for(let i=0;i<foodarr.length;i++){ for(let i=0;i<foodarr.length;i++){
let ifood = foodarr[i]; let ifood = foodarr[i];
svgaParser.load(resPath + 'resource/assets/svgas/'+ifood+'.svga', (videoItem) => { gamePool.svgaParser.load(resPath + 'resource/assets/svgas/'+ifood+'.svga', (videoItem) => {
if(ifood=="dangao"){ if(ifood=="dangao"){
dangaodata = videoItem; gamePool.dangaodata = videoItem;
}else if(ifood=="regou"){ }else if(ifood=="regou"){
regoudata = videoItem; gamePool.regoudata = videoItem;
}else if(ifood=="tiantianquan"){ }else if(ifood=="tiantianquan"){
tiantianquandata = videoItem; gamePool.tiantianquandata = videoItem;
}else if(ifood=="xugao"){ }else if(ifood=="xugao"){
xugaodata = videoItem; gamePool.xugaodata = videoItem;
} }
}) })
} }
...@@ -7510,10 +7515,10 @@ export default class MainScene extends Scene { ...@@ -7510,10 +7515,10 @@ export default class MainScene extends Scene {
var cherryArr:Array<string> = ["cherry1_2","cherry2_3","cherry3_4","cherry4_5","cherry5_6"]; var cherryArr:Array<string> = ["cherry1_2","cherry2_3","cherry3_4","cherry4_5","cherry5_6"];
for(let i=0;i<cherryArr.length;i++){ for(let i=0;i<cherryArr.length;i++){
let icherryname = cherryArr[i]; let icherryname = cherryArr[i];
if(!cherryAniData[icherryname]){ if(!gamePool.cherryAniData[icherryname]){
if (!svgaParser) svgaParser = new window["SVGA"].Parser(); // if (!svgaParser) svgaParser = new window["SVGA"].Parser();
svgaParser.load(resPath + 'resource/assets/svgas/'+icherryname+'.svga', (videoItem) => { gamePool.svgaParser.load(resPath + 'resource/assets/svgas/'+icherryname+'.svga', (videoItem) => {
cherryAniData[icherryname] = videoItem; gamePool.cherryAniData[icherryname] = videoItem;
}) })
} }
} }
...@@ -7754,19 +7759,19 @@ export default class MainScene extends Scene { ...@@ -7754,19 +7759,19 @@ export default class MainScene extends Scene {
if(lastani){ if(lastani){
let lastoname = lastani["oname"]; let lastoname = lastani["oname"];
this.effectContainer.removeChild(lastani); this.effectContainer.removeChild(lastani);
cherryAniArr[lastoname].push(lastani); gamePool.cherryAniArr[lastoname].push(lastani);
} }
let oneani:any; let oneani:any;
let aniname = "cherry"+statold+"_"+statnew; let aniname = "cherry"+statold+"_"+statnew;
if(!cherryAniArr[aniname]){ if(!gamePool.cherryAniArr[aniname]){
cherryAniArr[aniname] = new Array(); gamePool.cherryAniArr[aniname] = new Array();
} }
if(cherryAniArr.length>0){ if(gamePool.cherryAniArr.length>0){
oneani = cherryAniArr.shift(); oneani = gamePool.cherryAniArr.shift();
}else{ }else{
oneani = new window["SVGA"].EgretMovieClip(cherryAniData[aniname]); oneani = new window["SVGA"].EgretMovieClip(gamePool.cherryAniData[aniname]);
} }
let p = Tool.getPositionByIndex(idx); let p = Tool.getPositionByIndex(idx);
...@@ -7822,7 +7827,7 @@ export default class MainScene extends Scene { ...@@ -7822,7 +7827,7 @@ export default class MainScene extends Scene {
if(isfina){ if(isfina){
//移除樱花动画 //移除樱花动画
this.effectContainer.removeChild(oneani); this.effectContainer.removeChild(oneani);
cherryAniArr[aniname].push(oneani); gamePool.cherryAniArr[aniname].push(oneani);
} }
} }
oneani.addEventListener(egret.Event.ENTER_FRAME,framefunc,this); oneani.addEventListener(egret.Event.ENTER_FRAME,framefunc,this);
...@@ -7947,6 +7952,5 @@ export default class MainScene extends Scene { ...@@ -7947,6 +7952,5 @@ export default class MainScene extends Scene {
} }
return amove; return amove;
} }
//一般 //一般
} }
\ 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