Commit 27d77726 authored by zjz1994's avatar zjz1994

Merge branch '优化性能' of http://gitlab2.dui88.com/wanghongyuan/xiaoxiaole into 黑洞

# Conflicts:
#	egret/src/mainScene/MainScene.ts
#	egret/src/something/Tool.ts
#	egret/src/something/block/BaseBlock.ts
#	egret/src/something/class/Element.ts
合并性能优化
parents 168ecf72 49f02422
......@@ -188,6 +188,7 @@ export default class MainBase extends eui.UILayer {
panels.forEach(item => PanelCtrl.instance.registerPanel(item[0], item[1]));
scenes.forEach(item => SceneCtrl.instance.registerScene(item[0], item[1]));
// console.log("sceneCtrl所有的场景",SceneCtrl.instance._sceneClassMap);
// NetManager.ins.onNotSuccess = (msg) => {
// s
// }
......
......@@ -28,7 +28,7 @@ export default class ComponentBase extends eui.Component {
protected onSkinComplete() {
}
destroy() {
this.removeEvents();
}
......
......@@ -2,12 +2,17 @@ import { ModuleTypes } from "../types/sceneTypes";
import Scene from "../components/Scene";
import Loading from "../components/Loading";
import wait from "../../new_tc/wait";
import MainScene from "../../../src/mainScene/MainScene";
import MapScene from "../../../src/mapScene/MapScene";
export default class SceneCtrl {
private _parent: egret.Sprite;
private _currentScene: Scene;
private _mask: egret.Sprite;
static _instance: SceneCtrl;
mainscene:MainScene;
mapscene:MapScene;
static get instance() {
return SceneCtrl._instance || (SceneCtrl._instance = new SceneCtrl())
}
......@@ -21,36 +26,93 @@ export default class SceneCtrl {
}
change(type: ModuleTypes, data?, onComplete?: Function) {
const cls = this._sceneClassMap[type];
const scene: Scene = new cls();
if (!window['development']) {
if (type != ModuleTypes.MAP_SCENE)
Loading.instace.show();
const key = scene.skinKey.toLowerCase();
const promise = Promise.all([
RES.getResAsync(`${key}_json`),
RES.getResAsync(`${key}_png`)]);
promise.then(() => {
// console.log("sceneCtrl------change",type,data,onComplete);
if(type==ModuleTypes.MAIN_SCENE){//游戏页
// console.log("游戏界面单例处理");
if(this.mainscene){
// console.log("使用已存在mainscene");
this.showAfterLoadAtlas(this.mainscene,data,onComplete);
}else{
// console.log("第一次创建mainscene");
this.mainscene = new MainScene();
if (!window['development']) {
Loading.instace.show();
const promise = Promise.all([
RES.getResAsync(`${'main2'}_json`),
RES.getResAsync(`${'main2'}_png`)]);
promise.then(() => {
this.showAfterLoadAtlas(this.mainscene, data, onComplete);
});
} else {
this.showAfterLoadAtlas(this.mainscene, data, onComplete);
}
}
}
else if(type==ModuleTypes.MAP_SCENE){//mapscene
if(this.mapscene){
// console.log("单例mapscene");
this.showAfterLoadAtlas(this.mapscene,data,onComplete);
}else{
// console.log("新建mapscene");
this.mapscene = new MapScene(data);
if (!window['development']) {
const promise = Promise.all([
RES.getResAsync(`${'Map'}_json`),
RES.getResAsync(`${'Map'}_png`)]);
promise.then(() => {
this.showAfterLoadAtlas(this.mapscene, data, onComplete);
});
} else {
this.showAfterLoadAtlas(this.mapscene, data, onComplete);
}
}
}
else{
const cls = this._sceneClassMap[type];
const scene: Scene = new cls();
if (!window['development']) {
// if (type != ModuleTypes.MAP_SCENE)
Loading.instace.show();
const key = scene.skinKey.toLowerCase();
const promise = Promise.all([
RES.getResAsync(`${key}_json`),
RES.getResAsync(`${key}_png`)]);
promise.then(() => {
this.showAfterLoadAtlas(scene, data, onComplete);
});
} else {
this.showAfterLoadAtlas(scene, data, onComplete);
});
} else {
this.showAfterLoadAtlas(scene, data, onComplete);
}
}
}
showAfterLoadAtlas(scene: Scene, data, onComplete: Function) {
Loading.instace.hide();
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);
}, this);
scene.onLoad().then(() => {
// console.log("onLoad---after",scene.skinName);
this.addToStage(scene);
onComplete && onComplete();
});
}
// sceneAddStateListener(e){
// console.log("addToStageListener",e.target.skinName);
// let scene = e.target;
// scene.start(data);
// }
addMask() {
if (!this._mask) {
this._mask = new egret.Sprite();
......@@ -78,7 +140,7 @@ export default class SceneCtrl {
});
}
private _sceneClassMap: any;
_sceneClassMap: any;
registerScene(name, config) {
this._sceneClassMap = this._sceneClassMap || {};
this._sceneClassMap[name] = config.cls;
......
This diff is collapsed.
This diff is collapsed.
......@@ -11,6 +11,7 @@ import { Pool } from "./Pool";
import HoneyPotElement from "./class/HoneyPotElement";
import { ElementConfigType } from "./enum/ElementConfigType";
import WormHole from "./class/WormHole";
import createArrowBg from "./conveyor/createArrowBg";
//两种,0无棒棒糖,1有
const offsetYTwo: number[] = [];
......@@ -1160,6 +1161,16 @@ export class Tool {
if (!rect) rect = new RectMask()
return rect;
}
/**
* 传送带
*/
public static getConver():egret.Sprite{
let sp:egret.Sprite = Pool.takeOut(RecoverName.CONVEYOR);
if(!sp){
sp = createArrowBg();
}
return sp;
}
/**
* 返回个十百等,0是个位 ,1是十位,依次
......
import centerAnchor from "./centerAnchor";
import { Element } from "../class/Element";
import { StateType } from "../enum/StateType";
import { LatticeType } from "../enum/LatticeType";
export default class BaseBlock extends egret.DisplayObjectContainer {
_inited = false;
constructor(state) {
blocktype:LatticeType;
constructor(state,blocktype:LatticeType) {
super();
this._state = state;
this.blocktype = blocktype;
this.initUI();
}
get state(){
return this._state;
}
initUI() {
this._block = new egret.Bitmap(RES.getRes('common_block_png'));
this._blockBgFront = new egret.Bitmap(RES.getRes('common_block_front_png'));
......
......@@ -2,6 +2,8 @@ import { LatticeType } from "../enum/LatticeType";
import Block from "./Block";
import BlockDarkIce from "./BlockDarkIce";
import BlockIce from "./BlockIce";
import { Pool } from "../Pool";
import { RecoverName } from "../enum/RecoverName";
export default (type: LatticeType) => {
const typestr = type + '';
......@@ -14,12 +16,36 @@ export default (type: LatticeType) => {
}
switch (type) {
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:
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:
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;
darkiceblock.ice.alpha = 1;
darkiceblock.ice.visible = false;
darkiceblock.iceCountNum = 2;
}
return darkiceblock;
default:
break;
}
......
......@@ -163,9 +163,83 @@ export const Chapters24: ChapterData[] = [
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 } ] } },
//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
{ 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
{ 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 } ] } }
]
......@@ -106,20 +106,20 @@ export class Element extends eui.Component {
resetFireworks(thisobj) {
this.changeSource('empty_png');
this.showImage.alpha = 0;
const mv: any = initSvga(getFireworksVideoItem());
this._fireworks = mv;
this._fireworks.touchEnabled = false;
this._fireworks.touchThrough = true;
thisobj.addChild(mv);
// this.addChild(this._fireworks);
mv.anchorOffsetX = 340 / 2;
mv.anchorOffsetY = 550;
mv.x = this.x;
mv.y = this.y + 12;
// mv.y = -38;
if(this._fireworks){
}else{
const mv: any = initSvga(getFireworksVideoItem());
this._fireworks = mv;
mv.anchorOffsetX = 340 / 2;
mv.anchorOffsetY = 500;
}
this._fireworks.x = this.x;
this._fireworks.y = this.y - 38;
thisobj.addChild(this._fireworks);
this._fireworks.gotoAndStop(1);
}
toFireworksAction(start, end) {
var pro = new Promise(function(resolve,reject){
const cb = () => {
......@@ -139,13 +139,17 @@ export class Element extends eui.Component {
async resetMonster() {
this.changeSource('empty_png');
this.showImage.alpha = 0;
const mv: any = await loadSvga(getResPath() + 'resource/assets/svgas/monster.svga');
this._mv = mv;
this.addChild(mv);
mv.anchorOffsetX = 150;
mv.anchorOffsetY = 150;
mv.x = - 3;
mv.y = - 6;
if(this._mv){
}else{
const mv: any = await loadSvga(getResPath() + 'resource/assets/svgas/monster.svga');
this._mv = mv;
mv.anchorOffsetX = 150;
mv.anchorOffsetY = 150;
mv.x = - 3;
mv.y = - 6;
}
this.addChild(this._mv);
this.toStandByAction();
}
......@@ -161,15 +165,19 @@ export class Element extends eui.Component {
toStandByAction() {
if (!this._mv) return;
const mv = this._mv;
const cb = () => {
if (mv.currentFrame == 360) { //向上吹
mv.gotoAndPlay(1, true);
}
};
this._mv.addEventListener(egret.Event.ENTER_FRAME, cb, this);
// const cb = () => {
// if (mv.currentFrame == 360) { //向上吹
// mv.gotoAndPlay(1, true);
// }
// };
this._mv.addEventListener(egret.Event.ENTER_FRAME, this._mvEnterFrame1, this);
mv.gotoAndPlay(1, true);
}
_mvEnterFrame1(){
if(this._mv.currentFrame == 360){
this._mv.gotoAndPlay(1,true);
}
}
toAction() {
return new Promise((r) => {
if (!this._mv) {
......@@ -181,6 +189,7 @@ export class Element extends eui.Component {
const cb = () => {
if (mv.currentFrame == 508) { //向上吹
this.toStandByAction();
this._mv.removeEventListener(egret.Event.ENTER_FRAME,cb,this);
}
if (mv.currentFrame == 391) {
r();
......@@ -258,12 +267,14 @@ export class Element extends eui.Component {
* @param part
*/
setPongoPart(part:string){
this.showImage.alpha = 0;
this.inPongoPart = part;
// console.log("我是猩猩的"+part);
if(part=="tl"){
}
this.showImage.alpha = 0.5;
// this.showImage.alpha = 0.5;
var state = StateType.PongoLockState;
if(this.hasState(state)){
......@@ -318,7 +329,7 @@ export class Element extends eui.Component {
var boxheight = 80;
var mvwidth = 161;
var mvheight = 161;
this.pongoMoveClip.alpha = 1;
this.pongoMoveClip.x = (boxwidth-mvwidth)/2;
this.pongoMoveClip.y = (boxheight-mvheight)/2;
this.addChild(this.pongoMoveClip);
......@@ -557,6 +568,7 @@ export class Element extends eui.Component {
// }
return true;
}
//此处回收
addDisable(){
if(this.inPongoPart&&this.inPongoPart=="tl"){
if(this.pongoMoveClip&&this.pongoMoveClip.parent){
......@@ -570,6 +582,18 @@ export class Element extends eui.Component {
}
egret.ticker.$stopTick(this.update,this);
}
if(this.cannoMoveClip){
if(this.cannoMoveClip.parent){
this.cannoMoveClip.parent.removeChild(this.cannoMoveClip);
}
this.cannoMoveClip.removeEventListener(egret.Event.ENTER_FRAME,this.toFrameAni,this);
Pool.recover(RecoverName.CANNO,this.cannoMoveClip);
this.cannoMoveClip = null;
}
if(this._fireworks&&this._fireworks.parent){
this._fireworks.parent.removeChild(this._fireworks);
}
}
......@@ -883,14 +907,10 @@ export class Element extends eui.Component {
createCanno(videoItem:any,cannobianhao:number){
this.cannobianhao = cannobianhao;
if(this.type==ElementType.CANNO&&videoItem){
this.cannoMoveClip = Pool.takeOut(RecoverName.CANNO);
if(this.cannoMoveClip){
if(this.cannoMoveClip.parent){
this.cannoMoveClip.parent.removeChild(this.cannoMoveClip);
}
this.initCannoMoveClidp();
return;
}
else{
}else{
this.cannoMoveClip = new window["SVGA"].EgretMovieClip(videoItem);
this.initCannoMoveClidp();
}
......@@ -965,14 +985,47 @@ export class Element extends eui.Component {
this.showImage.anchorOffsetY = 0;
this.showImage.scaleY = 1;
this.showImage.scaleX = 1;
this.showImage.alpha = 1;
egret.Tween.removeTweens(this.showImage);
//类型重置,showImage修改
this._type = type;
this.cannobox.visible = this.cannolab.visible = type == ElementType.CANNO;
this.showImage.visible = type != ElementType.CANNO;
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);
}
this.changeSource("ele" + type + "_png");
if(type==ElementType.Pongo||type==ElementType.CANNO){
}else{
this.changeSource("ele" + type + "_png");
}
//特效重置
this.effectType = null;
this.temEffectType = null;
......
......@@ -78,4 +78,16 @@ export enum RecoverName {
BLOCK_STATE = "BLOCK_STATE",
CONVEYOR = 'CONVEYOR',
SAND = 'SAND',
BLOCK = 'BLOCK',
ICE_BLOCK = 'ICE_BLOCK',
DARK_ICE_BLOCK = 'DARK_ICE_BLOCK',
//部分动画的
CANNOBLOCKANI = 'CANNOBLOCKANI',//炮台石头破碎
CANNO = 'CANNO',//炮台
CANNOFIRE = 'CANNOFIRE',//炮台发射
CANNOLIGHT = 'CANNOLIGHT'//炮台聚能
}
\ No newline at end of file
......@@ -44,6 +44,12 @@ export class PropGuide extends egret.DisplayObjectContainer {
if (this.parent) this.parent.removeChild(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) {
if (prop == PropType.BOOM) {
this.boomBtn.visible = true;
......
......@@ -54,7 +54,7 @@ export default class StartScene extends Scene {
setGlow(this['percentTxt'], 0xffffff, 1);
console.log(data);
// console.log(data);
if (data && Array.isArray(data)) {
this['container3'].addChild(data[0]);
this['container2'].addChild(data[1]);
......
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