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;
......
......@@ -74,7 +74,7 @@ import {
submitTran,
forwardDirection,
} 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 { RecoverName } from '../something/enum/RecoverName';
import { StateType } from '../something/enum/StateType';
......@@ -163,6 +163,7 @@ let svgaParser;
//三个toast和bonusTime
const movieClips: any = {};
let cannoblockdata:any = null;
let cannomvdata:any = null;
let cannofire1mvdata:any = null;
let cannolightmvdata:any = null;
......@@ -375,9 +376,116 @@ export default class MainScene extends Scene {
//黑洞转移需在所有动画播放完毕后进行
wormHolePromise: Promise<any>[];
//todo
targetContainer:egret.DisplayObjectContainer;
chapterTxt:ChapterNum;
curScoreNum:CurScoreNum;
mapContainer:egret.DisplayObjectContainer;
elementConMask:egret.Shape;
effectContainer:egret.DisplayObjectContainer;
guideContainer:egret.DisplayObjectContainer;
festivalContainer:egret.DisplayObjectContainer;
constructor(){
super();
// console.log('mainscene-------constructor');
window['gm'] = this.gm;
//基础ui
//目标
this.targetContainer = new egret.DisplayObjectContainer;
this.addChild(this.targetContainer);
//第几关
this.chapterTxt = new ChapterNum();
this.chapterTxt.num = '0' // >> 0;
this.chapterTxt.x = 520;
this.chapterTxt.y = 97.5;
this.addChild(this.chapterTxt);
//步数
this.stepNumber = new StepNumber();
this.stepNumber.x = 175;
this.stepNumber.y = 83.5;
this.addChild(this.stepNumber);
//当前分数
this.curScoreNum = new CurScoreNum();
this.curScoreNum.x = 284;
this.curScoreNum.y = 170;
this.addChild(this.curScoreNum);
//初始换道具容器
this.propBtnCon = new PropBtnCon();
this.addChild(this.propBtnCon);
this.mapContainer = new egret.DisplayObjectContainer();
this.addChild(this.mapContainer);
this.mapupContainer = new egret.DisplayObjectContainer();
this.addChild(this.mapupContainer);
this.elementContainer = new egret.DisplayObjectContainer();
this.addChild(this.elementContainer);
this.effectContainer = new egret.DisplayObjectContainer();
this.addChild(this.effectContainer);
this.guideContainer = new egret.DisplayObjectContainer();
this.addChild(this.guideContainer);
this.festivalContainer = new egret.DisplayObjectContainer();
this.addChildAt(this.festivalContainer,1);
//选择框 无需加入场景
var textureChoosed: egret.Texture = RES.getRes("chooseRect_png")
this.choosed = new eui.Image(textureChoosed);
this.choosed.x = -textureChoosed.textureWidth / 2;
this.choosed.y = -textureChoosed.textureHeight / 2;
//道具使用时蒙层 无需加入场景,带入propBtnCo的位置数据
this.propGuide = new PropGuide(this.propBtnCon.y);
this.propGuide.touchEnabled = true;
//bonusTime引导,备用的,无需加入场景
this.bonusTime = new BonusTime();
this.bonusTime.x = 375;
this.bonusTime.y = 600;
}
resetMainScene(){
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.cannonums = 0;
this.cannoidxArr = new Array();
this.cannoEffect = new Array();
this.readyCannoArr = new Array();
this.fireteamCannoArr = new Array();
this.passElements = new Array();
this.noActionCount = 0;
this.isShowWarning = false;
this.magicRotateData = new Array();
this.commonContinuityTimes = 0;
this.effectContinuityTimes = 0;
this.lollipopCount = 0;
this.hasPassed = false;
this.isCountingTime = false;
this.mapContainer.removeChildren();
this.mapupContainer.removeChildren();
this.elementContainer.removeChildren();
this.effectContainer.removeChildren();
this.guideContainer.removeChildren();
this.festivalContainer.removeChildren();
}
async start(data) {
super.start();
window['gm'] = this.gm;
this.resetMainScene();
// console.log("mainscene---------start",data,data.chapter);
// window['gm'] = this.gm;
//第几关
this.chapter = (data && data.chapter) ? data.chapter : 1;
// this.chapter = 24;
......@@ -412,6 +520,7 @@ export default class MainScene extends Scene {
this.addChild(this["settingAll"])
this.addChild(this['redrainbg']);
this['redrainbg'].visible = false;
this.settingGroup.visible = false;
this.addLoading();
//先判断是否添加节日元素,如果加节日元素,就按initFestivalEle里的来
const initFestivalEleResult = await this.initFestivalEle();
......@@ -477,8 +586,6 @@ export default class MainScene extends Scene {
var svgas = ["amazing", "great", "wonderful", "bonusTime"];
//如果有节日的加
if (this.festivalTarget) svgas.push("redBombLight");
//到时候用炮台石头的替换todo
svgas.push("cannoblock");
for (let i = 0; i < svgas.length; i++) {
if (movieClips[svgas[i]]) continue;
......@@ -487,8 +594,6 @@ export default class MainScene extends Scene {
svgaParser.load(resPath + 'resource/assets/svgas/' + svgas[i] + ".svga", (videoItem) => {
var mv = new window["SVGA"].EgretMovieClip(videoItem);
mv.lockStep = true;
if(svgas[i]=="cannoblock"){
}
if (svgas[i] != "bonusTime") {
mv.x = (750 - 520) / 2;
mv.y = 500;
......@@ -517,6 +622,15 @@ export default class MainScene extends Scene {
cannomvdata = videoItem;
})
}
//炮台石头
if(cannoblockdata){
}else{
svgaParser.load(resPath + 'resource/assets/svgas/cannoblock.svga',(videoItem)=>{
cannoblockdata = videoItem;
})
}
}
/**
* 一个炮台有三个附属动画
......@@ -524,7 +638,7 @@ export default class MainScene extends Scene {
initCannoSvgas(icanno:Element,icannobianhao:number){
var resPath = getResPath();
if (!svgaParser) svgaParser = new window["SVGA"].Parser();
var svgas = ["cannofire1","cannolight","cannoparticle"];//新增大炮的动画
var svgas = ["cannofire1","cannolight"];//,"cannoparticle"];//新增大炮的动画
let icannoidx = icanno.index;
let icannodir:forwardDirection = icanno._cannoDir;
let icannolpos = Tool.getPositionByIndex(icannoidx);
......@@ -552,16 +666,24 @@ export default class MainScene extends Scene {
for(let j=0;j<svgas.length;j++){
let jsvgname = svgas[j];
let mvdata:any;
let mv:any;
if(jsvgname=="cannofire1"){
mvdata = cannofire1mvdata;
mv = Pool.takeOut(RecoverName.CANNOFIRE);
}else if(jsvgname=="cannolight"){
mvdata = cannolightmvdata;
mv = Pool.takeOut(RecoverName.CANNOLIGHT);
}else if(jsvgname=="cannoparticle"){
console.error("新特效大炮不再使用particle");
mvdata = cannoparticlemvdata;
}
if(mvdata){
// console.log("复用mvdata,免加载");
let mv = new window["SVGA"].EgretMovieClip(mvdata);
if(!mv){
mv = new window["SVGA"].EgretMovieClip(mvdata);
}else{
// console.log("复用了炮台动画");
}
this.initCannoMv(mv,jsvgname,icannobianhao);
}else{
svgaParser.load(resPath + 'resource/assets/svgas/' + jsvgname + ".svga", (videoItem) => {
......@@ -733,48 +855,34 @@ export default class MainScene extends Scene {
//初始化界面ui,,道具弄在这里s
initUi() {
//第几关
var chapterTxt = new ChapterNum();
chapterTxt.num = `第${this.chapter}关` // >> 0;
chapterTxt.x = 520;
chapterTxt.y = 97.5;
this.addChild(chapterTxt)
this.chapterTxt.num = `第${this.chapter}关` // >> 0;
//步数
this.stepNumber = new StepNumber();
this.stepNumber.x = 175;
this.stepNumber.y = 83.5;
this.addChild(this.stepNumber);
//步数初始化
this.steps = this.chapterData.stepCount;
//当前分数
var curScoreNum = new CurScoreNum();
curScoreNum.x = 284;
curScoreNum.y = 170;
this.addChild(curScoreNum);
//初始换道具容器
this.propBtnCon = new PropBtnCon();
this.propBtnCon.y = 299 + Tool.gameAreaHeight// + 55;
this.addChild(this.propBtnCon);
//按钮的事件
this.propBtnCon.boomBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_boomBtn, this)
this.propBtnCon.hammerBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_hammerBtn, this)
this.propBtnCon.stepBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_stepBtn, this)
this.propGuide.changeOffset(this.propBtnCon.y);
//初始化道具信息
this.updateScene();
//分数进度条,托管
this.scoreProgress = new ScoreProgress(this.starProgress, curScoreNum, this.chapterData.starScores);
this.scoreProgress = new ScoreProgress(this.starProgress, this.curScoreNum, this.chapterData.starScores);
//分数置0
this.score = 0;
//地图生成
var path = generateMapBg(this.chapterData.map.lattices);
var bg = drawBg(path, this.chapterData.map.lattices)
this.addChild(bg);
var bg = drawBg(path, this.chapterData.map.lattices);
this.mapContainer.removeChildren();
this.mapContainer.addChild(bg);
const conveyor = new egret.Sprite();
this.conveyorLayer = conveyor;
this.conveyorMap = {};
this.map = bg;
this.map.addChild(conveyor);
this.wormholeContainer = new egret.DisplayObjectContainer();
this.addChild(this.wormholeContainer);
......@@ -784,15 +892,16 @@ export default class MainScene extends Scene {
//容器
this.elementContainer = new egret.DisplayObjectContainer();
this.addChild(this.elementContainer);
//加遮罩,大遮罩一直都加,小遮罩时时判断
var mask = drawShape(path);
this.elementContainer.mask = mask;
this.addChild(mask)
//容器事件
this.elementContainer.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.mouseDownE, this);
this.elementContainer.addEventListener(egret.TouchEvent.TOUCH_MOVE, this.mouseMoveE, this);
if(this.elementConMask){
this.elementConMask.graphics.clear();
this.removeChild(this.elementConMask);
}
this.elementConMask = drawShape(path);
this.elementContainer.mask = this.elementConMask;
this.addChild(this.elementConMask);
//根据修改音乐显示按钮
if(getSoundOn()) {
this.soundBtn.source = "mainSoundBtnOn_png"
......@@ -809,22 +918,10 @@ export default class MainScene extends Scene {
stopBg();
// setGameBgStatus(false);
}
//选择框 无需加入场景
var textureChoosed: egret.Texture = RES.getRes("chooseRect_png")
this.choosed = new eui.Image(textureChoosed);
this.choosed.x = -textureChoosed.textureWidth / 2;
this.choosed.y = -textureChoosed.textureHeight / 2;
//道具使用时蒙层 无需加入场景,带入propBtnCo的位置数据
this.propGuide = new PropGuide(this.propBtnCon.y);
this.propGuide.touchEnabled = true;
// this.addChild(this.propGuide);
//bonusTime引导,备用的,无需加入场景
this.bonusTime = new BonusTime();
this.bonusTime.x = 375;
this.bonusTime.y = 600;
}
initTarget() {
this.targetContainer.removeChildren();
//通关目标,如果通关目标是元素时,赋值this.passElements,否则
if(this.chapterData.passTarget.type == PassType.ELEMENT_TARGET) {
this.hasEliminatedElements = [];
......@@ -837,7 +934,8 @@ export default class MainScene extends Scene {
this.elementTargets = new ElementTargets(this.passElements);
this.elementTargets.x = 375;
this.elementTargets.y = 207.5; // 255
this.addChild(this.elementTargets);
this.targetContainer.addChild(this.elementTargets);
this.targetScoreTxt.visible = false;
} else {
this.passElements = null;
......@@ -939,7 +1037,8 @@ export default class MainScene extends Scene {
mask.addChild(oneMask);
list.forEach(i => {
const arrow = createArrowBg(tex);
const arrow = Tool.getConver();
arrow.rotation = getArrowRotation(dir);
conveyorContainer.addChild(arrow);
const p = Tool.getPositionByIndex(i);
......@@ -1002,14 +1101,16 @@ export default class MainScene extends Scene {
latticeDisplay = ice;
this.lattices[i].ice = ice;
} else if(isSand(latticesD[i])) {
latticeDisplay = getSandDisplayBlock();
latticeDisplay = Pool.takeOut(RecoverName.SAND);
if(!latticeDisplay){
latticeDisplay = getSandDisplayBlock();
}
this.lattices[i].sand = latticeDisplay as Sand;
} else {
latticeDisplay = genBlockDisplay(latticesD[i]);
this.lattices[i].block = latticeDisplay as BaseBlock;
}
if(latticeDisplay) {
// this.map.addChild(latticeDisplay);
this.mapupContainer.addChild(latticeDisplay);
latticeDisplay.x = p[0];
latticeDisplay.y = p[1];
......@@ -1073,8 +1174,9 @@ export default class MainScene extends Scene {
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();
for(var i = 0; i < elements.length; i++) {
// console.log("开始initElement",this.chapter);
for(let i = 0; i < elements.length; i++) {
// console.log("initElement遍历-------",i);
//如果对应格子为空,直接跳过,
if(!this.lattices[i]) continue;
var p = Tool.getPositionByIndex(i);
......@@ -1097,6 +1199,7 @@ export default class MainScene extends Scene {
if(!ele) {
ele = new Element(type)
} else {
// console.log("initElement复用ele",i,elements[i],Tool.indexToRc(i));
ele.reset(type)
}
ele.x = p[0];
......@@ -1132,6 +1235,7 @@ export default class MainScene extends Scene {
if(!lol) {
lol = new Element(ElementType.LOLLIPOP)
} else {
// console.log("initElement复用ele",i,elements[i],Tool.indexToRc(i));
lol.reset(ElementType.LOLLIPOP)
}
lol.x = p[0];
......@@ -1145,6 +1249,7 @@ export default class MainScene extends Scene {
if(!rock) {
rock = new Element(ElementType.ROCK)
} else {
// console.log("initElement复用ele",i,elements[i],Tool.indexToRc(i));
rock.reset(ElementType.ROCK)
}
rock.x = p[0];
......@@ -1397,7 +1502,7 @@ export default class MainScene extends Scene {
if (gameGuideChapterNum.indexOf(this.chapter >> 0) > -1) {
if (!readCache(getCacheKey() + this.chapter)) {
this.gameGuide = new GameGuide(this);
this.addChild(this.gameGuide);
this.guideContainer.addChild(this.gameGuide);
this.gameGuide.show();
}
}
......@@ -1428,11 +1533,13 @@ export default class MainScene extends Scene {
this['redrainbg'].visible = false;
var p = Tool.getPositionByIndex(festivalIndex);
//添加节日红包目标
//添加节日红包目标,todo,记得测试红包
this.festivalTarget = new FestivalTarget(this.festivalTargetNum);
this.festivalTarget.x = 580;
this.festivalTarget.y = 115;
this.addChildAt(this.festivalTarget, 1);
this.festivalContainer.removeChildren();
this.festivalContainer.addChild(this.festivalTarget);
if(this.lattices[festivalIndex].element) {
this.lattices[festivalIndex].element.reset(ElementType.FESTIVALELE_BIG)
} else {
......@@ -1446,7 +1553,8 @@ export default class MainScene extends Scene {
//动画,然后恢复this.enableMouseEvt(true);
let ani: FesRedBombShowAni = Pool.takeOut(RecoverName.FESREDBOMBSHOW_ANI)
if(!ani) ani = new FesRedBombShowAni();
this.addChild(ani);
this.effectContainer.addChild(ani);
this.lattices[festivalIndex].element.visible = false;
ani.play(p, () => {
this.lattices[festivalIndex].element.visible = true;
......@@ -1482,15 +1590,31 @@ export default class MainScene extends Scene {
//侦听事件
initEvents() {
// console.log('mainscene-----------开始监听事件----initEvents');
this.addEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this);
this.settingBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_settingBtn, this)
this.questionBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_questionBtn, this)
this.soundBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_soundBtnn, this)
this.musicBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_musicBtn, this)
this.quitBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_quitBtn, this)
//按钮的事件
this.propBtnCon.boomBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_boomBtn, this)
this.propBtnCon.hammerBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_hammerBtn, this)
this.propBtnCon.stepBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_stepBtn, this)
//容器事件
this.elementContainer.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.mouseDownE, this);
this.elementContainer.addEventListener(egret.TouchEvent.TOUCH_MOVE, this.mouseMoveE, this);
}
removeEvents() {
// console.log('mainscene-----移除事件监听------removeEvents');
this.removeEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this);
this.settingBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_settingBtn, this);
this.questionBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_questionBtn, this)
......@@ -1498,12 +1622,44 @@ export default class MainScene extends Scene {
this.musicBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_musicBtn, this)
this.quitBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_quitBtn, this)
this.elementContainer.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, this.mouseDownE, this);
this.elementContainer.removeEventListener(egret.TouchEvent.TOUCH_MOVE, this.mouseMoveE, 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_MOVE, this.mouseMoveE, this);
this.reCoverAllLattice();
//回收炮台相关动画
for(var i=0;i<this.cannoEffect.length;i++){
var icannoeffect = this.cannoEffect[i];
var icannoeffectfire = icannoeffect['cannofire1'];
var icannoeffectlight = icannoeffect['cannolight'];
if(icannoeffectfire){
if(icannoeffectfire.parent){
icannoeffectfire.parent.removeChild(icannoeffectfire);
}
icannoeffectfire.removeEventListener(egret.Event.ENTER_FRAME,this.listenCnfire,this);
Pool.recover(RecoverName.CANNOFIRE,icannoeffectfire);
}
if(icannoeffectlight){
if(icannoeffectlight.parent){
icannoeffectlight.parent.removeChild(icannoeffectlight);
}
icannoeffectlight.removeEventListener(egret.Event.ENTER_FRAME,this.listenCnlight,this);
Pool.recover(RecoverName.CANNOLIGHT,icannoeffectlight);
}
}
this.cannoEffect = new Array();
}
onEnterFrame() {
......@@ -1646,7 +1802,7 @@ export default class MainScene extends Scene {
this.resetWarning();
}
//添加引导蒙层
this.addChild(this.propGuide);
this.guideContainer.addChild(this.propGuide);
this.propGuide.init(prop);
//如果是炸弹或者锤子
if(prop == PropType.BOOM || prop == PropType.HAMMER) {
......@@ -1691,18 +1847,18 @@ export default class MainScene extends Scene {
this.sendPropUse(PropType.CHANCE_NUM)
}, this)
}
this.addChild(this.stepCircle)
this.guideContainer.addChild(this.stepCircle);
//如果点击引导取消使用
this.propGuide.once(egret.TouchEvent.TOUCH_TAP, () => {
//还原事件
this.addEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this);
if(this.stepCircle.parent) this.removeChild(this.stepCircle)
if(this.stepCircle.parent) this.guideContainer.removeChild(this.stepCircle)
}, this);
}
}
sendPropUse(prop: PropType, index?: number) {
this.removeChild(this.propGuide);
this.guideContainer.removeChild(this.propGuide);
NetManager.ins.hc_useProp((s, data) => {
//还原事件
this.addEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this);
......@@ -1711,7 +1867,7 @@ export default class MainScene extends Scene {
this.elementContainer.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.mouseDownE, this);
this.elementContainer.addEventListener(egret.TouchEvent.TOUCH_MOVE, this.mouseMoveE, this);
} else {
this.removeChild(this.stepCircle)
this.guideContainer.removeChild(this.stepCircle)
}
if(s) {
this.wormHolePromise = new Array();
......@@ -2658,8 +2814,6 @@ export default class MainScene extends Scene {
for(var i = 0; i < this.scoreAnis.length; i++) {
var scoreAni = this.scoreAnis[i];
scoreAll += scoreAni.score;
// this.addChild(scoreAni)
// scoreAni.play();
}
this.scoreAnis.length = 0;
this.score += scoreAll;
......@@ -3335,7 +3489,7 @@ export default class MainScene extends Scene {
} else {
//如果还有游戏引导
if(this.gameGuide) {
this.addChild(this.gameGuide)
this.guideContainer.addChild(this.gameGuide)
this.gameGuide.show()
}
;
......@@ -3810,7 +3964,7 @@ export default class MainScene extends Scene {
}
} else {
// this.playAni(RecoverName.ELEDIS_ANI, p)
this.addChild(playEleDisAniNew(ele.type, p))//0303版本呢修改,每种基础元素区分动效
this.effectContainer.addChild(playEleDisAniNew(ele.type, p))//0303版本呢修改,每种基础元素区分动效
//这里面会去算个数
this.recoverEle(index);
// if(ele.hasState(StateType.HONEY)) {
......@@ -4164,7 +4318,7 @@ export default class MainScene extends Scene {
this.steps--;
//分数
this.score += 1000;
this.addChild(bonusShootAni);
this.effectContainer.addChild(bonusShootAni);
//算角度
var r = Tool.getForwardRotation(stepPosition, [ele.x, ele.y])
bonusShootAni.play(r * 180 / Math.PI, [ele.x, ele.y], () => {
......@@ -4219,11 +4373,11 @@ export default class MainScene extends Scene {
sv = "great";
}
if(sv && movieClips[sv]) {
this.addChild(movieClips[sv])
this.effectContainer.addChild(movieClips[sv])
movieClips[sv].gotoAndPlay(1, true)
setTimeout(() => {
if(movieClips[sv].parent) {
this.removeChild(movieClips[sv])
this.effectContainer.removeChild(movieClips[sv])
}
}, 667)
}
......@@ -4426,9 +4580,9 @@ export default class MainScene extends Scene {
ani.play();
if(name == RecoverName.MAGICLION_ANI) {
//具体索引还要改
this.addChildAt(ani, this.getChildIndex(this.map) + 1);
this.effectContainer.addChildAt(ani, this.getChildIndex(this.map) + 1);
} else {
this.addChild(ani);
this.effectContainer.addChild(ani);
}
return ani
}
......@@ -4439,10 +4593,11 @@ export default class MainScene extends Scene {
*/
checkLatticeBroken(lat: Lattice) {
if(!lat) return;
if(lat.ice) {//带冰的lattice
if(lat.ice&&lat.ice.alpha!=0) {//带冰的lattice
const ice = lat.ice;
ice.countNum--;
if(ice.countNum == 0) {
ice.alpha = 0;
this.mapupContainer.removeChild(ice);
//回收
Pool.recover(RecoverName.ICE, ice);
......@@ -4457,13 +4612,14 @@ export default class MainScene extends Scene {
if(Tool.judgeInWormHole(lat.index,this.chapterData.map.WORMHOLE)){
this.wormHolePromise.push(pro);
}
} else if(lat.block && lat.block.ice && lat.block.canIceBroken) {//石门(可能带冰) && 石门反转了可以消除了
} else if(lat.block && lat.block.ice && lat.block.canIceBroken && lat.block.ice.alpha!=0) {//石门(可能带冰) && 石门反转了可以消除了
const block = lat.block;
block.iceCountNum--;
if(block.iceCountNum == 0) {
block.ice && block.ice.parent && block.ice.parent.removeChild(block.ice);
block.ice.alpha = 0;
// block.ice && block.ice.parent && block.ice.parent.removeChild(block.ice);
this.goElementTarget(ElementType.ICE, [block.x, block.y]);
block.ice = null;
// block.ice = null;
} else {
block.ice.alpha = 0.6;
}
......@@ -4489,7 +4645,7 @@ export default class MainScene extends Scene {
if(this.passElements[type] != 0) {
this.passElements[type]--;
var p = this.elementTargets.targets[type].localToGlobal(40 * 0.8, 40 * 0.8)
this.addChild(FlyTargetAni(type, fromP, [p.x, p.y], () => {
this.effectContainer.addChild(FlyTargetAni(type, fromP, [p.x, p.y], () => {
this.elementTargets.targets[type].count--;
}))
}
......@@ -4863,17 +5019,6 @@ export default class MainScene extends Scene {
var pos = Tool.getPositionByIndex(ikuang);
var kuangpos = this.elementContainer.localToGlobal(pos[0],pos[1]);
// let ikuangimg;
// if(this.pongoKarr.length>0){
// ikuangimg = this.pongoKarr.shift();
// }else{
// ikuangimg = new eui.Image("kuang_png");
// }
// this.addChild(ikuangimg);
// ikuangimg.x = kuangpos.x-40;
// ikuangimg.y = kuangpos.y-40;
// this.tweenKuangDis(ikuangimg);
if(pongojiodata){
let ikuangmv;
if(pongojioArr.length>0){
......@@ -4882,7 +5027,7 @@ export default class MainScene extends Scene {
ikuangmv = new window["SVGA"].EgretMovieClip(pongojiodata);
}
ikuangmv.addEventListener(egret.Event.COMPLETE,this.playCompleteJio,this);
this.addChild(ikuangmv);
this.effectContainer.addChild(ikuangmv);
ikuangmv.x = kuangpos.x-160;
ikuangmv.y = kuangpos.y - 120;
ikuangmv.gotoAndPlay(1,1);
......@@ -4896,7 +5041,7 @@ export default class MainScene extends Scene {
ikuangmv = new window["SVGA"].EgretMovieClip(pongojiodata);
}
ikuangmv.addEventListener(egret.Event.COMPLETE,this.playCompleteJio,this);
this.addChild(ikuangmv);
this.effectContainer.addChild(ikuangmv);
ikuangmv.x = kuangpos.x-160;
ikuangmv.y = kuangpos.y - 120;
ikuangmv.gotoAndPlay(1,1);
......@@ -5026,19 +5171,33 @@ export default class MainScene extends Scene {
removeCannoBlock(index:number){
this.removeOperation(index);
//炮台石头的动效
var blockmv = movieClips["cannoblock"];
var blockmv = Pool.takeOut(RecoverName.CANNOBLOCKANI);//movieClips["cannoblock"];
if(!blockmv){
blockmv = new window["SVGA"].EgretMovieClip(cannoblockdata);
}else{
// console.log("复用炮台石头");
}
if(blockmv){
blockmv.addEventListener(egret.Event.COMPLETE,this.playBlockComp,this);
var blpos = Tool.getPositionByIndex(index);
var bwpos = this.elementContainer.localToGlobal(blpos[0],blpos[1]);
var blockwid = 112;
var blockhei = 97;
blockmv.x = bwpos.x-blockwid-5;
blockmv.y = bwpos.y-35;
this.addChild(blockmv);
this.effectContainer.addChild(blockmv);
// blockmv.gotoAndStop(1);
blockmv.gotoAndPlay(1,1);
}
}
playBlockComp(e){
e.target.stop();
if(e.target.parent){
e.target.removeEventListener(egret.Event.COMPLETE,this.playBlockComp,this);
e.target.parent.removeChild(e.target);
Pool.recover(RecoverName.CANNOBLOCKANI,e.target);
}
}
/**
* 猩猩的移除
*/
......@@ -5071,7 +5230,7 @@ export default class MainScene extends Scene {
if(this.festivalTargetNum) {
this.festivalTargetNum--;
var p = this.festivalTarget.localToGlobal(40 * 0.8, 40 * 0.8)
this.addChild(FlyTargetAni(ElementType.FESTIVALELE_SMALL, [ele.x, ele.y], [p.x, p.y], () => {
this.effectContainer.addChild(FlyTargetAni(ElementType.FESTIVALELE_SMALL, [ele.x, ele.y], [p.x, p.y], () => {
this.festivalTarget.count--;
}))
//完成了,发接口,到时需要修改,对于接口没成功的不设置
......@@ -5094,7 +5253,7 @@ export default class MainScene extends Scene {
var p = Tool.getPositionByIndex(index);
movieClips["redBombLight"].x = p[0] - 358;
movieClips["redBombLight"].y = p[1] - 137;
this.addChild(movieClips["redBombLight"])
this.effectContainer.addChild(movieClips["redBombLight"])
movieClips["redBombLight"].gotoAndPlay(1, true);
setTimeout(() => {
if(movieClips["redBombLight"].parent) {
......@@ -5136,6 +5295,55 @@ export default class MainScene extends Scene {
//返回下,有地方要用
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);
}
}
/**
* 禁用与开启事件
......
......@@ -99,7 +99,7 @@ export default class MapScene extends Scene {
onLoad() {
super.onLoad().then(() => {
});
// console.log('mapScene----------onLoad');
function hbRainBaseInfo() {
return new Promise((resolve, reject) => NetManager.ins.hbRainBaseInfo(() => resolve()));
}
......@@ -122,27 +122,25 @@ export default class MapScene extends Scene {
});
}
async start(data?) {
super.start();
this.addIcon(); // 添加Icon
pic:egret.Bitmap;
creatPic(){
if(!this.pic){
let light = RES.getRes('lightani_png');
this.pic = new egret.Bitmap(light);
this.pic.anchorOffsetX = 76;
this.pic.anchorOffsetY = 61;
}
}
initMapScene(){
// console.log('initMapScene--------------');
// 添加Icon
this.addIcon();
this.hcRedBoobBaseInfo();
this.updateSignBtn();
this.updateMyInfo();
this.updateAdData();
GDispatcher.dispatchEvent("getInviteInfo"); // 查询邀请信息,控制邀请有礼角标
this.updateIconLayout();
this['avatar'].mask = this['avatarMask'];
if (getBgOn() && MapScene['firstPlayBgTag'] == true) {
playBg();
}
stopGamebg();
NetManager.ins.getSignInfo(() => {
const parmas = [];
const panels = [];
......@@ -242,31 +240,242 @@ export default class MapScene extends Scene {
}
}, window['signActivityId']);
this.initSound();
this._data = data;
//滚动的背景变黑
this['rectbg'].height = this.stage.stageHeight;
//进度条的遮罩
this['progressfront'].mask = this['rect'];
this['rect'].scaleX = 0.5
this['rect'].scaleX = 0.5;
//进度条文本发光
setGlow(this['totalStarTxt'], 0x0083e8, 1);
this.topPart = data.top;
this.repeatsPart = data.list;
this.bottomPart = data.bottom;
this.topPart = this._data.top;
this.repeatsPart = this._data.list;
this.bottomPart = this._data.bottom;
this.scroll.height = this.stage.stageHeight;
this.scrollGroup.addChild(data.top);
this.scrollGroup.addChild(this._data.top);
data.list.forEach((ele, index) => {
this._data.list.forEach((ele, index) => {
this.scrollGroup.addChild(ele);
ele.y = data.top.height + (index * ele.height);
ele.y = this._data.top.height + (index * ele.height);
});
this.scrollGroup.addChild(this._data.bottom);
this._data.bottom.y = this._data.top.height + (this._data.list.length * this._data.list[0].height);
//下一个挑战关卡,水花动效
this.creatPic();
setTimeout(() => {
try {
const key = 'main2';
Promise.all([
RES.getResAsync(`${key}_json`),
RES.getResAsync(`${key}_png`)]);
} catch (error) {
}
// console.log("开始加载一系列资源");
RES.getResAsync('candydis0_json');
RES.getResAsync('candydis1_json');
RES.getResAsync('candydis2_json');
RES.getResAsync('candydis3_json');
RES.getResAsync('candydis4_json');
RES.getResAsync('candydie0_json');
RES.getResAsync('candydie1_json');
RES.getResAsync('candydie2_json');
RES.getResAsync('candydie3_json');
RES.getResAsync('candydie4_json');
RES.getResAsync('candysub_json');
RES.getResAsync('monsterState_json');
RES.getResAsync('honeymc_json');
RES.getResAsync('candydiebg_json');
RES.getResAsync('redrainbg_jpg');
RES.getResAsync('hbRule_bg_png');
loadSvga(getResPath() + 'resource/assets/svgas/fish.svga');
loadSvga(getResPath() + 'resource/assets/svgas/monster0.svga');
loadSvga(getResPath() + 'resource/assets/svgas/monster1.svga');
loadSvga(getResPath() + 'resource/assets/svgas/monster2.svga');
loadSvga(getResPath() + 'resource/assets/svgas/monster3.svga');
loadSvga(getResPath() + 'resource/assets/svgas/monster4.svga');
loadSvga(getResPath() + 'resource/assets/svgas/box.svga');
loadSvga(getResPath() + 'resource/assets/svgas/invite.svga');
loadSvga(getResPath() + 'resource/assets/svgas/turntable.svga');
loadSvga(getResPath() + 'resource/assets/svgas/turnprize.svga');
loadSvga(getResPath() + 'resource/assets/svgas/sprize.svga');
loadSvga(getResPath() + 'resource/assets/svgas/monster.svga');
loadSvga(getResPath() + 'resource/assets/svgas/honeypot1.svga');
loadSvga(getResPath() + 'resource/assets/svgas/honeypot2.svga');
loadSvga(getResPath() + 'resource/assets/svgas/honeypot3.svga');
loadSvga(getResPath() + 'resource/assets/svgas/honeypot_dispear.svga');
loadSvga(getResPath() + 'resource/assets/svgas/honeypot_change.svga');
loadSvga(getResPath() + 'resource/assets/svgas/honeypot_bubble.svga');
loadSvga(getResPath() + 'resource/assets/svgas/sand_standby.svga');
loadSvga(getResPath() + 'resource/assets/svgas/sand_move.svga');
loadSvga(getResPath() + 'resource/assets/svgas/sand_dis.svga');
// loadSvga(getResPath() + 'resource/assets/svgas/fireworks.svga');
// console.log("一系列资源加载完毕");
if (!window['development']) {
RES.getResAsync(`inviterulepanel_json`);
}
}, 20 * 1000);
loadFireworks();
}
constructor(data?){
super();
this._data = data;
this.once(egret.Event.ADDED_TO_STAGE,this.initMapScene,this);
}
async start(data?) {
// console.log("mapscene---------------start");
super.start();
this._avatarsCache = new Array();
// this.addIcon(); // 添加Icon
this.hcRedBoobBaseInfo();
// this.updateSignBtn();
// this.updateMyInfo();
// this.updateAdData();
GDispatcher.dispatchEvent("getInviteInfo"); // 查询邀请信息,控制邀请有礼角标
this.updateIconLayout();
// this['avatar'].mask = this['avatarMask'];
if (getBgOn() && MapScene['firstPlayBgTag'] == true) {
playBg();
}
stopGamebg();
// NetManager.ins.getSignInfo(() => {
// const parmas = [];
// const panels = [];
// const result = this.sendInvite(panels, parmas);
// if (result) {
// this.updateSign();
// PanelCtrl.instance.showPanels(panels, parmas, this.onAllPanelHide);
// return;
// }
// const date = new Date();
// date.setHours(0, 0, 0, 0);
// const nowTimerStr = date.getTime() + '';
// const oldTimerStr = localStorage.getItem('nowTimerStr' + window['CFG'].consumerId);
// const nowTimerStr2 = date.getTime() + '';
// const oldTimerStr2 = localStorage.getItem('nowTimer2Str' + window['CFG'].consumerId);
// const hc_advert = DataManager.ins.getData('hc_advert').data || {};
// let { noticeAdvert } = hc_advert;
// if (noticeAdvert == null) {
// noticeAdvert = { enable: false }
// }
// if (noticeAdvert && noticeAdvert.enable && nowTimerStr2 != oldTimerStr2) {
// // if (!adTag) {
// panels.push('ad');
// // adTag = true;
// // }
// localStorage.setItem('nowTimer2Str' + window['CFG'].consumerId, nowTimerStr2);
// }
// const backData = DataManager.ins.getData('hc_hasBackReward');
// if (backData.success) {
// backData.success = false;
// panels.push('BackIndex');
// }
// const { signInfoVO } = DataManager.ins.getData('getSignInfo');
// if (signInfoVO && signInfoVO.continueDay < 7) { //表示明天还可以签到
// if (signInfoVO.todaySigned == 0 && oldTimerStr != nowTimerStr && getSignBtn()) {
// panels.push('sign');
// localStorage.setItem('nowTimerStr' + window['CFG'].consumerId, nowTimerStr);
// }
// }
// this.updateSign();
// // 红包雨强提示
// const hbRainRes = DataManager.ins.getData(NetName.HBRAIN_BASEINFO);
// if (hbRainRes.data) {
// if (hbRainRes.data.currentSession || hbRainRes.data.nextSession) {
// const sessionId = hbRainRes.data.currentSession ? hbRainRes.data.currentSession.sessionIndex : hbRainRes.data.nextSession.sessionIndex; // 场次ID
// const nowTimerStr3 = date.getTime() + sessionId + '';
// const oldTimerStr3 = localStorage.getItem('nowTimer3Str' + window['CFG'].consumerId);
// if (nowTimerStr3 != oldTimerStr3) {
// panels.push('HbCutTime');
// localStorage.setItem('nowTimer3Str' + window['CFG'].consumerId, nowTimerStr3);
// }
// }
// }
// // 任务中心可领奖强提示
// let canShow = localStorage.getItem('taskCenter' + window['CFG'].consumerId);
// if (canShow == 'true') {
// const taskInfoRes = DataManager.ins.getData(NetName.GET_TASKINFO);
// if (taskInfoRes && taskInfoRes.data && taskInfoRes.data.length > 0) {
// for (let i = 0; i < taskInfoRes.data.length; i++) {
// if (taskInfoRes.data[i].count > 0) {
// panels.push('task');
// break;
// }
// }
// }
// }
// localStorage.setItem('taskCenter' + window['CFG'].consumerId, 'false');
// let res = DataManager.ins.getData('hc_redBombBaseInfo');
// if (res && res.data) {
// let _t = res.data.redBombSwitchTime || "";
// if (res.data.remain > 0) {
// let showBomb = localStorage.getItem('showBomb' + window['CFG'].consumerId);
// if (showBomb != _t.toString() && _t != "") {
// localStorage.setItem('showBomb' + window['CFG'].consumerId, _t.toString());
// panels.push('BombTips2Panel');
// }
// }
// }
// if (!readCache() && getHomeData().levels.length <= 0) { //引导
// const guide = new GuideCon(() => {
// PanelCtrl.instance.showPanels(panels, parmas, this.onAllPanelHide);
// });
// this.addChild(guide);
// guide.play(1)
// // console.log(guide)
// } else { //不用引导
// PanelCtrl.instance.showPanels(panels, parmas, this.onAllPanelHide);
// }
// }, window['signActivityId']);
this.scrollGroup.addChild(data.bottom);
data.bottom.y = data.top.height + (data.list.length * data.list[0].height);
this.initSound();
this._data = data;
//滚动的背景变黑
// this['rectbg'].height = this.stage.stageHeight;
// //进度条的遮罩
// this['progressfront'].mask = this['rect'];
// this['rect'].scaleX = 0.5
// //进度条文本发光
// setGlow(this['totalStarTxt'], 0x0083e8, 1);
// this.topPart = data.top;
// this.repeatsPart = data.list;
// this.bottomPart = data.bottom;
// console.log(data);
// this.scroll.height = this.stage.stageHeight;
// this.scrollGroup.addChild(data.top);
// data.list.forEach((ele, index) => {
// this.scrollGroup.addChild(ele);
// ele.y = data.top.height + (index * ele.height);
// });
// this.scrollGroup.addChild(data.bottom);
// data.bottom.y = data.top.height + (data.list.length * data.list[0].height);
let target;
const homeData = getHomeData();
......@@ -296,21 +505,26 @@ export default class MapScene extends Scene {
}
// 当前关卡的水花动效
if (homeData.levels.length < window['total_level']) {
const targetIcon = MapScene.iconHash[target];
const light = RES.getRes('lightani_png');
// console.log(homeData.levels,window['last_level'],target);
if (homeData.levels.length < window['last_level']) {
// console.log("添加水花动画0000000000");
const pic = this['pic'] || new egret.Bitmap(light);//76 61
pic.x = targetIcon.x + 50;
pic.y = targetIcon.y + 37 + 7;
targetIcon.mappart.addChildAt(pic, 1);
this.creatPic();
const targetIcon = MapScene.iconHash[target];
targetIcon.mappart.addChildAt(this.pic, 1);
// targetIcon.parent.addChildAt(pic, 0);
pic.anchorOffsetX = 76;
pic.anchorOffsetY = 61;
this.pic.x = targetIcon.x + 50;
this.pic.y = targetIcon.y + 37 + 7;
// pic.x = 50 - 2;
// pic.y = 37 + 10;
egret.Tween.get(pic, { loop: true }).to({ scaleX: 2, scaleY: 2, alpha: 0 }, 1000).wait(1000);
this['pic'] = pic;
egret.Tween.get(this.pic, { loop: true })
.set({
scaleX:1,
scaleY:1,
alpha:1
})
.to({ scaleX: 2, scaleY: 2, alpha: 0 }, 1000).wait(1000);
}
......@@ -336,69 +550,71 @@ export default class MapScene extends Scene {
}
}, this);
//关于滚动,可以仅在第一次打开时自动滚到到最新位置,其余情况不动
let lastOrder = homeData.levels.length + 1;
if (homeData.levels.length >= window['total_level'])
lastOrder = window['total_level'];
this.scroll.viewport.scrollV = this.getScrollV(lastOrder, this.stage.stageHeight);
// console.warn(this.getScrollV(lastOrder, this.stage.stageHeight));
setTimeout(() => {
try {
const key = 'main2';
Promise.all([
RES.getResAsync(`${key}_json`),
RES.getResAsync(`${key}_png`)]);
} catch (error) {
}
RES.getResAsync('candydis0_json');
RES.getResAsync('candydis1_json');
RES.getResAsync('candydis2_json');
RES.getResAsync('candydis3_json');
RES.getResAsync('candydis4_json');
RES.getResAsync('candydie0_json');
RES.getResAsync('candydie1_json');
RES.getResAsync('candydie2_json');
RES.getResAsync('candydie3_json');
RES.getResAsync('candydie4_json');
RES.getResAsync('candysub_json');
RES.getResAsync('monsterState_json');
RES.getResAsync('honeymc_json');
RES.getResAsync('candydiebg_json');
RES.getResAsync('redrainbg_jpg');
RES.getResAsync('hbRule_bg_png');
loadSvga(getResPath() + 'resource/assets/svgas/fish.svga');
loadSvga(getResPath() + 'resource/assets/svgas/monster0.svga');
loadSvga(getResPath() + 'resource/assets/svgas/monster1.svga');
loadSvga(getResPath() + 'resource/assets/svgas/monster2.svga');
loadSvga(getResPath() + 'resource/assets/svgas/monster3.svga');
loadSvga(getResPath() + 'resource/assets/svgas/monster4.svga');
loadSvga(getResPath() + 'resource/assets/svgas/box.svga');
loadSvga(getResPath() + 'resource/assets/svgas/invite.svga');
loadSvga(getResPath() + 'resource/assets/svgas/turntable.svga');
loadSvga(getResPath() + 'resource/assets/svgas/turnprize.svga');
loadSvga(getResPath() + 'resource/assets/svgas/sprize.svga');
loadSvga(getResPath() + 'resource/assets/svgas/monster.svga');
loadSvga(getResPath() + 'resource/assets/svgas/honeypot1.svga');
loadSvga(getResPath() + 'resource/assets/svgas/honeypot2.svga');
loadSvga(getResPath() + 'resource/assets/svgas/honeypot3.svga');
loadSvga(getResPath() + 'resource/assets/svgas/honeypot_dispear.svga');
loadSvga(getResPath() + 'resource/assets/svgas/honeypot_change.svga');
loadSvga(getResPath() + 'resource/assets/svgas/honeypot_bubble.svga');
loadSvga(getResPath() + 'resource/assets/svgas/sand_standby.svga');
loadSvga(getResPath() + 'resource/assets/svgas/sand_move.svga');
loadSvga(getResPath() + 'resource/assets/svgas/sand_dis.svga');
// loadSvga(getResPath() + 'resource/assets/svgas/fireworks.svga');
if (!window['development']) {
RES.getResAsync(`inviterulepanel_json`);
}
}, 20 * 1000);
loadFireworks();
// setTimeout(() => {
// try {
// const key = 'main2';
// Promise.all([
// RES.getResAsync(`${key}_json`),
// RES.getResAsync(`${key}_png`)]);
// } catch (error) {
// }
// console.log("开始加载一系列资源");
// RES.getResAsync('candydis0_json');
// RES.getResAsync('candydis1_json');
// RES.getResAsync('candydis2_json');
// RES.getResAsync('candydis3_json');
// RES.getResAsync('candydis4_json');
// RES.getResAsync('candydie0_json');
// RES.getResAsync('candydie1_json');
// RES.getResAsync('candydie2_json');
// RES.getResAsync('candydie3_json');
// RES.getResAsync('candydie4_json');
// RES.getResAsync('candysub_json');
// RES.getResAsync('monsterState_json');
// RES.getResAsync('honeymc_json');
// RES.getResAsync('candydiebg_json');
// RES.getResAsync('redrainbg_jpg');
// RES.getResAsync('hbRule_bg_png');
// loadSvga(getResPath() + 'resource/assets/svgas/fish.svga');
// loadSvga(getResPath() + 'resource/assets/svgas/monster0.svga');
// loadSvga(getResPath() + 'resource/assets/svgas/monster1.svga');
// loadSvga(getResPath() + 'resource/assets/svgas/monster2.svga');
// loadSvga(getResPath() + 'resource/assets/svgas/monster3.svga');
// loadSvga(getResPath() + 'resource/assets/svgas/monster4.svga');
// loadSvga(getResPath() + 'resource/assets/svgas/box.svga');
// loadSvga(getResPath() + 'resource/assets/svgas/invite.svga');
// loadSvga(getResPath() + 'resource/assets/svgas/turntable.svga');
// loadSvga(getResPath() + 'resource/assets/svgas/turnprize.svga');
// loadSvga(getResPath() + 'resource/assets/svgas/sprize.svga');
// loadSvga(getResPath() + 'resource/assets/svgas/monster.svga');
// loadSvga(getResPath() + 'resource/assets/svgas/honeypot1.svga');
// loadSvga(getResPath() + 'resource/assets/svgas/honeypot2.svga');
// loadSvga(getResPath() + 'resource/assets/svgas/honeypot3.svga');
// loadSvga(getResPath() + 'resource/assets/svgas/honeypot_dispear.svga');
// loadSvga(getResPath() + 'resource/assets/svgas/honeypot_change.svga');
// loadSvga(getResPath() + 'resource/assets/svgas/honeypot_bubble.svga');
// loadSvga(getResPath() + 'resource/assets/svgas/sand_standby.svga');
// loadSvga(getResPath() + 'resource/assets/svgas/sand_move.svga');
// loadSvga(getResPath() + 'resource/assets/svgas/sand_dis.svga');
// // loadSvga(getResPath() + 'resource/assets/svgas/fireworks.svga');
// console.log("一系列资源加载完毕");
// if (!window['development']) {
// RES.getResAsync(`inviterulepanel_json`);
// }
// }, 20 * 1000);
// loadFireworks();
this.scroll.addEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this);
}
......@@ -525,14 +741,17 @@ export default class MapScene extends Scene {
}
destroy() {
// console.log("map销毁");
super.destroy();
this.removeIcon();
this.actIcon.destory();
if (this['pic']) {
egret.Tween.removeTweens(this['pic']);
(this['pic'].parent as egret.DisplayObjectContainer).removeChild(this['pic']);
// this.removeIcon();
// this.actIcon.destory();
if (this.pic) {
egret.Tween.removeTweens(this.pic);
if(this.pic.parent){
this.pic.parent.removeChild(this.pic);
}
}
if (this.inviteTimer) {
......@@ -1012,15 +1231,41 @@ export default class MapScene extends Scene {
this['soundOffBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_sound, this);
this['musicOffBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_music, this);
this['musicBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_music, this);
this['recordBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
PanelCtrl.instance.show('bag');
NetManager.ins.clickLog(getlogItem(5));
}, this);
this['recordBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.recordClick, this);
// 消消乐查询信息
GDispatcher.addEvent('getInviteInfo', this.getInviteInfo, this);
}
protected removeEvents(){
this['goldBtn'].removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_goldBtn, this);
this['guide'].removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_guide, this);
// this['act2Btn'].removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_act2btn, this);
this['inviteBtn'].removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_inviteBtn, this);
this['friendBtn'].removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_friendBtn, this);
this['adBtn'].removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_adBtn, this);
this['signBtn'].removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_signBtn, this);
this['bloodBtn'].removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_bloodBtn, this);
this['settingBtn'].removeEventListener(egret.TouchEvent.TOUCH_TAP, this.toggleSettings, this);
this['shopBtn'].removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_shopBtn, this);
this['questionBtn'].removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_questionBtn, this);
this['box'].removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_boxLayer, this);
this['boxani'].removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_box, this);
this['soundBtn'].removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_sound, this);
this['soundOffBtn'].removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_sound, this);
this['musicOffBtn'].removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_music, this);
this['musicBtn'].removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_music, this);
this['recordBtn'].removeEventListener(egret.TouchEvent.TOUCH_TAP, this.recordClick, this);
// 消消乐查询信息
GDispatcher.removeEvent('getInviteInfo', this.getInviteInfo, this);
}
recordClick(){
PanelCtrl.instance.show('bag');
NetManager.ins.clickLog(getlogItem(5));
}
initSound() {
this['soundBtn'].visible = getSoundOn();
this['soundOffBtn'].visible = !getSoundOn();
......@@ -1073,7 +1318,7 @@ export default class MapScene extends Scene {
}
async onTap_box() {
console.log(1)
// console.log(1)
// const data = getHomeData();
// if (data.canReceiveTreasureBoxNum > 0) {
this['boxani'].touchEnabled = false;
......
......@@ -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