Commit 8bfe8d17 authored by zjz1994's avatar zjz1994

性能优化暂存

parent 2ea5fb9e
...@@ -25,12 +25,12 @@ export default class SceneCtrl { ...@@ -25,12 +25,12 @@ export default class SceneCtrl {
change(type: ModuleTypes, data?, onComplete?: Function) { change(type: ModuleTypes, data?, onComplete?: Function) {
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']) {
Loading.instace.show(); Loading.instace.show();
...@@ -65,17 +65,31 @@ export default class SceneCtrl { ...@@ -65,17 +65,31 @@ export default class SceneCtrl {
showAfterLoadAtlas(scene: Scene, data, onComplete: Function) { showAfterLoadAtlas(scene: Scene, data, onComplete: Function) {
Loading.instace.hide(); Loading.instace.hide();
scene.loadSkin(); scene.loadSkin();
scene.addEventListener(egret.Event.ADDED_TO_STAGE, () => { // console.log("showAfterLoadAtlas",scene.skinName);
// scene.addEventListener(egret.Event.ADDED_TO_STAGE, () => {
// console.log("addToStageListener",scene.skinName);
// scene.start(data);
// }, this);
// scene.addEventListener(egret.Event.ADDED_TO_STAGE,this.sceneAddStateListener,this);
scene.once(egret.Event.ADDED_TO_STAGE, () => {
// console.log("addToStageListener",scene.skinName);
scene.start(data); scene.start(data);
}, this); }, this);
scene.onLoad().then(() => { scene.onLoad().then(() => {
// console.log("onLoad---after",scene.skinName);
this.addToStage(scene); this.addToStage(scene);
onComplete && onComplete(); onComplete && onComplete();
}); });
} }
// sceneAddStateListener(e){
// console.log("addToStageListener",e.target.skinName);
// let scene = e.target;
// scene.start(data);
// }
addMask() { addMask() {
if (!this._mask) { if (!this._mask) {
this._mask = new egret.Sprite(); this._mask = new egret.Sprite();
......
...@@ -74,7 +74,7 @@ import { ...@@ -74,7 +74,7 @@ import {
submitTran, submitTran,
forwardDirection, forwardDirection,
} from '../something/enum/ElementType'; } from '../something/enum/ElementType';
import { isIce, isSpecialLattice, isSand, isBlock } from '../something/enum/LatticeType'; import { isIce, isSpecialLattice, isSand, isBlock, LatticeType } from '../something/enum/LatticeType';
import { PassType } from '../something/enum/PassType'; import { PassType } from '../something/enum/PassType';
import { RecoverName } from '../something/enum/RecoverName'; import { RecoverName } from '../something/enum/RecoverName';
import { StateType } from '../something/enum/StateType'; import { StateType } from '../something/enum/StateType';
...@@ -380,8 +380,8 @@ export default class MainScene extends Scene { ...@@ -380,8 +380,8 @@ export default class MainScene extends Scene {
//初始换道具容器 //初始换道具容器
this.propBtnCon = new PropBtnCon(); this.propBtnCon = new PropBtnCon();
this.propBtnCon.y = 299 + Tool.gameAreaHeight// + 55;
this.addChild(this.propBtnCon); this.addChild(this.propBtnCon);
console.log("添加道具group",this.propBtnCon);
this.mapContainer = new egret.DisplayObjectContainer(); this.mapContainer = new egret.DisplayObjectContainer();
this.addChild(this.mapContainer); this.addChild(this.mapContainer);
...@@ -420,6 +420,16 @@ export default class MainScene extends Scene { ...@@ -420,6 +420,16 @@ export default class MainScene extends Scene {
async start(data) { async start(data) {
super.start(); super.start();
this.emptys = new Array();
this.warningCop = new Array();
this.eliminatedElements = new Array();
this.lollipopMark = false;
this.hasEliminatedElements = new Array();
this.scoreAnis = new Array();
this.cannoArr = new Array();
this.cannoEffect = new Array();
this.readyCannoArr = new Array();
this.fireteamCannoArr = new Array();
this.mapContainer.removeChildren(); this.mapContainer.removeChildren();
this.mapupContainer.removeChildren(); this.mapupContainer.removeChildren();
...@@ -615,7 +625,6 @@ export default class MainScene extends Scene { ...@@ -615,7 +625,6 @@ export default class MainScene extends Scene {
mvdata = cannoparticlemvdata; mvdata = cannoparticlemvdata;
} }
if(mvdata){ if(mvdata){
// console.log("复用mvdata,免加载");
let mv = new window["SVGA"].EgretMovieClip(mvdata); let mv = new window["SVGA"].EgretMovieClip(mvdata);
this.initCannoMv(mv,jsvgname,i); this.initCannoMv(mv,jsvgname,i);
}else{ }else{
...@@ -748,7 +757,8 @@ export default class MainScene extends Scene { ...@@ -748,7 +757,8 @@ export default class MainScene extends Scene {
//当前分数 //当前分数
//初始换道具容器 //初始换道具容器
this.propBtnCon.y = 299 + Tool.gameAreaHeight// + 55;
this.propGuide.changeOffset(this.propBtnCon.y);
//初始化道具信息 //初始化道具信息
this.updateScene(); this.updateScene();
...@@ -912,7 +922,8 @@ export default class MainScene extends Scene { ...@@ -912,7 +922,8 @@ export default class MainScene extends Scene {
mask.addChild(oneMask); mask.addChild(oneMask);
list.forEach(i => { list.forEach(i => {
const arrow = createArrowBg(tex); const arrow = Tool.getConver();
arrow.rotation = getArrowRotation(dir); arrow.rotation = getArrowRotation(dir);
conveyorContainer.addChild(arrow); conveyorContainer.addChild(arrow);
const p = Tool.getPositionByIndex(i); const p = Tool.getPositionByIndex(i);
...@@ -950,14 +961,16 @@ export default class MainScene extends Scene { ...@@ -950,14 +961,16 @@ export default class MainScene extends Scene {
latticeDisplay = ice; latticeDisplay = ice;
this.lattices[i].ice = ice; this.lattices[i].ice = ice;
} else if(isSand(latticesD[i])) { } else if(isSand(latticesD[i])) {
latticeDisplay = Pool.takeOut(RecoverName.SAND);
if(!latticeDisplay){
latticeDisplay = getSandDisplayBlock(); latticeDisplay = getSandDisplayBlock();
}
this.lattices[i].sand = latticeDisplay as Sand; this.lattices[i].sand = latticeDisplay as Sand;
} else { } else {
latticeDisplay = genBlockDisplay(latticesD[i]); latticeDisplay = genBlockDisplay(latticesD[i]);
this.lattices[i].block = latticeDisplay as BaseBlock; this.lattices[i].block = latticeDisplay as BaseBlock;
} }
if(latticeDisplay) { if(latticeDisplay) {
// this.map.addChild(latticeDisplay);
this.mapupContainer.addChild(latticeDisplay); this.mapupContainer.addChild(latticeDisplay);
latticeDisplay.x = p[0]; latticeDisplay.x = p[0];
latticeDisplay.y = p[1]; latticeDisplay.y = p[1];
...@@ -1020,8 +1033,9 @@ export default class MainScene extends Scene { ...@@ -1020,8 +1033,9 @@ export default class MainScene extends Scene {
var elements = this.chapterData.map.elements || Tool.setNumber01(this.chapterData.map.lattices.slice()); var elements = this.chapterData.map.elements || Tool.setNumber01(this.chapterData.map.lattices.slice());
//猩猩初始时加入 //猩猩初始时加入
var pongoArr:Array<{tl:number,tr:number,bl:number,br:number}> = new Array(); var pongoArr:Array<{tl:number,tr:number,bl:number,br:number}> = new Array();
console.log("开始initElement",this.chapter);
for(var i = 0; i < elements.length; i++) { for(let i = 0; i < elements.length; i++) {
// console.log("initElement遍历-------",i);
//如果对应格子为空,直接跳过, //如果对应格子为空,直接跳过,
if(!this.lattices[i]) continue; if(!this.lattices[i]) continue;
var p = Tool.getPositionByIndex(i); var p = Tool.getPositionByIndex(i);
...@@ -1044,6 +1058,7 @@ export default class MainScene extends Scene { ...@@ -1044,6 +1058,7 @@ export default class MainScene extends Scene {
if(!ele) { if(!ele) {
ele = new Element(type) ele = new Element(type)
} else { } else {
// console.log("initElement复用ele",i,elements[i],Tool.indexToRc(i));
ele.reset(type) ele.reset(type)
} }
ele.x = p[0]; ele.x = p[0];
...@@ -1079,6 +1094,7 @@ export default class MainScene extends Scene { ...@@ -1079,6 +1094,7 @@ export default class MainScene extends Scene {
if(!lol) { if(!lol) {
lol = new Element(ElementType.LOLLIPOP) lol = new Element(ElementType.LOLLIPOP)
} else { } else {
// console.log("initElement复用ele",i,elements[i],Tool.indexToRc(i));
lol.reset(ElementType.LOLLIPOP) lol.reset(ElementType.LOLLIPOP)
} }
lol.x = p[0]; lol.x = p[0];
...@@ -1092,6 +1108,7 @@ export default class MainScene extends Scene { ...@@ -1092,6 +1108,7 @@ export default class MainScene extends Scene {
if(!rock) { if(!rock) {
rock = new Element(ElementType.ROCK) rock = new Element(ElementType.ROCK)
} else { } else {
// console.log("initElement复用ele",i,elements[i],Tool.indexToRc(i));
rock.reset(ElementType.ROCK) rock.reset(ElementType.ROCK)
} }
rock.x = p[0]; rock.x = p[0];
...@@ -1465,10 +1482,6 @@ export default class MainScene extends Scene { ...@@ -1465,10 +1482,6 @@ export default class MainScene extends Scene {
this.musicBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_musicBtn, this) this.musicBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_musicBtn, this)
this.quitBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_quitBtn, this) this.quitBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_quitBtn, this)
this.propBtnCon.boomBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_boomBtn, this)
this.propBtnCon.hammerBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_hammerBtn, this)
this.propBtnCon.stepBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_stepBtn, this)
this.elementContainer.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, this.mouseDownE, this); this.elementContainer.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, this.mouseDownE, this);
this.elementContainer.removeEventListener(egret.TouchEvent.TOUCH_MOVE, this.mouseMoveE, this); this.elementContainer.removeEventListener(egret.TouchEvent.TOUCH_MOVE, this.mouseMoveE, this);
...@@ -1483,6 +1496,9 @@ export default class MainScene extends Scene { ...@@ -1483,6 +1496,9 @@ export default class MainScene extends Scene {
//容器事件 //容器事件
this.elementContainer.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, this.mouseDownE, this); this.elementContainer.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, this.mouseDownE, this);
this.elementContainer.removeEventListener(egret.TouchEvent.TOUCH_MOVE, this.mouseMoveE, this); this.elementContainer.removeEventListener(egret.TouchEvent.TOUCH_MOVE, this.mouseMoveE, this);
this.reCoverAllLattice();
} }
onEnterFrame() { onEnterFrame() {
...@@ -5004,6 +5020,55 @@ export default class MainScene extends Scene { ...@@ -5004,6 +5020,55 @@ export default class MainScene extends Scene {
return ele return ele
} }
/**
* 关闭页面时,回收所有的元素
*/
reCoverAllLattice(){
if(this.warningCop){
egret.Tween.removeTweens(this.warningCop[0]);
egret.Tween.removeTweens(this.warningCop[1]);
}
console.log("页面回收");
for(let i=0;i<this.lattices.length;i++){
let ilattice = this.lattices[i];
if(!ilattice)continue;
this.recoverMapast(ilattice);
this.recoverEleast(ilattice);
}
}
recoverMapast(lat:Lattice){
if(lat.ice&&lat.ice.parent){
let ice = lat.ice;
ice.parent.removeChild(ice);
Pool.recover(RecoverName.ICE,ice);
}else if(lat.block&&lat.block.parent){
let block = lat.block;
block.parent.removeChild(block);
if(lat.block.blocktype==LatticeType.BlOCK){
Pool.recover(RecoverName.BLOCK,block);
}else if(lat.block.blocktype==LatticeType.BLOCK_AND_ICE){
Pool.recover(RecoverName.ICE_BLOCK,block);
}else if(lat.block.blocktype==LatticeType.BLOCK_AND_DARK_ICE){
Pool.recover(RecoverName.DARK_ICE_BLOCK,block);
}
}else if(lat.sand&&lat.sand.parent){
let sand = lat.sand;
sand.parent.removeChild(sand);
Pool.recover(RecoverName.SAND,sand);
}
}
recoverEleast(lat:Lattice){
let ele = lat.element;
if(!ele)return;
if(ele&&ele.parent){
ele.addDisable();
ele.parent.removeChild(ele);
Pool.recover(RecoverName.ELEMENT,ele);
}
}
/** /**
* 禁用与开启事件 * 禁用与开启事件
......
...@@ -10,6 +10,7 @@ import { GenerateLatData } from "./interface/GenerateLatData"; ...@@ -10,6 +10,7 @@ import { GenerateLatData } from "./interface/GenerateLatData";
import { Pool } from "./Pool"; import { Pool } from "./Pool";
import HoneyPotElement from "./class/HoneyPotElement"; import HoneyPotElement from "./class/HoneyPotElement";
import { ElementConfigType } from "./enum/ElementConfigType"; import { ElementConfigType } from "./enum/ElementConfigType";
import createArrowBg from "./conveyor/createArrowBg";
//两种,0无棒棒糖,1有 //两种,0无棒棒糖,1有
const offsetYTwo: number[] = []; const offsetYTwo: number[] = [];
...@@ -1162,9 +1163,13 @@ export class Tool { ...@@ -1162,9 +1163,13 @@ export class Tool {
/** /**
* 传送带 * 传送带
*/ */
// public static getConver():egret.Sprite{ public static getConver():egret.Sprite{
let sp:egret.Sprite = Pool.takeOut(RecoverName.CONVEYOR);
// } if(!sp){
sp = createArrowBg();
}
return sp;
}
/** /**
* 返回个十百等,0是个位 ,1是十位,依次 * 返回个十百等,0是个位 ,1是十位,依次
......
import centerAnchor from "./centerAnchor"; import centerAnchor from "./centerAnchor";
import { Element } from "../class/Element"; import { Element } from "../class/Element";
import { StateType } from "../enum/StateType"; import { StateType } from "../enum/StateType";
import { LatticeType } from "../enum/LatticeType";
export default class BaseBlock extends egret.DisplayObjectContainer { export default class BaseBlock extends egret.DisplayObjectContainer {
_inited = false; _inited = false;
constructor(state) {
blocktype:LatticeType;
constructor(state,blocktype:LatticeType) {
super(); super();
this._state = state; this._state = state;
this.blocktype = blocktype;
this.initUI(); this.initUI();
} }
initUI() { initUI() {
this._block = new egret.Bitmap(RES.getRes('common_block_png')); this._block = new egret.Bitmap(RES.getRes('common_block_png'));
this._blockBgFront = new egret.Bitmap(RES.getRes('common_block_front_png')); this._blockBgFront = new egret.Bitmap(RES.getRes('common_block_front_png'));
......
...@@ -2,6 +2,8 @@ import { LatticeType } from "../enum/LatticeType"; ...@@ -2,6 +2,8 @@ import { LatticeType } from "../enum/LatticeType";
import Block from "./Block"; import Block from "./Block";
import BlockDarkIce from "./BlockDarkIce"; import BlockDarkIce from "./BlockDarkIce";
import BlockIce from "./BlockIce"; import BlockIce from "./BlockIce";
import { Pool } from "../Pool";
import { RecoverName } from "../enum/RecoverName";
export default (type: LatticeType) => { export default (type: LatticeType) => {
const typestr = type + ''; const typestr = type + '';
...@@ -14,12 +16,36 @@ export default (type: LatticeType) => { ...@@ -14,12 +16,36 @@ export default (type: LatticeType) => {
} }
switch (type) { switch (type) {
case LatticeType.BlOCK: case LatticeType.BlOCK:
return new Block(_state); let block = Pool.takeOut(RecoverName.BLOCK);
if(!block){
block = new Block(_state,LatticeType.BlOCK);
}else{
block._state = _state;
}
return block;
case LatticeType.BLOCK_AND_ICE: case LatticeType.BLOCK_AND_ICE:
return new BlockIce(_state); let iceblock = Pool.takeOut(RecoverName.ICE_BLOCK);
if(!iceblock){
iceblock = new BlockIce(_state,LatticeType.BLOCK_AND_ICE);
}else{
iceblock._state = _state;
iceblock.ice.alpha = 0.6;
iceblock.ice.visible = false;
iceblock.iceCountNum = 1;
}
return iceblock;
case LatticeType.BLOCK_AND_DARK_ICE: case LatticeType.BLOCK_AND_DARK_ICE:
return new BlockDarkIce(_state); let darkiceblock = Pool.takeOut(RecoverName.DARK_ICE_BLOCK);
if(!darkiceblock){
darkiceblock = new BlockDarkIce(_state,LatticeType.BLOCK_AND_DARK_ICE);
}else{
darkiceblock._state = _state;
iceblock.ice.alpha = 1;
iceblock.ice.visible = false;
iceblock.iceCountNum = 2;
}
return darkiceblock;
default: default:
break; break;
} }
......
...@@ -163,9 +163,83 @@ export const Chapters24: ChapterData[] = [ ...@@ -163,9 +163,83 @@ export const Chapters24: ChapterData[] = [
2, 14, 2, 1, 5, 1, 2, 14, 2, 2, 14, 2, 1, 5, 1, 2, 14, 2,
2, 2, 2, 5, 5, 5, 2, 2, 2 ], baseElements: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], recycles: [], generateLats: [ { index: 0, type: null }, { index: 1, type: null }, { index: 7, type: null }, { index: 8, type: null }, { index: 11, type: null }, { index: 15, type: null }, { index: 21, type: null }, { index: 23, type: null }, { index: 31, type: null } ] } }, 2, 2, 2, 5, 5, 5, 2, 2, 2 ], baseElements: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], recycles: [], generateLats: [ { index: 0, type: null }, { index: 1, type: null }, { index: 7, type: null }, { index: 8, type: null }, { index: 11, type: null }, { index: 15, type: null }, { index: 21, type: null }, { index: 23, type: null }, { index: 31, type: null } ] } },
//623 //623
{ baseElementTypes: [ 1, 2, 3, 4 ], bubbleProbability: 0, stepCount: 23, passTarget: { type: 1, elements: [ { type: 1, count: 115 }, { type: 4, count: 106 } ] }, starScores: [ 15000, 20000, 25000 ], map: { lattices: [ 3, 3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 0, 3, 41, 3, 3, 3, 3, 3, 41, 3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 0, 3, 0, 3, 4, 3, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0 ], connectedLats: [], conveyor: [], conveyorConnectedLats: [], elements: [ 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 0, 1, 1, 1, 1, 1, 2, 1, 0, 0, 1, 1, 1, 1, 2, 1, 1, 0, 0, 1, 1, 1, 2, 1, 0, 1, 0, 0, 1, 1, 2, 1, 0, 0, 1, 0, 0, 1, 2, 1, 1, 0, 0, 12, 0, 1, 2, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1 ], baseElements: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], recycles: [], generateLats: [ { index: 0, type: null }, { index: 1, type: null }, { index: 2, type: null }, { index: 3, type: null }, { index: 4, type: null }, { index: 5, type: null }, { index: 6, type: null }, { index: 7, type: null }, { index: 17, type: null }, { index: 25, type: null }, { index: 41, type: null }, { index: 49, type: null } ] } }, { baseElementTypes: [ 1, 2, 3, 4 ],
bubbleProbability: 0, stepCount: 23,
passTarget: { type: 1, elements: [ { type: 1, count: 115 }, { type: 4, count: 106 } ] }, starScores: [ 15000, 20000, 25000 ],
map: {
lattices: [
3, 3, 3, 3, 3, 3, 3, 3, 0,
3, 3, 3, 3, 3, 3, 3, 0, 3,
3, 3, 3, 3, 3, 3, 4, 3, 3,
3, 3, 3, 3, 3, 0, 3, 3, 3,
3, 3, 3, 3, 0, 3, 41, 3, 3,
3, 3, 3, 41, 3, 3, 3, 3, 3,
3, 3, 0, 3, 3, 3, 3, 3, 0,
3, 0, 3, 4, 3, 0, 0, 0, 0,
0, 3, 3, 0, 0, 0, 0, 0, 0
], connectedLats: [], conveyor: [], conveyorConnectedLats: [],
elements: [
1, 1, 1, 1, 1, 1, 1, 2, 1,
1, 1, 1, 1, 1, 1, 2, 1, 0,
1, 1, 1, 1, 1, 2, 1, 0, 0,
1, 1, 1, 1, 2, 1, 1, 0, 0,
1, 1, 1, 2, 1, 0, 1, 0, 0,
1, 1, 2, 1, 0, 0, 1, 0, 0,
1, 2, 1, 1, 0, 0, 12, 0, 1,
2, 1, 0, 1, 0, 1, 1, 1, 1,
1, 0, 0, 1, 1, 1, 1, 1, 1
],
baseElements: [
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0
], recycles: [], generateLats: [ { index: 0, type: null }, { index: 1, type: null }, { index: 2, type: null }, { index: 3, type: null }, { index: 4, type: null }, { index: 5, type: null }, { index: 6, type: null }, { index: 7, type: null }, { index: 17, type: null }, { index: 25, type: null }, { index: 41, type: null }, { index: 49, type: null } ] } },
//624 //624
{ baseElementTypes: [ 1, 0, 2, 4 ], bubbleProbability: 0, stepCount: 21, passTarget: { type: 1, elements: [ { type: 36, count: 69 } ] }, starScores: [ 15000, 20000, 25000 ], map: { lattices: [ 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 0, 7, 0, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 41, 41, 0, 7, 7, 7, 0, 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 ], connectedLats: [], conveyor: [], conveyorConnectedLats: [], elements: [ 1, 16, 1, 1, 1, 1, 1, 16, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 1, 1, 1, 5, 5, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], baseElements: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], recycles: [], generateLats: [ { index: 0, type: null }, { index: 1, type: null }, { index: 2, type: null }, { index: 3, type: null }, { index: 4, type: null }, { index: 5, type: null }, { index: 6, type: null }, { index: 7, type: null }, { index: 8, type: null }, { index: 18, type: null }, { index: 26, type: null } ] } }, { baseElementTypes: [ 1, 0, 2, 4 ],
bubbleProbability: 0, stepCount: 21,
passTarget: { type: 1, elements: [ { type: 36, count: 69 } ] },
starScores: [ 15000, 20000, 25000 ],
map: {
lattices: [
7, 7, 7, 7, 7, 7, 7, 7, 7,
0, 7, 7, 7, 7, 7, 7, 7, 0,
7, 0, 7, 7, 7, 7, 7, 0, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7,
41, 41, 0, 7, 7, 7, 0, 4, 4,
7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 0, 7, 7, 7, 7, 7, 0, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7
], connectedLats: [], conveyor: [], conveyorConnectedLats: [],
elements: [
1, 16, 1, 1, 1, 1, 1, 16, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 4, 4, 4, 1, 1, 1,
5, 5, 1, 2, 2, 2, 1, 1, 1,
1, 1, 1, 4, 4, 4, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 4, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1
],
baseElements: [
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0
], recycles: [],
generateLats: [ { index: 0, type: null }, { index: 1, type: null }, { index: 2, type: null }, { index: 3, type: null }, { index: 4, type: null }, { index: 5, type: null }, { index: 6, type: null }, { index: 7, type: null }, { index: 8, type: null }, { index: 18, type: null }, { index: 26, type: null } ] } },
//625 //625
{ baseElementTypes: [ 0, 2, 3, 4 ], bubbleProbability: 0, stepCount: 25, passTarget: { type: 1, elements: [ { type: 24, count: 20 }, { type: 26, count: 20 } ] }, starScores: [ 15000, 20000, 25000 ], map: { lattices: [ 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], connectedLats: [], conveyor: [], conveyorConnectedLats: [], elements: [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 13, 13, 13, 13, 13, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 1, 1, 1, 2, 2, 1, 2, 1, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ], baseElements: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, 11, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], recycles: [], generateLats: [ { index: 1, type: null }, { index: 2, type: null }, { index: 3, type: null }, { index: 4, type: null }, { index: 5, type: null }, { index: 6, type: null }, { index: 7, type: null }, { index: 18, type: null }, { index: 26, type: null }, { index: 47, type: null }, { index: 48, type: null }, { index: 49, type: null }, { index: 50, type: null }, { index: 51, type: null } ] } } { baseElementTypes: [ 0, 2, 3, 4 ], bubbleProbability: 0, stepCount: 25, passTarget: { type: 1, elements: [ { type: 24, count: 20 }, { type: 26, count: 20 } ] }, starScores: [ 15000, 20000, 25000 ], map: { lattices: [ 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], connectedLats: [], conveyor: [], conveyorConnectedLats: [], elements: [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 13, 13, 13, 13, 13, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 1, 1, 1, 2, 2, 1, 2, 1, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ], baseElements: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, 11, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], recycles: [], generateLats: [ { index: 1, type: null }, { index: 2, type: null }, { index: 3, type: null }, { index: 4, type: null }, { index: 5, type: null }, { index: 6, type: null }, { index: 7, type: null }, { index: 18, type: null }, { index: 26, type: null }, { index: 47, type: null }, { index: 48, type: null }, { index: 49, type: null }, { index: 50, type: null }, { index: 51, type: null } ] } }
] ]
...@@ -103,24 +103,29 @@ export class Element extends eui.Component { ...@@ -103,24 +103,29 @@ export class Element extends eui.Component {
resetFireworks(thisobj) { resetFireworks(thisobj) {
this.changeSource('empty_png'); this.changeSource('empty_png');
this.showImage.alpha = 0; this.showImage.alpha = 0;
if(this._fireworks){
}else{
const mv: any = initSvga(getFireworksVideoItem()); const mv: any = initSvga(getFireworksVideoItem());
this._fireworks = mv; this._fireworks = mv;
thisobj.addChild(mv);
mv.anchorOffsetX = 340 / 2; mv.anchorOffsetX = 340 / 2;
mv.anchorOffsetY = 500; mv.anchorOffsetY = 500;
mv.x = this.x; mv.x = this.x;
mv.y = this.y - 38; mv.y = this.y - 38;
this._fireworks.gotoAndStop(1);
} }
thisobj.addChild(this._fireworks);
this._fireworks.gotoAndStop(1);
}
toFireworksAction(start, end) { toFireworksAction(start, end) {
const cb = () => { const cb = () => {
if (this._fireworks.currentFrame == end) { //向上吹 if (this._fireworks.currentFrame == end) { //向上吹
this._fireworks.gotoAndStop(start); this._fireworks.gotoAndStop(start);
this._fireworks.removeEventListener(egret.Event.ENTER_FRAME, cb, this); // this._fireworks.removeEventListener(egret.Event.ENTER_FRAME, cb, this);
} }
}; };
this._fireworks.addEventListener(egret.Event.ENTER_FRAME, cb, this); this._fireworks.once(egret.Event.ENTER_FRAME, cb, this);
this._fireworks.gotoAndPlay(start, true); this._fireworks.gotoAndPlay(start, true);
} }
...@@ -128,13 +133,17 @@ export class Element extends eui.Component { ...@@ -128,13 +133,17 @@ export class Element extends eui.Component {
async resetMonster() { async resetMonster() {
this.changeSource('empty_png'); this.changeSource('empty_png');
this.showImage.alpha = 0; this.showImage.alpha = 0;
if(this._mv){
}else{
const mv: any = await loadSvga(getResPath() + 'resource/assets/svgas/monster.svga'); const mv: any = await loadSvga(getResPath() + 'resource/assets/svgas/monster.svga');
this._mv = mv; this._mv = mv;
this.addChild(mv);
mv.anchorOffsetX = 150; mv.anchorOffsetX = 150;
mv.anchorOffsetY = 150; mv.anchorOffsetY = 150;
mv.x = - 3; mv.x = - 3;
mv.y = - 6; mv.y = - 6;
}
this.addChild(this._mv);
this.toStandByAction(); this.toStandByAction();
} }
...@@ -150,15 +159,19 @@ export class Element extends eui.Component { ...@@ -150,15 +159,19 @@ export class Element extends eui.Component {
toStandByAction() { toStandByAction() {
if (!this._mv) return; if (!this._mv) return;
const mv = this._mv; const mv = this._mv;
const cb = () => { // const cb = () => {
if (mv.currentFrame == 360) { //向上吹 // if (mv.currentFrame == 360) { //向上吹
// mv.gotoAndPlay(1, true);
// }
// };
this._mv.addEventListener(egret.Event.ENTER_FRAME, this._mvEnterFrame1, this);
mv.gotoAndPlay(1, true); mv.gotoAndPlay(1, true);
} }
}; _mvEnterFrame1(){
this._mv.addEventListener(egret.Event.ENTER_FRAME, cb, this); if(this._mv.currentFrame == 360){
mv.gotoAndPlay(1, true); this._mv.gotoAndPlay(1,true);
}
} }
toAction() { toAction() {
return new Promise((r) => { return new Promise((r) => {
if (!this._mv) { if (!this._mv) {
...@@ -170,6 +183,7 @@ export class Element extends eui.Component { ...@@ -170,6 +183,7 @@ export class Element extends eui.Component {
const cb = () => { const cb = () => {
if (mv.currentFrame == 508) { //向上吹 if (mv.currentFrame == 508) { //向上吹
this.toStandByAction(); this.toStandByAction();
this._mv.removeEventListener(egret.Event.ENTER_FRAME,cb,this);
} }
if (mv.currentFrame == 391) { if (mv.currentFrame == 391) {
r(); r();
...@@ -952,14 +966,47 @@ export class Element extends eui.Component { ...@@ -952,14 +966,47 @@ export class Element extends eui.Component {
this.showImage.anchorOffsetY = 0; this.showImage.anchorOffsetY = 0;
this.showImage.scaleY = 1; this.showImage.scaleY = 1;
this.showImage.scaleX = 1; this.showImage.scaleX = 1;
this.showImage.alpha = 1;
egret.Tween.removeTweens(this.showImage); egret.Tween.removeTweens(this.showImage);
//类型重置,showImage修改 //类型重置,showImage修改
this._type = type; this._type = type;
this.cannobox.visible = this.cannolab.visible = type == ElementType.CANNO; this.cannobox.visible = this.cannolab.visible = type == ElementType.CANNO;
this.showImage.visible = type != ElementType.CANNO; this.showImage.visible = type != ElementType.CANNO;
this.cannolab.visible = false; this.cannolab.visible = false;
this.inPongoPart = null;
//重置element
if(this._mv&&this._mv.parent){
this._mv.removeEventListener(egret.Event.ENTER_FRAME,this._mvEnterFrame1,this);
this._mv.parent.removeChild(this._mv);
console.log("有怪物",type);
}
if(this._fireworks&&this._fireworks.parent){
this._fireworks.parent.removeChild(this._fireworks);
}
if(this.cannoMoveClip&&this.cannoMoveClip.parent){
this.cannoMoveClip.removeEventListener(egret.Event.ENTER_FRAME,this.toFrameAni,this);
this.cannoMoveClip.parent.removeChild(this.cannoMoveClip);
}
if(this.pongoMoveClip&&this.pongoMoveClip.parent){
this.pongoMoveClip.removeEventListener(egret.Event.ENTER_FRAME,this.pongoFrameAni,this);
this.pongoMoveClip.parent.removeChild(this.pongoMoveClip);
}
if(this.pongoMvLeftJio&&this.pongoMvLeftJio.parent){
this.pongoMvLeftJio.removeEventListener(egret.Event.COMPLETE,this.pongoRmLeftJio,this);
this.pongoMvLeftJio.parent.removeChild(this.pongoMvLeftJio);
}
if(this.pongoMvRightJio&&this.pongoMvRightJio.parent){
this.pongoMvRightJio.removeEventListener(egret.Event.COMPLETE,this.pongoRmRightJio,this);
this.pongoMvRightJio.parent.removeChild(this.pongoMvRightJio);
}
if(type==ElementType.Pongo||type==ElementType.CANNO){
}else{
this.changeSource("ele" + type + "_png"); this.changeSource("ele" + type + "_png");
}
//特效重置 //特效重置
this.effectType = null; this.effectType = null;
this.temEffectType = null; this.temEffectType = null;
......
...@@ -79,4 +79,9 @@ export enum RecoverName { ...@@ -79,4 +79,9 @@ export enum RecoverName {
BLOCK_STATE = "BLOCK_STATE", BLOCK_STATE = "BLOCK_STATE",
CONVEYOR = 'CONVEYOR', CONVEYOR = 'CONVEYOR',
SAND = 'SAND',
BLOCK = 'BLOCK',
ICE_BLOCK = 'ICE_BLOCK',
DARK_ICE_BLOCK = 'DARK_ICE_BLOCK',
} }
\ No newline at end of file
...@@ -44,6 +44,12 @@ export class PropGuide extends egret.DisplayObjectContainer { ...@@ -44,6 +44,12 @@ export class PropGuide extends egret.DisplayObjectContainer {
if (this.parent) this.parent.removeChild(this) if (this.parent) this.parent.removeChild(this)
}, this) }, this)
} }
changeOffset(offsetY: number){
this.boomBtn.y = offsetY - 55;
this.hammerBtn.y = offsetY - 55;
this.stepBtn.y = offsetY - 55;
this.msgTxt.y = offsetY - 80;
}
init(prop: PropType) { init(prop: PropType) {
if (prop == PropType.BOOM) { if (prop == PropType.BOOM) {
this.boomBtn.visible = true; this.boomBtn.visible = true;
......
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