Commit f09b2dae authored by zjz1994's avatar zjz1994

地图优化暂存

parent 41b020e6
...@@ -137,7 +137,7 @@ ...@@ -137,7 +137,7 @@
window['imgver'] = '11112'; window['imgver'] = '11112';
//top 8 ,repeat 22 , bottom 3 //top 8 ,repeat 22 , bottom 3
window['total_level'] = 8 + 3 + 22 * 33; window['total_level'] = 8 + 3 + 22 * 33;
window['last_level'] = 725; window['last_level'] = 737;
var sharePic = document.getElementById('pic'); var sharePic = document.getElementById('pic');
sharePic.onclick = function () { sharePic.onclick = function () {
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<e:Skin class="StarSkin" width="76" height="31" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing"> <e:Skin class="StarSkin" width="76" height="31" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image source="无星星_png" horizontalCenter="0" verticalCenter="0"/> <e:Image source="无星星_png" horizontalCenter="0" verticalCenter="0" touchEnabled="false"/>
<e:Image id="star1" source="有星星_png" horizontalCenter="0" verticalCenter="0" visible="false"/> <e:Image id="star1" source="有星星_png" horizontalCenter="0" verticalCenter="0" visible="false"/>
<e:Image id="star2" source="有星星2_png" horizontalCenter="0" verticalCenter="0" visible="false"/> <e:Image id="star2" source="有星星2_png" horizontalCenter="0" verticalCenter="0" visible="false"/>
<e:Image id="star3" source="有星星3_png" horizontalCenter="0" verticalCenter="0" visible="false"/> <e:Image id="star3" source="有星星3_png" horizontalCenter="0" verticalCenter="0" visible="false"/>
......
...@@ -17,12 +17,13 @@ export default class MapBottomPart extends ComponentBase { ...@@ -17,12 +17,13 @@ export default class MapBottomPart extends ComponentBase {
const star = new MapStarComp(); const star = new MapStarComp();
star.loadSkin(); star.start(); star.loadSkin(); star.start();
const icon = this.getIcon(i); const icon = this.getIcon(i);
icon.addChild(star);
icon.show = ()=>{icon.visible = true;}; icon.show = ()=>{icon.visible = true;};
icon.hide = ()=>{icon.visible = false;}; icon.hide = ()=>{icon.visible = false;};
icon['nums'] = icon.getChildAt(0); icon['nums'] = icon.getChildAt(0);
icon['bmptxt']=icon.getChildAt(1); icon['bmptxt']=icon.getChildAt(1);
icon.addChildAt(star,0);
icon['starsp'] = star; icon['starsp'] = star;
icon.touchEnabled = true; icon.touchEnabled = true;
......
...@@ -22,12 +22,14 @@ export default class MapRpeatPart extends ComponentBase { ...@@ -22,12 +22,14 @@ export default class MapRpeatPart extends ComponentBase {
const star = new MapStarComp(); const star = new MapStarComp();
star.loadSkin(); star.start(); star.loadSkin(); star.start();
const icon = this.getIcon(i); const icon = this.getIcon(i);
icon.addChild(star);
icon.show = ()=>{icon.visible = true;}; icon.show = ()=>{icon.visible = true;};
icon.hide = ()=>{icon.visible = false;}; icon.hide = ()=>{icon.visible = false;};
icon['nums'] = icon.getChildAt(0); icon['nums'] = icon.getChildAt(0);
icon['bmptxt']=icon.getChildAt(1); icon['bmptxt']=icon.getChildAt(1);
icon.addChildAt(star,0);
icon['starsp'] = star; icon['starsp'] = star;
// icon.hide(); // icon.hide();
......
...@@ -256,8 +256,9 @@ export default class MapScene extends Scene { ...@@ -256,8 +256,9 @@ export default class MapScene extends Scene {
//进度条文本发光 //进度条文本发光
setGlow(this['totalStarTxt'], 0x0083e8, 1); setGlow(this['totalStarTxt'], 0x0083e8, 1);
//下一个挑战关卡,水花动效
this.creatPic();
//新地图创建 //新地图创建
console.log("新添加地图");
var total_level = window['total_level']; var total_level = window['total_level'];
var maptop_level = MapTopPart.LEVEL_NUMS; var maptop_level = MapTopPart.LEVEL_NUMS;
var maprep_level = MapRpeatPart.LEVEL_NUMS; var maprep_level = MapRpeatPart.LEVEL_NUMS;
...@@ -268,7 +269,7 @@ export default class MapScene extends Scene { ...@@ -268,7 +269,7 @@ export default class MapScene extends Scene {
var mapbot_height = this.mapbotpart.height||528; var mapbot_height = this.mapbotpart.height||528;
var repeatnum = Math.abs((total_level-maptop_level-mapbot_level)/maprep_level) var repeatnum = Math.abs((total_level-maptop_level-mapbot_level)/maprep_level)
console.log("中间maprepeat数量",repeatnum); // console.log("中间maprepeat数量",repeatnum);
this.scrollMapy.push(0); this.scrollMapy.push(0);
this.scrollMapy.push(maptop_height); this.scrollMapy.push(maptop_height);
var smaph = maptop_height; var smaph = maptop_height;
...@@ -279,26 +280,36 @@ export default class MapScene extends Scene { ...@@ -279,26 +280,36 @@ export default class MapScene extends Scene {
this.scrollMapy.push(smaph+mapbot_height); this.scrollMapy.push(smaph+mapbot_height);
var scrollheight = maptop_height+repeatnum*maprep_height+mapbot_height; var scrollheight = maptop_height+repeatnum*maprep_height+mapbot_height;
console.log("scroll--------height",scrollheight,this.scrollMapy); // console.log("scroll--------height",scrollheight,this.scrollMapy);
this.scrollGroup.height = scrollheight; this.scrollGroup.height = scrollheight;
var nowlevel = getHomeData().levels.length; var nowlevel = getHomeData().levels.length;
console.log("玩家level",nowlevel); // console.log("玩家level",nowlevel);
this.maptoppart.y = this.scrollMapy[0]; this.maptoppart.y = this.scrollMapy[0];
this.scrollGroup.addChild(this.maptoppart); this.scrollGroup.addChild(this.maptoppart);
this.onemapreppart.y = 0;//this.scrollMapy[1]; this.onemapreppart.y = this.scrollMapy[1];
this.scrollGroup.addChild(this.onemapreppart); this.scrollGroup.addChild(this.onemapreppart);
this.twomapreppart.y = 0;//this.scrollMapy[2]; this.twomapreppart.y = this.scrollMapy[2];
this.scrollGroup.addChild(this.twomapreppart); this.scrollGroup.addChild(this.twomapreppart);
this.mapbotpart.y = this.scrollMapy[this.scrollMapy.length-2]; this.mapbotpart.y = this.scrollMapy[this.scrollMapy.length-2];
console.log('底部位置',this.mapbotpart.y); // console.log('底部位置',this.mapbotpart.y);
this.scrollGroup.addChild(this.mapbotpart); this.scrollGroup.addChild(this.mapbotpart);
//设置顶部和底部关卡显示 //设置顶部和底部关卡显示
this.changePartLevelShow(this.maptoppart,0,"top"); this.changePartLevelShow(this.maptoppart,0,"top");
this.changePartLevelShow(this.onemapreppart,MapTopPart.LEVEL_NUMS,'mid');
this.changePartLevelShow(this.twomapreppart,MapTopPart.LEVEL_NUMS+MapRpeatPart.LEVEL_NUMS,'mid');
var botlevelstart = maptop_level+repeatnum*maprep_level; var botlevelstart = maptop_level+repeatnum*maprep_level;
this.changePartLevelShow(this.mapbotpart,botlevelstart,"bot"); this.changePartLevelShow(this.mapbotpart,botlevelstart,"bot");
const homeData = getHomeData();
//关于滚动,可以仅在第一次打开时自动滚到到最新位置,其余情况不动
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.log("滚动设置",lastOrder,this.scroll.viewport.scrollV);
this.setScrollVShow();
// console.log('地图数据-----',this._data); // console.log('地图数据-----',this._data);
// this.topPart = this._data.top; // this.topPart = this._data.top;
// this.repeatsPart = this._data.list; // this.repeatsPart = this._data.list;
...@@ -313,8 +324,7 @@ export default class MapScene extends Scene { ...@@ -313,8 +324,7 @@ export default class MapScene extends Scene {
// this.scrollGroup.addChild(this._data.bottom); // this.scrollGroup.addChild(this._data.bottom);
// this._data.bottom.y = this._data.top.height + (this._data.list.length * this._data.list[0].height); // this._data.bottom.y = this._data.top.height + (this._data.list.length * this._data.list[0].height);
//下一个挑战关卡,水花动效
this.creatPic();
setTimeout(() => { setTimeout(() => {
...@@ -544,32 +554,32 @@ export default class MapScene extends Scene { ...@@ -544,32 +554,32 @@ export default class MapScene extends Scene {
// this.scrollGroup.addChild(data.bottom); // this.scrollGroup.addChild(data.bottom);
// data.bottom.y = data.top.height + (data.list.length * data.list[0].height); // data.bottom.y = data.top.height + (data.list.length * data.list[0].height);
let target; // let target;
const homeData = getHomeData(); const homeData = getHomeData();
if (homeData.levels.length == 0) { // if (homeData.levels.length == 0) {
target = 1; // target = 1;
} else if (homeData.levels.length == window['total_level']) { // } else if (homeData.levels.length == window['total_level']) {
target = window['total_level'] + 1; // target = window['total_level'] + 1;
} else { // } else {
target = homeData.levels.length + 1; // target = homeData.levels.length + 1;
} // }
for (const key in MapScene.iconHash) { // for (const key in MapScene.iconHash) {
const levelOrder = parseInt(key); // const levelOrder = parseInt(key);
const element = MapScene.iconHash[key]; // const element = MapScene.iconHash[key];
if (!element.hasEventListener(egret.TouchEvent.TOUCH_TAP)) { // if (!element.hasEventListener(egret.TouchEvent.TOUCH_TAP)) {
element.addEventListener(egret.TouchEvent.TOUCH_TAP, () => { // element.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
if ( // if (
(levelOrder > (getHomeData().levels.length + 1) && levelOrder > 1) // (levelOrder > (getHomeData().levels.length + 1) && levelOrder > 1)
|| (levelOrder > window['last_level']) // || (levelOrder > window['last_level'])
) { // ) {
// showToast('必须通关前面的关卡才能开启本关'); // // showToast('必须通关前面的关卡才能开启本关');
console.log('必须通关前面的关卡才能开启本关'); // console.log('必须通关前面的关卡才能开启本关');
} else // } else
PanelCtrl.instance.show('StartPanel', key); // PanelCtrl.instance.show('StartPanel', key);
NetManager.ins.clickLog(getlogItem(19)); // NetManager.ins.clickLog(getlogItem(19));
}, this); // }, this);
} // }
} // }
// 当前关卡的水花动效 // 当前关卡的水花动效
// console.log(homeData.levels,window['last_level'],target); // console.log(homeData.levels,window['last_level'],target);
...@@ -617,12 +627,12 @@ export default class MapScene extends Scene { ...@@ -617,12 +627,12 @@ export default class MapScene extends Scene {
} }
}, this); }, this);
//关于滚动,可以仅在第一次打开时自动滚到到最新位置,其余情况不动 // //关于滚动,可以仅在第一次打开时自动滚到到最新位置,其余情况不动
let lastOrder = homeData.levels.length + 1; // let lastOrder = homeData.levels.length + 1;
if (homeData.levels.length >= window['total_level']) // if (homeData.levels.length >= window['total_level'])
lastOrder = window['total_level']; // lastOrder = window['total_level'];
this.scroll.viewport.scrollV = this.getScrollV(lastOrder, this.stage.stageHeight); // this.scroll.viewport.scrollV = this.getScrollV(lastOrder, this.stage.stageHeight);
this.setScrollVShow(); // this.setScrollVShow();
// console.warn(this.getScrollV(lastOrder, this.stage.stageHeight)); // console.warn(this.getScrollV(lastOrder, this.stage.stageHeight));
// setTimeout(() => { // setTimeout(() => {
...@@ -784,7 +794,7 @@ export default class MapScene extends Scene { ...@@ -784,7 +794,7 @@ export default class MapScene extends Scene {
if(i3map.y!=i3mapy){ if(i3map.y!=i3mapy){
i3map.y = i3mapy; i3map.y = i3mapy;
var i3startlevel = MapTopPart.LEVEL_NUMS+(i3-1)*MapRpeatPart.LEVEL_NUMS; var i3startlevel = MapTopPart.LEVEL_NUMS+(i3-1)*MapRpeatPart.LEVEL_NUMS;
console.log("局部显示",i3,i3mapy,i3startlevel,lidx,nidx); // console.log("局部显示",i3,i3mapy,i3startlevel,lidx,nidx);
this.changePartLevelShow(i3map,i3startlevel,"mid"); this.changePartLevelShow(i3map,i3startlevel,"mid");
} }
...@@ -809,14 +819,14 @@ export default class MapScene extends Scene { ...@@ -809,14 +819,14 @@ export default class MapScene extends Scene {
}else if(mappartype=="bot"){ }else if(mappartype=="bot"){
mapnums = MapBottomPart.LEVEL_NUMS; mapnums = MapBottomPart.LEVEL_NUMS;
} }
console.log("修改类型",mappartype,startlevel,mappart); // console.log("修改类型",mappartype,startlevel,mappart);
var last_level = window['last_level']; var last_level = window['last_level'];
var homeData = getHomeData(); var homeData = getHomeData();
for(var i=0;i<mapnums;i++){ for(var i=0;i<mapnums;i++){
const levelOrder = startlevel + i + 1; const levelOrder = startlevel + i + 1;
let icon = mappart.getIcon(i); let icon = mappart.getIcon(i);
let havewater_light = icon.getChildByName('water_light'); let havewater_light = icon.getChildByName('water_light');
icon.removeEventListener(egret.TouchEvent.TOUCH_TAP,this.showToastQd); icon.removeEventListener(egret.TouchEvent.TOUCH_TAP,this.showToastQd,this);
mappart.getTxt(i).text = levelOrder + ''; mappart.getTxt(i).text = levelOrder + '';
if(levelOrder>last_level){ if(levelOrder>last_level){
if(havewater_light){ if(havewater_light){
...@@ -835,7 +845,7 @@ export default class MapScene extends Scene { ...@@ -835,7 +845,7 @@ export default class MapScene extends Scene {
} }
icon.filters = null; icon.filters = null;
var leveldata = homeData.levels[levelOrder-1]; var leveldata = homeData.levels[levelOrder-1];
console.log("关卡测试:"+levelOrder); // console.log("关卡测试:"+levelOrder);
(icon['nums'] as eui.Image).source = 'icon_png'; (icon['nums'] as eui.Image).source = 'icon_png';
(icon['bmptxt'] as eui.BitmapLabel).visible = true; (icon['bmptxt'] as eui.BitmapLabel).visible = true;
(icon['bmptxt'] as eui.BitmapLabel).font = 'nums_fnt'; (icon['bmptxt'] as eui.BitmapLabel).font = 'nums_fnt';
...@@ -849,9 +859,10 @@ export default class MapScene extends Scene { ...@@ -849,9 +859,10 @@ export default class MapScene extends Scene {
(icon['starsp'] as MapStarComp).setStar(0); (icon['starsp'] as MapStarComp).setStar(0);
(icon['starsp'] as MapStarComp).visible = true; (icon['starsp'] as MapStarComp).visible = true;
if(!havewater_light){ if(!havewater_light){
console.log(icon,this.pic);
this.pic.x = 50; this.pic.x = 50;
this.pic.y = 37+7; this.pic.y = 37+7;
icon.addChild(this.pic); icon.addChildAt(this.pic,1);
egret.Tween.removeTweens(this.pic); egret.Tween.removeTweens(this.pic);
egret.Tween.get(this.pic, { loop: true }) egret.Tween.get(this.pic, { loop: true })
...@@ -878,12 +889,47 @@ export default class MapScene extends Scene { ...@@ -878,12 +889,47 @@ export default class MapScene extends Scene {
} }
} }
} }
//用户关卡数据更新,更行map
freshMapShow(){
console.log("刷新显示");
var topltxt = this.maptoppart.getIcon(0)['bmptxt'] as eui.BitmapLabel;
var onepltxt = this.onemapreppart.getIcon(0)['bmptxt'] as eui.BitmapLabel;
var twopltxt = this.twomapreppart.getIcon(0)['bmptxt'] as eui.BitmapLabel;
var botltxt = this.mapbotpart.getIcon(0)['bmptxt'] as eui.BitmapLabel;
if(topltxt){
var toplevel = Number(topltxt.text)-1;
this.changePartLevelShow(this.maptoppart,toplevel,"top");
}
if(onepltxt){
var oneplevel = Number(onepltxt.text)-1;
this.changePartLevelShow(this.onemapreppart,oneplevel,"mid");
}
if(twopltxt){
var twoplevel = Number(twopltxt.text)-1;
this.changePartLevelShow(this.twomapreppart,twoplevel,"mid");
}
if(botltxt){
var botlevel = Number(botltxt.text)-1;
this.changePartLevelShow(this.mapbotpart,botlevel,"bot");
}
}
//点击 //点击
clickIcon(e){ clickIcon(e){
console.log(e); console.log(e);
let icon = e.target as eui.Group; if(e.target.name!='water_light'){
let txt = icon['bmptxt'] as eui.BitmapLabel; let icon = e.target as eui.Group;
console.log('关卡点击',txt.text); let txt = icon['bmptxt'] as eui.BitmapLabel;
console.log('关卡点击',txt.text);
var homeData = getHomeData();
var clicklevel = Number(txt.text);
if(clicklevel<=homeData.levels.length+1){//可进行关卡
PanelCtrl.instance.show('StartPanel', clicklevel);
NetManager.ins.clickLog(getlogItem(19));
}else{
console.log('必须通关前面的关卡才能开启本关');
}
}
} }
showToastQd(){ showToastQd(){
showToast('敬请期待更多关卡~'); showToast('敬请期待更多关卡~');
...@@ -1012,12 +1058,12 @@ export default class MapScene extends Scene { ...@@ -1012,12 +1058,12 @@ export default class MapScene extends Scene {
// 中间重复的 // 中间重复的
getScrollV3(lastOrder, stageHeight) { getScrollV3(lastOrder, stageHeight) {
const ylist = [4, 55, 160, 315, 431, 529, 594, 714, 820, 900, 970, 1098, 1164, 1245, 1380, 1493, 1548, 1611, 1734, 1882, 2023, 2180]; const ylist = [4, 55, 160, 315, 431, 529, 594, 714, 820, 900, 970, 1098, 1164, 1245, 1380, 1493, 1548, 1611, 1734, 1882, 2023, 2180];
const y0 = this._data.top.height;//顶部的高度 const y0 = 1275;//顶部的高度
let a0 = (lastOrder - MapTopPart.LEVEL_NUMS) % MapRpeatPart.LEVEL_NUMS; //减去7后的order 8-7 = 1 let a0 = (lastOrder - MapTopPart.LEVEL_NUMS) % MapRpeatPart.LEVEL_NUMS; //减去7后的order 8-7 = 1
if (a0 == 0) a0 = MapRpeatPart.LEVEL_NUMS; if (a0 == 0) a0 = MapRpeatPart.LEVEL_NUMS;
const a1 = Math.ceil((lastOrder - MapTopPart.LEVEL_NUMS) / MapRpeatPart.LEVEL_NUMS) - 1;//当前地图repeat的顺序 const a1 = Math.ceil((lastOrder - MapTopPart.LEVEL_NUMS) / MapRpeatPart.LEVEL_NUMS) - 1;//当前地图repeat的顺序
const y1 = ylist[a0 - 1]; const y1 = ylist[a0 - 1];
const y2 = y0 + y1 + a1 * this._data.list[0].height; const y2 = y0 + y1 + a1 * 2297;
return y2 - stageHeight / 2; return y2 - stageHeight / 2;
} }
...@@ -1031,59 +1077,76 @@ export default class MapScene extends Scene { ...@@ -1031,59 +1077,76 @@ export default class MapScene extends Scene {
// 尾部 // 尾部
getScrollV2(lastOrder, stageHeight) { getScrollV2(lastOrder, stageHeight) {
const y0 = this._data.bottom.y; var total_level = window['total_level'];
lastOrder = lastOrder - this._data.list.length * MapRpeatPart.LEVEL_NUMS - 7; var maptop_level = MapTopPart.LEVEL_NUMS;
var maprep_level = MapRpeatPart.LEVEL_NUMS;
var mapbot_level = MapBottomPart.LEVEL_NUMS;
var repeatnum = Math.abs((total_level-maptop_level-mapbot_level)/maprep_level)
const y0 = this.mapbotpart.y;
console.log("底部scroll",y0)
lastOrder = lastOrder - repeatnum * MapRpeatPart.LEVEL_NUMS - 7;
if(lastOrder<1){ if(lastOrder<1){
lastOrder = 1; lastOrder = 1;
}else if(lastOrder>3){
lastOrder = 3;
} }
const totalHeight = this._data.top.height + console.log("底部scroll",lastOrder);
(this._data.list.length * this._data.list[0].height) var maptop_height = 1275;
+ this._data.bottom.height; var maprep_height = 2297;
var mapbot_height = 528;
const totalHeight = maptop_height +
(repeatnum * maprep_height)
+ mapbot_height;
const ylist = [62, 176, 314].map(i => i + 40); const ylist = [62, 176, 314].map(i => i + 40);
const targetY = y0 + ylist[lastOrder - 1] - stageHeight / 2; const targetY = y0 + ylist[lastOrder - 1] - stageHeight / 2;
console.log("底部scroll",targetY,totalHeight,stageHeight,repeatnum);
if (targetY >= (totalHeight - stageHeight)) return totalHeight - stageHeight; if (targetY >= (totalHeight - stageHeight)) return totalHeight - stageHeight;
return targetY; return targetY;
} }
// 设置关卡图标为未开启 // 设置关卡图标为未开启
disableIcon(level) { // disableIcon(level) {
return; // return;
this.setGray(level); // this.setGray(level);
MapScene.starHash[level].visible = false; // MapScene.starHash[level].visible = false;
} // }
// 设置关卡图标为已开启 // 设置关卡图标为已开启
enableIcon(level) { // enableIcon(level) {
return; // return;
this.resetGray(level); // this.resetGray(level);
MapScene.starHash[level].visible = true; // MapScene.starHash[level].visible = true;
} // }
// 设置关卡图标为当前关卡 // 设置关卡图标为当前关卡
nowIcon(level) { // nowIcon(level) {
return; // return;
const icon = MapScene.iconHash[level]; // const icon = MapScene.iconHash[level];
(icon['nums'] as eui.Image).source = 'iconnow_png'; // (icon['nums'] as eui.Image).source = 'iconnow_png';
(icon['bmptxt'] as eui.BitmapLabel).visible = true; // (icon['bmptxt'] as eui.BitmapLabel).visible = true;
(icon['bmptxt'] as eui.BitmapLabel).font = 'nums3_fnt'; // (icon['bmptxt'] as eui.BitmapLabel).font = 'nums3_fnt';
MapScene.starHash[level].visible = true; // MapScene.starHash[level].visible = true;
} // }
setGray(order: number) { // setGray(order: number) {
return; // return;
const icon = MapScene.iconHash[order]; // const icon = MapScene.iconHash[order];
(icon['nums'] as eui.Image).source = 'icongray_png'; // (icon['nums'] as eui.Image).source = 'icongray_png';
(icon['bmptxt'] as eui.BitmapLabel).visible = false; // (icon['bmptxt'] as eui.BitmapLabel).visible = false;
// (icon['bmptxt'] as eui.BitmapLabel).font = 'nums3_fnt'; // // (icon['bmptxt'] as eui.BitmapLabel).font = 'nums3_fnt';
} // }
resetGray(order: number) { // resetGray(order: number) {
return; // return;
const icon = MapScene.iconHash[order]; // const icon = MapScene.iconHash[order];
(icon['nums'] as eui.Image).source = 'icon_png'; // (icon['nums'] as eui.Image).source = 'icon_png';
(icon['bmptxt'] as eui.BitmapLabel).visible = true; // (icon['bmptxt'] as eui.BitmapLabel).visible = true;
(icon['bmptxt'] as eui.BitmapLabel).font = 'nums_fnt'; // (icon['bmptxt'] as eui.BitmapLabel).font = 'nums_fnt';
} // }
showLog() { showLog() {
...@@ -1146,34 +1209,10 @@ export default class MapScene extends Scene { ...@@ -1146,34 +1209,10 @@ export default class MapScene extends Scene {
} }
updateHomeData() { updateHomeData() {
return;
const homeData = getHomeData(); const homeData = getHomeData();
this['goldTxt'].text = `${homeData.wealth}`; this['goldTxt'].text = `${homeData.wealth}`;
for (let j = 1; j < window['total_level']; j++) { this.freshMapShow();
this.disableIcon(j + 1);
}
for (let i = 0; i < homeData.levels.length; i++) {
const level = homeData.levels[i];
const star = MapScene.starHash[i + 1];
if (level) {
star.setStar(level.stars);
this.enableIcon(level.levelNum);
} else {
this.disableIcon(level.levelNum);
}
}
if (homeData.levels.length == 0) {
const star = MapScene.starHash[1];
star.setStar(0);
this.enableIcon(1);
} else if (homeData.levels.length == window['last_level']) {
} else {
const star = MapScene.starHash[homeData.levels.length + 1];
this.nowIcon(homeData.levels.length + 1);
}
this.updateTimerView(); this.updateTimerView();
} }
......
...@@ -23,6 +23,8 @@ export default class MapStarComp extends ComponentBase { ...@@ -23,6 +23,8 @@ export default class MapStarComp extends ComponentBase {
} else if(num == 3) { } else if(num == 3) {
this['star3'].visible = true; this['star3'].visible = true;
} }
this['star1'].touchEnabled = this['star2'].touchEnabled
= this['star3'].touchEnabled = false;
} }
get skinKey(): string { get skinKey(): string {
......
...@@ -12,12 +12,13 @@ export default class MapTopPart extends ComponentBase { ...@@ -12,12 +12,13 @@ export default class MapTopPart extends ComponentBase {
const star = new MapStarComp(); const star = new MapStarComp();
star.loadSkin(); star.start(); star.loadSkin(); star.start();
const icon = this.getIcon(i); const icon = this.getIcon(i);
icon.addChild(star);
icon.show = ()=>{icon.visible = true;}; icon.show = ()=>{icon.visible = true;};
icon.hide = ()=>{icon.visible = false;}; icon.hide = ()=>{icon.visible = false;};
icon['nums'] = icon.getChildAt(0); icon['nums'] = icon.getChildAt(0);
icon['bmptxt']=icon.getChildAt(1); icon['bmptxt']=icon.getChildAt(1);
icon.addChildAt(star,0);
icon['starsp'] = star; icon['starsp'] = star;
icon.touchEnabled = true; icon.touchEnabled = true;
......
...@@ -3617,7 +3617,7 @@ ...@@ -3617,7 +3617,7 @@
{ {
"levelNum": 721, "levelNum": 721,
"maxScore": 47440, "maxScore": 47440,
"stars": 1 "stars": 3
}, },
{ {
"levelNum": 722, "levelNum": 722,
...@@ -3627,7 +3627,42 @@ ...@@ -3627,7 +3627,42 @@
{ {
"levelNum": 723, "levelNum": 723,
"maxScore": 47440, "maxScore": 47440,
"stars": 3
},
{
"levelNum": 724,
"maxScore": 47440,
"stars": 2
},
{
"levelNum": 725,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 726,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 727,
"maxScore": 47440,
"stars": 3
},
{
"levelNum": 728,
"maxScore": 47440,
"stars": 1 "stars": 1
},
{
"levelNum": 729,
"maxScore": 47440,
"stars": 3
},
{
"levelNum": 730,
"maxScore": 47440,
"stars": 2
} }
], ],
"remainProp": [ "remainProp": [
......
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