Commit 00d20b96 authored by zjz1994's avatar zjz1994

优化暂存

parent b17cb180
......@@ -254,29 +254,46 @@ export default class MapScene extends Scene {
setGlow(this['totalStarTxt'], 0x0083e8, 1);
//新地图创建
console.log("新添加地图");
var total_level = window['total_level'];
var maptop_level = MapTopPart.LEVEL_NUMS;
var maprep_level = MapRpeatPart.LEVEL_NUMS;
var mapbot_level = MapBottomPart.LEVEL_NUMS;
var maptop_height =
console.log('地图数据-----',this._data);
this.topPart = this._data.top;
this.repeatsPart = this._data.list;
this.bottomPart = this._data.bottom;
this.scroll.height = this.stage.stageHeight;
this.scrollGroup.addChild(this._data.top);
var maptop_height = this.maptoppart.height||1275;
var maprep_height = this.onemapreppart.height||2297;
var mapbot_height = this.mapbotpart.height||528;
var repeatnum = Math.abs((total_level-maptop_level-mapbot_level)/maprep_level)
console.log("中间maprepeat数量",repeatnum);
this.scrollMapy.push(0);
this.scrollMapy.push(maptop_height);
var smaph = maptop_height;
for(var mp=0;mp<repeatnum;mp++){
smaph += maprep_height;
this.scrollMapy.push(smaph);
}
this.scrollMapy.push(smaph+mapbot_height);
var scrollheight = maptop_height+repeatnum*maprep_height+mapbot_height;
console.log("scroll--------height",scrollheight,this.scrollMapy);
this.scrollGroup.height = scrollheight;
var nowlevel = getHomeData().levels.length;
console.log("玩家level",nowlevel);
// console.log('地图数据-----',this._data);
// this.topPart = this._data.top;
// this.repeatsPart = this._data.list;
// this.bottomPart = this._data.bottom;
// this.scroll.height = this.stage.stageHeight;
// this.scrollGroup.addChild(this._data.top);
this._data.list.forEach((ele, index) => {
this.scrollGroup.addChild(ele);
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._data.list.forEach((ele, index) => {
// this.scrollGroup.addChild(ele);
// 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();
......@@ -527,26 +544,26 @@ export default class MapScene extends Scene {
// 当前关卡的水花动效
// console.log(homeData.levels,window['last_level'],target);
if (homeData.levels.length < window['last_level']) {
// console.log("添加水花动画0000000000");
this.creatPic();
const targetIcon = MapScene.iconHash[target];
targetIcon.mappart.addChildAt(this.pic, 1);
// targetIcon.parent.addChildAt(pic, 0);
this.pic.x = targetIcon.x + 50;
this.pic.y = targetIcon.y + 37 + 7;
// pic.x = 50 - 2;
// pic.y = 37 + 10;
egret.Tween.get(this.pic, { loop: true })
.set({
scaleX:1,
scaleY:1,
alpha:1
})
.to({ scaleX: 2, scaleY: 2, alpha: 0 }, 1000).wait(1000);
}
// if (homeData.levels.length < window['last_level']) {
// // console.log("添加水花动画0000000000");
// this.creatPic();
// const targetIcon = MapScene.iconHash[target];
// targetIcon.mappart.addChildAt(this.pic, 1);
// // targetIcon.parent.addChildAt(pic, 0);
// this.pic.x = targetIcon.x + 50;
// this.pic.y = targetIcon.y + 37 + 7;
// // pic.x = 50 - 2;
// // pic.y = 37 + 10;
// egret.Tween.get(this.pic, { loop: true })
// .set({
// scaleX:1,
// scaleY:1,
// alpha:1
// })
// .to({ scaleX: 2, scaleY: 2, alpha: 0 }, 1000).wait(1000);
// }
this.updateHomeData();
......@@ -576,6 +593,7 @@ export default class MapScene extends Scene {
if (homeData.levels.length >= window['total_level'])
lastOrder = window['total_level'];
this.scroll.viewport.scrollV = this.getScrollV(lastOrder, this.stage.stageHeight);
this.setScrollVShow();
// console.warn(this.getScrollV(lastOrder, this.stage.stageHeight));
// setTimeout(() => {
......@@ -663,6 +681,7 @@ export default class MapScene extends Scene {
};
onEnterFrame() {
this.setScrollVShow();
const offset = 0;
const y0 = this.scroll.viewport.scrollV + offset;
const y1 = this.stage.stageHeight + this.scroll.viewport.scrollV - offset;
......@@ -688,6 +707,38 @@ export default class MapScene extends Scene {
}
scrollMapy:Array<number> = [];
/**
* 调整块显示
*/
setScrollVShow(){
var scrollv = this.scroll.viewport.scrollV;
var stageh = this.stage.stageHeight;
var y0 = scrollv;
var y1 = stageh+scrollv;
var lidx = 0;
var nidx = 0;
for(var i1=0;i1<this.scrollMapy.length;i1++){
var i1sy = this.scrollMapy[i1];
if(i1sy>y0){
lidx = i1-1;
break;
}
}
for(var i2=0;i2<this.scrollMapy.length;i2++){
var i2sy = this.scrollMapy[i2];
if(i2sy>=y1){
nidx = i2;
break;
}
}
console.log("局部显示",y0,y1,lidx,nidx,this.scrollMapy.length,this.scrollMapy[lidx],this.scrollMapy[nidx]);
}
// 添加图标
private addIcon() {
this.icons = {
......@@ -846,18 +897,21 @@ export default class MapScene extends Scene {
// 设置关卡图标为未开启
disableIcon(level) {
return;
this.setGray(level);
MapScene.starHash[level].visible = false;
}
// 设置关卡图标为已开启
enableIcon(level) {
return;
this.resetGray(level);
MapScene.starHash[level].visible = true;
}
// 设置关卡图标为当前关卡
nowIcon(level) {
return;
const icon = MapScene.iconHash[level];
(icon['nums'] as eui.Image).source = 'iconnow_png';
(icon['bmptxt'] as eui.BitmapLabel).visible = true;
......@@ -866,6 +920,7 @@ export default class MapScene extends Scene {
}
setGray(order: number) {
return;
const icon = MapScene.iconHash[order];
(icon['nums'] as eui.Image).source = 'icongray_png';
(icon['bmptxt'] as eui.BitmapLabel).visible = false;
......@@ -873,6 +928,7 @@ export default class MapScene extends Scene {
}
resetGray(order: number) {
return;
const icon = MapScene.iconHash[order];
(icon['nums'] as eui.Image).source = 'icon_png';
(icon['bmptxt'] as eui.BitmapLabel).visible = true;
......@@ -906,6 +962,7 @@ export default class MapScene extends Scene {
//添加地图页头像
addAvatar(level, ele?) {
return;
const item = MapScene.iconHash[level];
const parent = item['mappart'];
const avatar = new AvatarComp();
......@@ -939,6 +996,7 @@ export default class MapScene extends Scene {
}
updateHomeData() {
return;
const homeData = getHomeData();
this['goldTxt'].text = `${homeData.wealth}`;
......
......@@ -149,7 +149,7 @@ export const createData = () => {
startSceneData.top.loadSkin(); startSceneData.top.start();
for (let i = 0; i < repeatCount; i++) {
const repeat = new MapRpeatPart(i, startSceneData.top.height);
const repeat = new MapRpeatPart();//new MapRpeatPart(i, startSceneData.top.height);
repeat.loadSkin(); repeat.start();
list.push(repeat);
}
......
......@@ -3628,16 +3628,6 @@
"levelNum": 723,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 724,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 725,
"maxScore": 47440,
"stars": 1
}
],
"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