Commit 08c0f4ad authored by zjz1994's avatar zjz1994

地图暂存

parent 7b478ad5
......@@ -18,6 +18,12 @@ export default class MapBottomPart extends ComponentBase {
star.loadSkin(); star.start();
const icon = this.getIcon(i);
icon.addChild(star);
icon.show = ()=>{this.addChild(icon)};
icon.hide = ()=>{this.removeChild(icon)};
icon['nums'] = icon.getChildAt(0);
icon['bmptxt']=icon.getChildAt(1);
icon['starsp'] = star;
}
// const repeatCount =getRepeatCount();
// for (let i = 0; i < MapBottomPart.LEVEL_NUMS; i++) {
......
......@@ -28,7 +28,7 @@ export default class MapRpeatPart extends ComponentBase {
icon.hide = ()=>{this.removeChild(icon)};
icon['nums'] = icon.getChildAt(0);
icon['bmptxt']=icon.getChildAt(1);
icon['starsp'] = star;
icon.hide();
}
......
......@@ -39,6 +39,7 @@ import getAdBtn from "./getAdBtn";
import getInviteBtn from "./getInviteBtn";
import { play2, play1 } from "../panels/help/svgaTool";
import { snpmAdStatic } from "../statics/snpmAdStatic";
import MapStarComp from "./MapStarComp";
let doHelpFlag = false;
// let doScratchHelpFlag = false;
......@@ -282,14 +283,20 @@ export default class MapScene extends Scene {
console.log("玩家level",nowlevel);
this.maptoppart.y = this.scrollMapy[0];
this.scrollGroup.addChild(this.maptoppart);
this.onemapreppart.y = this.scrollMapy[1];
this.onemapreppart.y = 0;//this.scrollMapy[1];
this.scrollGroup.addChild(this.onemapreppart);
this.twomapreppart.y = this.scrollMapy[2];
this.twomapreppart.y = 0;//this.scrollMapy[2];
this.scrollGroup.addChild(this.twomapreppart);
this.mapbotpart.y = this.scrollMapy[this.scrollMapy.length-2];
console.log('底部位置',this.mapbotpart.y);
this.scrollGroup.addChild(this.mapbotpart);
//设置顶部和底部关卡显示
this.changePartLevelShow(this.maptoppart,0,"top");
var botlevelstart = maptop_level+repeatnum*maprep_level;
this.changePartLevelShow(this.mapbotpart,botlevelstart,"bot");
// console.log('地图数据-----',this._data);
// this.topPart = this._data.top;
// this.repeatsPart = this._data.list;
......@@ -766,7 +773,7 @@ export default class MapScene extends Scene {
if(i3map.y!=i3mapy){
i3map.y = i3mapy;
var i3startlevel = MapTopPart.LEVEL_NUMS+(i3-1)*MapRpeatPart.LEVEL_NUMS;
this.changePartLevelShow(i3map,i3startlevel);
this.changePartLevelShow(i3map,i3startlevel,"mid");
console.log("局部显示",i3,i3mapy,i3startlevel);
}
}
......@@ -781,9 +788,18 @@ export default class MapScene extends Scene {
* @param mappart
* @param startlevel
*/
changePartLevelShow(mappart:any,startlevel:number){
changePartLevelShow(mappart:any,startlevel:number,mappartype:string){
var mapnums:number;
if(mappartype=="top"){
mapnums = MapTopPart.LEVEL_NUMS;
}else if(mappartype=="mid"){
mapnums = MapRpeatPart.LEVEL_NUMS;
}else if(mappartype=="bot"){
mapnums = MapBottomPart.LEVEL_NUMS;
}
var last_level = window['last_level'];
for(var i=0;i<MapRpeatPart.LEVEL_NUMS;i++){
var homeData = getHomeData();
for(var i=0;i<mapnums;i++){
const levelOrder = startlevel + i + 1;
let icon = mappart.getIcon(i);
icon.removeEventListener(egret.TouchEvent.TOUCH_TAP,this.showToastQd);
......@@ -791,9 +807,31 @@ export default class MapScene extends Scene {
if(levelOrder>last_level){
setGray(icon);
icon.addEventListener(egret.TouchEvent.TOUCH_TAP,this.showToastQd,this);
}else if(levelOrder<homeData.levels.length){
var leveldata = homeData.levels[levelOrder];
(icon['nums'] as eui.Image).source = 'icon_png';
(icon['bmptxt'] as eui.BitmapLabel).visible = true;
(icon['bmptxt'] as eui.BitmapLabel).font = 'nums_fnt';
(icon['startsp'] as MapStarComp).setStar(leveldata.stars);
(icon['startsp'] as MapStarComp).visible = true;
}else if(levelOrder==homeData.levels.length+1){
(icon['nums'] as eui.Image).source = 'iconnow_png';
(icon['bmptxt'] as eui.BitmapLabel).visible = true;
(icon['bmptxt'] as eui.BitmapLabel).font = 'nums_fnt';
(icon['startsp'] as MapStarComp).setStar(0);
(icon['startsp'] as MapStarComp).visible = true;
}
if(!icon.hasEventListener(egret.TouchEvent.TOUCH_TAP)){
icon.addEventListener(egret.TouchEvent.TOUCH_TAP,this.clickIcon,this);
}
}
}
//点击
clickIcon(e){
let icon = e.target as eui.Group;
let txt = icon['bmptxt'] as eui.BitmapLabel;
console.log('关卡点击',txt.text);
}
showToastQd(){
showToast('敬请期待更多关卡~');
}
......
......@@ -7,8 +7,8 @@ export default class MapStarComp extends ComponentBase {
this.y = 67;
this.setStar(0);
}
}
setStar(num: number) {
this['star1'].visible = false;
this['star2'].visible = false;
......
......@@ -13,6 +13,13 @@ export default class MapTopPart extends ComponentBase {
star.loadSkin(); star.start();
const icon = this.getIcon(i);
icon.addChild(star);
icon.show = ()=>{this.addChild(icon)};
icon.hide = ()=>{this.removeChild(icon)};
icon['nums'] = icon.getChildAt(0);
icon['bmptxt']=icon.getChildAt(1);
icon['starsp'] = star;
}
// for (let i = 0; i < MapTopPart.LEVEL_NUMS; i++) {
......@@ -36,6 +43,10 @@ export default class MapTopPart extends ComponentBase {
}
getIcon(i) { return this[`icon${i}`]; }
getTxt(i): eui.BitmapLabel {
var icon = this.getIcon(i);
return icon.getChildAt(1);
}
get skinKey(): string { return 'MapTop' }
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment