Commit d58ce7f5 authored by zhangjinzhou's avatar zhangjinzhou

Merge branch '拆home接口分页' of http://gitlab2.dui88.com/wanghongyuan/xiaoxiaole into dev

parents 673bf820 a1677f30
...@@ -82,6 +82,7 @@ import HelpBloodPanel from "../../src/panels/help/HelpBloodPanel"; ...@@ -82,6 +82,7 @@ import HelpBloodPanel from "../../src/panels/help/HelpBloodPanel";
import HelpInvitePanel from "../../src/panels/help/HelpInvitePanel"; import HelpInvitePanel from "../../src/panels/help/HelpInvitePanel";
import HelpScratchPanel from "../../src/panels/help/HelpScratchPanel"; import HelpScratchPanel from "../../src/panels/help/HelpScratchPanel";
import HelpInvitePanel2 from "../../src/panels/help/HelpInvitePanel2"; import HelpInvitePanel2 from "../../src/panels/help/HelpInvitePanel2";
import levelHomeData from "../../src/levelHomeData";
export default class MainBase extends eui.UILayer { export default class MainBase extends eui.UILayer {
constructor() { constructor() {
...@@ -97,7 +98,7 @@ export default class MainBase extends eui.UILayer { ...@@ -97,7 +98,7 @@ export default class MainBase extends eui.UILayer {
// 功能。 // 功能。
// 0:隐藏 // 0:隐藏
// 1:不隐藏 // 1:不隐藏
window['SNNativeClient']&&window['SNNativeClient'].setNavigationHiden(0); window['SNNativeClient'] && window['SNNativeClient'].setNavigationHiden(0);
} else { } else {
// 1.页面引入 // 1.页面引入
// http://res.suning.cn/project/mvs/RES/common/script/android/sneapp.js // http://res.suning.cn/project/mvs/RES/common/script/android/sneapp.js
...@@ -339,7 +340,7 @@ export default class MainBase extends eui.UILayer { ...@@ -339,7 +340,7 @@ export default class MainBase extends eui.UILayer {
RES.getResAsync("ele46_6_png"); RES.getResAsync("ele46_6_png");
RES.getResAsync("ele46_sz_png"); RES.getResAsync("ele46_sz_png");
for (var i = 1; i <= 27; i++) { for (var i = 1; i <= 27; i++) {
RES.getResAsync("bonusFra" + i + "_png") RES.getResAsync("bonusFra" + i + "_png")
} }
...@@ -553,7 +554,7 @@ export default class MainBase extends eui.UILayer { ...@@ -553,7 +554,7 @@ export default class MainBase extends eui.UILayer {
return new Promise((r) => { return new Promise((r) => {
NetManager.ins.hc_advert(() => { NetManager.ins.hc_advert(() => {
r(); r();
},3) }, 3)
}); });
} }
...@@ -605,11 +606,15 @@ export default class MainBase extends eui.UILayer { ...@@ -605,11 +606,15 @@ export default class MainBase extends eui.UILayer {
} }
protected async createGameScene() { protected async createGameScene() {
window['getaward'] = () => { getRedBombAward((param) => { console.log(param) }) }; window['getaward'] = () => { getRedBombAward((param) => { console.log(param) }) };
localStorage.setItem('taskCenter' + window['CFG'].consumerId, 'true'); // 任务中心强提示,每次进入游戏只强提示一次 localStorage.setItem('taskCenter' + window['CFG'].consumerId, 'true'); // 任务中心强提示,每次进入游戏只强提示一次
await this.hcHome(); await this.hcHome();
let playerlevel = getHomeData().playerlevel;
console.error("玩家level===>", playerlevel);
await levelHomeData.initMapLevelData();
console.log("获取到玩家level数据==>");
await Promise.all([ await Promise.all([
// this.getAd(), // this.getAd(),
this.ajaxElement(), this.ajaxElement(),
...@@ -621,25 +626,25 @@ export default class MainBase extends eui.UILayer { ...@@ -621,25 +626,25 @@ export default class MainBase extends eui.UILayer {
this.hbRainBaseInfo(), this.hbRainBaseInfo(),
]); ]);
if(GFun.isIOS){ if (GFun.isIOS) {
}else{ } else {
console.log("苏宁安卓开始准备"); console.log("苏宁安卓开始准备");
if(!window['baseApi']){ if (!window['baseApi']) {
await new Promise((resolve,reject)=>{ await new Promise((resolve, reject) => {
// let t1 = setTimeout(() => { // let t1 = setTimeout(() => {
// console.log("苏宁准备失败"); // console.log("苏宁准备失败");
// resolve(); // resolve();
// }, 6000); // }, 6000);
document.addEventListener("deviceready", function() { document.addEventListener("deviceready", function () {
console.log("苏宁baseapi准备完毕222"); console.log("苏宁baseapi准备完毕222");
// clearTimeout(t1); // clearTimeout(t1);
resolve(); resolve();
}.bind(this), false); }.bind(this), false);
}) })
console.log("游戏继续"); console.log("游戏继续");
}else{ } else {
console.log("已经获得baseapi,游戏继续"); console.log("已经获得baseapi,游戏继续");
} }
} }
...@@ -655,6 +660,10 @@ export default class MainBase extends eui.UILayer { ...@@ -655,6 +660,10 @@ export default class MainBase extends eui.UILayer {
/////////// ///////////
SceneCtrl.instance.change(ModuleTypes.START_SCENE, this.svgaList); SceneCtrl.instance.change(ModuleTypes.START_SCENE, this.svgaList);
NetManager.ins.hc_home((s, data) => {
console.log("更新用户信息", s, data)
}, window['collectRuleId']);
NetManager.ins.getShareInfo(() => { NetManager.ins.getShareInfo(() => {
const result = DataManager.ins.getData('getShareInfo'); const result = DataManager.ins.getData('getShareInfo');
window['registerWX'](result); window['registerWX'](result);
...@@ -676,6 +685,7 @@ export default class MainBase extends eui.UILayer { ...@@ -676,6 +685,7 @@ export default class MainBase extends eui.UILayer {
// if(timerInit) { // if(timerInit) {
NetManager.ins.hc_home(() => { NetManager.ins.hc_home(() => {
updateMainTimer(); updateMainTimer();
//更新bloodpanel和mapscene //更新bloodpanel和mapscene
const currentScene = SceneCtrl.instance.currentScene; const currentScene = SceneCtrl.instance.currentScene;
...@@ -745,8 +755,13 @@ export const updateMainTimer = () => { ...@@ -745,8 +755,13 @@ export const updateMainTimer = () => {
} }
} }
export const updateMainTimerAfterGetData = () => { export const updateMainTimerAfterGetData = (chapter = -1) => {
NetManager.ins.hc_home(() => { NetManager.ins.hc_home(() => {
if (chapter != -1) {
//更新地图关卡数据
levelHomeData.updateLevelData(chapter)
}
updateMainTimer(); updateMainTimer();
}, window['collectRuleId']); }, window['collectRuleId']);
} }
\ No newline at end of file
...@@ -105,14 +105,13 @@ export default class SceneCtrl { ...@@ -105,14 +105,13 @@ export default class SceneCtrl {
scene.start(data); scene.start(data);
if(oldScene){ if(oldScene){
console.log("移除scene------------",oldScene.skinName);
oldScene.parent&&oldScene.parent.removeChild(oldScene); oldScene.parent&&oldScene.parent.removeChild(oldScene);
oldScene.destroy(); oldScene.destroy();
oldScene = null; oldScene = null;
} }
}, this); }, this);
scene.onLoad().then(() => { scene.onLoad().then(() => {
// console.log("onLoad---after",scene.skinName);
this.addToStage(scene); this.addToStage(scene);
onComplete && onComplete(); onComplete && onComplete();
}); });
......
...@@ -629,6 +629,7 @@ export class DataManager extends ABDataManager { ...@@ -629,6 +629,7 @@ export class DataManager extends ABDataManager {
} }
getData(name) { getData(name) {
// console.log(name,this[this.getKey(name)]);
return this[this.getKey(name)] return this[this.getKey(name)]
} }
......
...@@ -486,7 +486,7 @@ export class NetManager extends ABNetManager { ...@@ -486,7 +486,7 @@ export class NetManager extends ABNetManager {
var sgin = this.encrypt(JSON.stringify(data)); var sgin = this.encrypt(JSON.stringify(data));
const net: INetData = { const net: INetData = {
name: 'hc_submit', name: 'hc_submit',
uri: window['duiba'] + '/hdtool/happyclear/submit', uri: window['duiba'] + '/hdtool/happyclear/submitNew',
type: 'post', type: 'post',
dataType: 'json', dataType: 'json',
param: { param: {
...@@ -510,7 +510,7 @@ export class NetManager extends ABNetManager { ...@@ -510,7 +510,7 @@ export class NetManager extends ABNetManager {
hc_openTreasureBox(callback: Function): void { hc_openTreasureBox(callback: Function): void {
const net: INetData = { const net: INetData = {
name: 'hc_openTreasureBox', name: 'hc_openTreasureBox',
uri: window['duiba'] + '/customActivity/happyclear/openTreasureBox', uri: window['duiba'] + '/customActivity/happyclear/openTreasureBoxNew',//openTreasureBox
type: 'post', type: 'post',
dataType: 'json', dataType: 'json',
param: { param: {
...@@ -872,7 +872,7 @@ export class NetManager extends ABNetManager { ...@@ -872,7 +872,7 @@ export class NetManager extends ABNetManager {
public hc_home(callback: Function, collectRuleId: number): void { public hc_home(callback: Function, collectRuleId: number): void {
const net: INetData = { const net: INetData = {
name: 'hc_home', name: 'hc_home',
uri: window['duiba'] + '/customActivity/happyclear/home', uri: window['duiba'] + '/customActivity/happyclear/homeNew',//home
type: 'get', type: 'get',
dataType: 'json', dataType: 'json',
param: { param: {
...@@ -1194,7 +1194,7 @@ export class NetManager extends ABNetManager { ...@@ -1194,7 +1194,7 @@ export class NetManager extends ABNetManager {
const net: INetData = { const net: INetData = {
name: 'hc_doJoin', name: 'hc_doJoin',
uri: window['duiba'] + '/hdtool/happyclear/doJoin', uri: window['duiba'] + '/hdtool/happyclear/doJoinNew',
type: 'post', type: 'post',
dataType: 'json', dataType: 'json',
param: param, param: param,
...@@ -1403,7 +1403,7 @@ export class NetManager extends ABNetManager { ...@@ -1403,7 +1403,7 @@ export class NetManager extends ABNetManager {
public hc_totalNumRank(callback: Function): void { public hc_totalNumRank(callback: Function): void {
const net: INetData = { const net: INetData = {
name: 'hc_totalNumRank', name: 'hc_totalNumRank',
uri: window['duiba'] + '/customActivity/happyclear/totalNumRank', uri: window['duiba'] + '/customActivity/happyclear/totalNumRankNew',
type: 'get', type: 'get',
dataType: 'json', dataType: 'json',
param: { param: {
...@@ -1418,7 +1418,7 @@ export class NetManager extends ABNetManager { ...@@ -1418,7 +1418,7 @@ export class NetManager extends ABNetManager {
public hc_mapRank(callback: Function): void { public hc_mapRank(callback: Function): void {
const net: INetData = { const net: INetData = {
name: 'hc_mapRank', name: 'hc_mapRank',
uri: window['duiba'] + '/customActivity/happyclear/mapRank', uri: window['duiba'] + '/customActivity/happyclear/mapRankNew',
type: 'get', type: 'get',
dataType: 'json', dataType: 'json',
param: { param: {
...@@ -2605,4 +2605,21 @@ export class NetManager extends ABNetManager { ...@@ -2605,4 +2605,21 @@ export class NetManager extends ABNetManager {
}; };
this.send(net); this.send(net);
} }
public hc_levelhome(callback: Function, pageNo:Number,pageSize:Number): void {
let reqpageno = Number(pageNo)+1;
const net: INetData = {
name: 'hc_levelhome',
uri: window['duiba'] + '/customActivity/happyclear/findConsumerRecords',
type: 'get',
dataType: 'json',
param: {
activityId: DataManager.ins.customCfgData.actId,
pageNo:reqpageno,
pageSize:pageSize
},
callback: callback
};
this.send(net);
}
} }
\ No newline at end of file
...@@ -9,7 +9,7 @@ class FriendWxShare extends ComponentBase { ...@@ -9,7 +9,7 @@ class FriendWxShare extends ComponentBase {
start(rank) { start(rank) {
const data = getHomeData(); const data = getHomeData();
this['ranktxt'].text =`我在好友中排名第${rank}`; this['ranktxt'].text =`我在好友中排名第${rank}`;
this['lvTxt'].text = data.levels.length == 0 ? 1 : data.levels.length; this['lvTxt'].text = data.playerlevel == 0 ? 1 : data.playerlevel;
this['avatar'].mask = this['avatarMask']; this['avatar'].mask = this['avatarMask'];
const { data: user } = DataManager.ins.getData('hc_userInfo'); const { data: user } = DataManager.ins.getData('hc_userInfo');
this['avatar'].source = user.avatar; this['avatar'].source = user.avatar;
......
import { DataManager } from "../libs/tw/manager/DataManager"; import { DataManager } from "../libs/tw/manager/DataManager";
interface IHomeData { interface IHomeData {
levels:{levelNum,maxScore,stars}[]; // levels:{levelNum,maxScore,stars}[];
playerlevel:number;
totalStars; totalStars;
canReceiveTreasureBoxNum; canReceiveTreasureBoxNum;
isGetAllTreasureBox; isGetAllTreasureBox;
......
...@@ -7,7 +7,7 @@ import { DataManager } from "../libs/tw/manager/DataManager"; ...@@ -7,7 +7,7 @@ import { DataManager } from "../libs/tw/manager/DataManager";
class Share extends ComponentBase { class Share extends ComponentBase {
start() { start() {
const data = getHomeData(); const data = getHomeData();
this['lvTxt'].text = data.levels.length ==0 ? 1 : data.levels.length; this['lvTxt'].text = data.playerlevel ==0 ? 1 : data.playerlevel;
} }
get skinKey() { return 'Share' } get skinKey() { return 'Share' }
......
...@@ -5,7 +5,7 @@ class ShowOff extends ComponentBase { ...@@ -5,7 +5,7 @@ class ShowOff extends ComponentBase {
pic; pic;
start() { start() {
const data = getHomeData(); const data = getHomeData();
this['lvTxt'].text = data.levels.length; this['lvTxt'].text = data.playerlevel;
this['tipsTxt'].text = `超过了${Math.ceil(Math.random() * 100)}%的好友`; this['tipsTxt'].text = `超过了${Math.ceil(Math.random() * 100)}%的好友`;
} }
......
import SceneCtrl from "../libs/new_wx/ctrls/sceneCtrl";
import { NetManager } from "../libs/tw/manager/NetManager";
import getHomeData from "./getHomeData";
import MapBottomPart from "./mapScene/MapBottomPart";
import MapRpeatPart from "./mapScene/MapRpeatPart";
import MapTopPart from "./mapScene/MapTopPart";
export default class levelHomeData {
static leveldata = {};
static getlevelData(idx) {
idx += 1;
if (this.leveldata[idx]) {
return this.leveldata[idx].stars;
} else {
console.error("未取到对应数据===》", idx);
return 1;
}
}
static async getPageLevelData(idx, pagesize = 30) {
return new Promise((r) => {
let playerlevel = getHomeData().playerlevel;
if(idx>playerlevel){
return r();
}
let chalevel = playerlevel - idx;
let pageno = Math.floor(chalevel / pagesize);
let startidx = playerlevel - pageno * pagesize;
let endidx = startidx - pagesize;
if (endidx < 0) {
endidx = 0;
}
let shouldget = false;
for (let i1 = endidx+1; i1 < startidx; i1++) {
if (!this.leveldata[i1]) {
// console.log("33",this.leveldata[i1],this.leveldata,i1);
shouldget = true;
break;
}
}
if (!shouldget) {
// console.error("已存在,不必请求");
return r();
}else{
// console.error("还需要请求=====》",endidx,startidx,idx,this.leveldata);
}
NetManager.ins.hc_levelhome((s, data) => {
// console.error("hc_levelhome",s,data);
if (s) {
if (data && data.data) {
let levels = data.data;
let levelsleng = levels.length - 1;
let j=0;
for (let i = levelsleng; i > -1; i--) {
let idata = levels[i];
this.leveldata[startidx-j] = idata;
j++;
}
if(idx==8){
if(!this.leveldata[1]){
this.getPageLevelData(1);
}
}
}
// console.log("getPageLevelData",this.leveldata);
// console.error("请求一次page", pageno);
// console.log("获取levelData===>", this.leveldata.length, pageno);
}
r();
}, pageno, pagesize);
return;
})
}
static updateLevelData(idx, pagesize = 30) {
let playerlevel = getHomeData().playerlevel;
let chalevel = playerlevel-idx;
let pageno = Math.floor(chalevel/pagesize);
let startidx = playerlevel-pageno*pagesize;
NetManager.ins.hc_levelhome((s,data)=>{
if(s){
if(data&&data.data){
let levels = data.data;
let levelsleng = levels.length-1;
let j=0;
for(let i=levelsleng;i>-1;i--){
let idata = levels[i];
this.leveldata[startidx-j]=idata;
j++;
}
}
// console.log("updateLevelData",this.leveldata);
// try{
// if(SceneCtrl.instance.mapscene){
// // console.log("updateLevelData更新mapscene");
// // SceneCtrl.instance.mapscene.updateScene();
// }
// }catch(e){
// }
}
},pageno,pagesize);
return;
// let pageno = Math.ceil(idx / pagesize);
// let startidx = pagesize * (pageno - 1);
// NetManager.ins.hc_levelhome((s, data1) => {
// if (s) {
// let data = data1;
// if (data && data.data && data.data.levels) {
// let levels = data.data.levels;
// let levelsleng = levels.length - 1;
// for (let i = levelsleng; i > -1; i--) {
// let idata = levels[i];
// this.leveldata[i + startidx] = idata;
// }
// }
// }
// }, pageno, pagesize);
}
static async initMapLevelData() {
let playerlevel = getHomeData().playerlevel;
if(playerlevel>30){
if(playerlevel>60){
await this.getPageLevelData(8);
}
await this.getPageLevelData(playerlevel-30);
}
await this.getPageLevelData(playerlevel);
}
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -40,29 +40,23 @@ import getInviteBtn from "./getInviteBtn"; ...@@ -40,29 +40,23 @@ import getInviteBtn from "./getInviteBtn";
import { play2, play1 } from "../panels/help/svgaTool"; import { play2, play1 } from "../panels/help/svgaTool";
import { snpmAdStatic } from "../statics/snpmAdStatic"; import { snpmAdStatic } from "../statics/snpmAdStatic";
import MapStarComp from "./MapStarComp"; import MapStarComp from "./MapStarComp";
import levelHomeData from "../levelHomeData";
let doHelpFlag = false; let doHelpFlag = false;
// let doScratchHelpFlag = false;
// let adTag = false;
export default class MapScene extends Scene { export default class MapScene extends Scene {
static adData; static adData;
scrollGroup: eui.Group; scrollGroup: eui.Group;
scroll: eui.Scroller; scroll: eui.Scroller;
// topPart: MapTopPart;
// bottomPart: MapBottomPart;
// repeatsPart: MapRpeatPart[];
// static iconHash: any = {};
// static starHash: any = {};
_data; _data;
private icons = {}; private icons = {};
private actIcon: ActIcon = null; private actIcon: ActIcon = null;
maptoppart:MapTopPart; maptoppart: MapTopPart;
onemapreppart:MapRpeatPart; onemapreppart: MapRpeatPart;
twomapreppart:MapRpeatPart; twomapreppart: MapRpeatPart;
mapbotpart:MapBottomPart; mapbotpart: MapBottomPart;
maprankdata:Array<{ maprankdata: Array<{
levelNum, levelNum,
rank rank
}> = []; }> = [];
...@@ -132,9 +126,9 @@ export default class MapScene extends Scene { ...@@ -132,9 +126,9 @@ export default class MapScene extends Scene {
}); });
} }
pic:egret.Bitmap; pic: egret.Bitmap;
creatPic(){ creatPic() {
if(!this.pic){ if (!this.pic) {
let light = RES.getRes('lightani_png'); let light = RES.getRes('lightani_png');
this.pic = new egret.Bitmap(light); this.pic = new egret.Bitmap(light);
this.pic.name = 'water_light'; this.pic.name = 'water_light';
...@@ -143,21 +137,21 @@ export default class MapScene extends Scene { ...@@ -143,21 +137,21 @@ export default class MapScene extends Scene {
this.pic.touchEnabled = false; this.pic.touchEnabled = false;
} }
} }
initMapScene(){ initMapScene() {
var stagew = this.stage.stageWidth; var stagew = this.stage.stageWidth;
var stageh = this.stage.stageHeight; var stageh = this.stage.stageHeight;
var whl = stagew/stageh; var whl = stagew / stageh;
if(whl>0.5){ if (whl > 0.5) {
this.islongScreen = false; this.islongScreen = false;
}else{ } else {
this.islongScreen = true; this.islongScreen = true;
} }
this.islongScreen = false; this.islongScreen = false;
// console.log("手机长短屏幕适配",whl,this.islongScreen); // console.log("手机长短屏幕适配",whl,this.islongScreen);
if(this.islongScreen){ if (this.islongScreen) {
this['adapttop'].y = 50; this['adapttop'].y = 50;
this['settingsx'].bottom = 50; this['settingsx'].bottom = 50;
}else{ } else {
this['adapttop'].y = 0; this['adapttop'].y = 0;
this['settingsx'].bottom = 25; this['settingsx'].bottom = 25;
} }
...@@ -170,120 +164,8 @@ export default class MapScene extends Scene { ...@@ -170,120 +164,8 @@ export default class MapScene extends Scene {
this.updateMyInfo(); this.updateMyInfo();
this.updateAdData(); this.updateAdData();
this['avatar'].mask = this['avatarMask']; this['avatar'].mask = this['avatarMask'];
//新迁移==》
NetManager.ins.getSignInfo(async() => { this.awakeShow();
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);
if(nowTimerStr2 != oldTimerStr2){
console.log("时间上需要弹出广告");
var adpro = new Promise(res=>{
NetManager.ins.hc_advert(()=>{
const hc_advert = DataManager.ins.getData('hc_advert_1').data || {};
console.log("1广告数据",hc_advert);
let { noticeAdvert } = hc_advert;
if (noticeAdvert == null) {
noticeAdvert = { enable: false }
}
noticeAdvert = DataManager.ins.solveAdvertData(noticeAdvert);
if (noticeAdvert && noticeAdvert.enable){
panels.push('ad');
localStorage.setItem('nowTimer2Str' + window['CFG'].consumerId, nowTimerStr2);
}
res();
},1);
});
await adpro;
console.log("时间弹出广告结束");
}
// 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['rectbg'].height = this.stage.stageHeight; this['rectbg'].height = this.stage.stageHeight;
...@@ -301,27 +183,27 @@ export default class MapScene extends Scene { ...@@ -301,27 +183,27 @@ export default class MapScene extends Scene {
var maprep_level = MapRpeatPart.LEVEL_NUMS; var maprep_level = MapRpeatPart.LEVEL_NUMS;
var mapbot_level = MapBottomPart.LEVEL_NUMS; var mapbot_level = MapBottomPart.LEVEL_NUMS;
var maptop_height = this.maptoppart.height||1275; var maptop_height = this.maptoppart.height || 1275;
var maprep_height = this.onemapreppart.height||2297; var maprep_height = this.onemapreppart.height || 2297;
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;
for(var mp=0;mp<repeatnum;mp++){ for (var mp = 0; mp < repeatnum; mp++) {
smaph += maprep_height; smaph += maprep_height;
this.scrollMapy.push(smaph); this.scrollMapy.push(smaph);
} }
this.scrollMapy.push(smaph+mapbot_height); this.scrollMapy.push(smaph + mapbot_height);
// console.log(maptop_height,repeatnum,maprep_height,mapbot_height); // console.log(maptop_height,repeatnum,maprep_height,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.scroll.height = this.stage.stageHeight; this.scroll.height = this.stage.stageHeight;
this.scrollGroup.height = scrollheight; this.scrollGroup.height = scrollheight;
var nowlevel = getHomeData().levels.length; var nowlevel = getHomeData().playerlevel;
// 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);
...@@ -329,42 +211,27 @@ export default class MapScene extends Scene { ...@@ -329,42 +211,27 @@ export default class MapScene extends Scene {
this.scrollGroup.addChild(this.onemapreppart); this.scrollGroup.addChild(this.onemapreppart);
this.twomapreppart.y = 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.onemapreppart, MapTopPart.LEVEL_NUMS, 'mid');
this.changePartLevelShow(this.twomapreppart,MapTopPart.LEVEL_NUMS+MapRpeatPart.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(); const homeData = getHomeData();
//关于滚动,可以仅在第一次打开时自动滚到到最新位置,其余情况不动 //关于滚动,可以仅在第一次打开时自动滚到到最新位置,其余情况不动
let lastOrder = homeData.levels.length + 1; let lastOrder = homeData.playerlevel + 1;
if (homeData.levels.length >= window['total_level']) if (homeData.playerlevel >= 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);
// console.log("滚动设置",this.scroll.viewport.scrollV,this.scrollGroup.height,this.scroll.height,this.stage.stageHeight); // console.log("滚动设置",this.scroll.viewport.scrollV,this.scrollGroup.height,this.scroll.height,this.stage.stageHeight);
// console.log("滚动设置",lastOrder,this.scroll.viewport.scrollV); // console.log("滚动设置",lastOrder,this.scroll.viewport.scrollV);
this.setScrollVShow(); this.setScrollVShow();
// 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);
setTimeout(() => { setTimeout(() => {
...@@ -425,8 +292,117 @@ export default class MapScene extends Scene { ...@@ -425,8 +292,117 @@ export default class MapScene extends Scene {
}, 20 * 1000); }, 20 * 1000);
loadFireworks(); loadFireworks();
} }
islongScreen:boolean = false; //每次展示地图页都会展示
constructor(data?){ awakeShow() {
// console.log("awake==>show");
NetManager.ins.getSignInfo(async () => {
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);
if (nowTimerStr2 != oldTimerStr2) {
console.log("时间上需要弹出广告");
var adpro = new Promise(res => {
NetManager.ins.hc_advert(() => {
const hc_advert = DataManager.ins.getData('hc_advert_1').data || {};
console.log("1广告数据", hc_advert);
let { noticeAdvert } = hc_advert;
if (noticeAdvert == null) {
noticeAdvert = { enable: false }
}
noticeAdvert = DataManager.ins.solveAdvertData(noticeAdvert);
if (noticeAdvert && noticeAdvert.enable) {
panels.push('ad');
localStorage.setItem('nowTimer2Str' + window['CFG'].consumerId, nowTimerStr2);
}
res();
}, 1);
});
await adpro;
console.log("时间弹出广告结束");
}
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().playerlevel <= 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']);
}
islongScreen: boolean = false;
constructor(data?) {
super(); super();
this._data = data; this._data = data;
this.maptoppart = new MapTopPart(); this.maptoppart = new MapTopPart();
...@@ -444,7 +420,7 @@ export default class MapScene extends Scene { ...@@ -444,7 +420,7 @@ export default class MapScene extends Scene {
this.mapbotpart = new MapBottomPart(); this.mapbotpart = new MapBottomPart();
this.mapbotpart.loadSkin(); this.mapbotpart.loadSkin();
this.mapbotpart.start(); this.mapbotpart.start();
this.once(egret.Event.ADDED_TO_STAGE,this.initMapScene,this); this.once(egret.Event.ADDED_TO_STAGE, this.initMapScene, this);
} }
async start(data?) { async start(data?) {
...@@ -468,182 +444,12 @@ export default class MapScene extends Scene { ...@@ -468,182 +444,12 @@ export default class MapScene extends Scene {
} }
stopGamebg(); 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.initSound(); this.initSound();
this._data = data; 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; // let target;
const homeData = getHomeData(); const homeData = getHomeData();
// if (homeData.levels.length == 0) {
// target = 1;
// } else if (homeData.levels.length == window['total_level']) {
// target = window['total_level'] + 1;
// } else {
// target = homeData.levels.length + 1;
// }
// for (const key in MapScene.iconHash) {
// const levelOrder = parseInt(key);
// const element = MapScene.iconHash[key];
// if (!element.hasEventListener(egret.TouchEvent.TOUCH_TAP)) {
// element.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
// if (
// (levelOrder > (getHomeData().levels.length + 1) && levelOrder > 1)
// || (levelOrder > window['last_level'])
// ) {
// // showToast('必须通关前面的关卡才能开启本关');
// console.log('必须通关前面的关卡才能开启本关');
// } else
// PanelCtrl.instance.show('StartPanel', key);
// NetManager.ins.clickLog(getlogItem(19));
// }, this);
// }
// }
// 当前关卡的水花动效
// 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);
// }
this.updateHomeData(); this.updateHomeData();
this.updateFriends(); this.updateFriends();
...@@ -667,91 +473,11 @@ export default class MapScene extends Scene { ...@@ -667,91 +473,11 @@ export default class MapScene extends Scene {
} }
}, this); }, 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);
// this.setScrollVShow();
// 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) {
// }
// 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);
this.scroll.addEventListener(egret.Event.CHANGE, this.onEnterFrame, this); this.scroll.addEventListener(egret.Event.CHANGE, this.onEnterFrame, this);
} }
onAllPanelHide = () => { onAllPanelHide = () => {
if (!localStorage.getItem('activityguide')) { if (!localStorage.getItem('activityguide')) {
// NetManager.ins.hbRainBaseInfo((success, res) => {
// if(!success) {
// if(res.code == "600054" || res.code == "600055") {
// this['guide'].visible = false;
// }
// return;
// }
// const data = res.data;
// if(!data.currentSession && !data.nextSession) {
// this['guide'].visible = false;
// return;
// }
if (this['actsShowBtn'].visible) if (this['actsShowBtn'].visible)
this['guide'].visible = true; this['guide'].visible = true;
...@@ -764,113 +490,108 @@ export default class MapScene extends Scene { ...@@ -764,113 +490,108 @@ export default class MapScene extends Scene {
const offset = 0; const offset = 0;
const y0 = this.scroll.viewport.scrollV + offset; const y0 = this.scroll.viewport.scrollV + offset;
const y1 = this.stage.stageHeight + this.scroll.viewport.scrollV - offset; const y1 = this.stage.stageHeight + this.scroll.viewport.scrollV - offset;
// console.log(y0, y1);
// let count = 0;
// for (const key in MapScene.iconHash) {
// const icon = MapScene.iconHash[key];
// if (icon['visibleY'] >= y0 && icon['visibleY'] <= y1) {
// icon.show();
// } else if (icon.parent) {
// icon.hide();
// }
// if (icon.parent)
// count++;
// }
// if (this._avatarsCache) {
// this._avatarsCache.forEach((item) => {
// if (item.parent) item.parent.addChild(item);
// });
// }
} }
scrollMapy:Array<number> = []; scrollMapy: Array<number> = [];
/** /**
* 调整块显示 * 调整块显示
*/ */
setScrollVShow(){ async setScrollVShow() {
var scrollv = this.scroll.viewport.scrollV; var scrollv = this.scroll.viewport.scrollV;
var stageh = this.stage.stageHeight; var stageh = this.stage.stageHeight;
var y0 = scrollv; var y0 = scrollv;
var y1 = stageh+scrollv; var y1 = stageh + scrollv;
var lidx = 0; var lidx = 0;
var nidx = 0; var nidx = 0;
for(var i1=0;i1<this.scrollMapy.length;i1++){ for (var i1 = 0; i1 < this.scrollMapy.length; i1++) {
var i1sy = this.scrollMapy[i1]; var i1sy = this.scrollMapy[i1];
if(i1sy>y0){ if (i1sy > y0) {
lidx = i1-1; lidx = i1 - 1;
break; break;
} }
} }
for(var i2=0;i2<this.scrollMapy.length;i2++){ for (var i2 = 0; i2 < this.scrollMapy.length; i2++) {
var i2sy = this.scrollMapy[i2]; var i2sy = this.scrollMapy[i2];
if(i2sy>=y1){ if (i2sy >= y1) {
nidx = i2; nidx = i2;
break; break;
} }
} }
if(lidx<0)lidx = 0; if (lidx < 0) lidx = 0;
if(nidx<0)nidx = 0; if (nidx < 0) nidx = 0;
for(var i3=lidx;i3<nidx;i3++){ for (var i3 = lidx; i3 < nidx; i3++) {
var i3mapy = this.scrollMapy[i3]; var i3mapy = this.scrollMapy[i3];
var i3map:any; var i3map: any;
//上下固定,只需要中间的调换位置 //上下固定,只需要中间的调换位置
if(i3==0){ if (i3 == 0) {
i3map = this.maptoppart; i3map = this.maptoppart;
}else if(i3==this.scrollMapy.length-1||i3==this.scrollMapy.length-2){ } else if (i3 == this.scrollMapy.length - 1 || i3 == this.scrollMapy.length - 2) {
i3map = this.mapbotpart; i3map = this.mapbotpart;
}else{ } else {
var joidx = i3%2; var joidx = i3 % 2;
//1对应onemapr,0对应twomapr //1对应onemapr,0对应twomapr
let onemapy:number; let onemapy: number;
let twomapy:number; let twomapy: number;
let cmap:number; let cmap: number;
let onemapidx = this.scrollGroup.getChildIndex(this.onemapreppart); let onemapidx = this.scrollGroup.getChildIndex(this.onemapreppart);
let twomapidx = this.scrollGroup.getChildIndex(this.twomapreppart); let twomapidx = this.scrollGroup.getChildIndex(this.twomapreppart);
let maxidx = Math.max(onemapidx,twomapidx); let maxidx = Math.max(onemapidx, twomapidx);
let minidx = Math.min(onemapidx,twomapidx); let minidx = Math.min(onemapidx, twomapidx);
if(joidx==1){ if (joidx == 1) {
i3map = this.onemapreppart; i3map = this.onemapreppart;
cmap = 1; cmap = 1;
onemapy = this.onemapreppart.y; onemapy = this.onemapreppart.y;
twomapy = this.twomapreppart.y; twomapy = this.twomapreppart.y;
}else{ } else {
i3map = this.twomapreppart; i3map = this.twomapreppart;
cmap = 2; cmap = 2;
onemapy = this.onemapreppart.y; onemapy = this.onemapreppart.y;
twomapy = this.twomapreppart.y; twomapy = this.twomapreppart.y;
} }
if(i3map.y!=i3mapy){ if (i3map.y != i3mapy) {
i3map.y = i3mapy; i3map.y = i3mapy;
if(cmap==1){ if (cmap == 1) {
if(i3mapy>twomapy){ if (i3mapy > twomapy) {
this.scrollGroup.setChildIndex(this.onemapreppart,maxidx); this.scrollGroup.setChildIndex(this.onemapreppart, maxidx);
this.scrollGroup.setChildIndex(this.twomapreppart,minidx); this.scrollGroup.setChildIndex(this.twomapreppart, minidx);
}else{ } else {
this.scrollGroup.setChildIndex(this.onemapreppart,minidx); this.scrollGroup.setChildIndex(this.onemapreppart, minidx);
this.scrollGroup.setChildIndex(this.twomapreppart,maxidx); this.scrollGroup.setChildIndex(this.twomapreppart, maxidx);
} }
}else{ } else {
if(i3mapy>onemapy){ if (i3mapy > onemapy) {
this.scrollGroup.setChildIndex(this.onemapreppart,minidx); this.scrollGroup.setChildIndex(this.onemapreppart, minidx);
this.scrollGroup.setChildIndex(this.twomapreppart,maxidx); this.scrollGroup.setChildIndex(this.twomapreppart, maxidx);
}else{ } else {
this.scrollGroup.setChildIndex(this.onemapreppart,maxidx); this.scrollGroup.setChildIndex(this.onemapreppart, maxidx);
this.scrollGroup.setChildIndex(this.twomapreppart,minidx); this.scrollGroup.setChildIndex(this.twomapreppart, minidx);
} }
} }
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);
//todo
this.changePartLevelShow(i3map,i3startlevel,"mid"); console.error("修改显示233========》", i3startlevel);
let i3endlevel = i3startlevel + MapRpeatPart.LEVEL_NUMS;
let pagesize = 30;
let playerlevel = getHomeData().playerlevel;
let page1 = Math.floor((playerlevel - i3endlevel) / pagesize);
let page2 = Math.floor((playerlevel - i3startlevel) / pagesize);
if (page1 != page2) {
await levelHomeData.getPageLevelData(i3startlevel);
await levelHomeData.getPageLevelData(i3endlevel);
} else {
await levelHomeData.getPageLevelData(i3endlevel);
}
this.changePartLevelShow(i3map, i3startlevel, "mid");
} }
} }
// this.scrollGroup.addChild(i3map); // this.scrollGroup.addChild(i3map);
...@@ -884,97 +605,98 @@ export default class MapScene extends Scene { ...@@ -884,97 +605,98 @@ export default class MapScene extends Scene {
* @param mappart * @param mappart
* @param startlevel * @param startlevel
*/ */
changePartLevelShow(mappart:any,startlevel:number,mappartype:string){ changePartLevelShow(mappart: any, startlevel: number, mappartype: string) {
var mapnums:number; var mapnums: number;
if(mappartype=="top"){ if (mappartype == "top") {
mapnums = MapTopPart.LEVEL_NUMS; mapnums = MapTopPart.LEVEL_NUMS;
}else if(mappartype=="mid"){ } else if (mappartype == "mid") {
mapnums = MapRpeatPart.LEVEL_NUMS; mapnums = MapRpeatPart.LEVEL_NUMS;
}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,this); icon.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.showToastQd, this);
icon.removeEventListener(egret.TouchEvent.TOUCH_TAP,this.clickIcon,this); icon.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.clickIcon, 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) {
// console.log("当前关卡,移除water_light",levelOrder); // console.log("当前关卡,移除water_light",levelOrder);
icon.removeChild(this.pic); icon.removeChild(this.pic);
} }
(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.addEventListener(egret.TouchEvent.TOUCH_TAP,this.showToastQd,this); icon.addEventListener(egret.TouchEvent.TOUCH_TAP, this.showToastQd, this);
(icon['starsp'] as MapStarComp).visible = false; (icon['starsp'] as MapStarComp).visible = false;
this.setGray(icon); this.setGray(icon);
}else if(levelOrder<homeData.levels.length+1){ } else if (levelOrder < homeData.playerlevel + 1) {
if(havewater_light){ if (havewater_light) {
// console.log("当前关卡,移除water_light",levelOrder); // console.log("当前关卡,移除water_light",levelOrder);
icon.removeChild(this.pic); icon.removeChild(this.pic);
} }
this.setGray(icon,2); this.setGray(icon, 2);
var leveldata = homeData.levels[levelOrder-1]; // todo
// console.log("关卡测试:"+levelOrder); // var leveldata = homeData.levels[levelOrder-1];
(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';
(icon['starsp'] as MapStarComp).setStar(leveldata.stars); // (icon['starsp'] as MapStarComp).setStar(leveldata.stars);
(icon['starsp'] as MapStarComp).setStar(levelHomeData.getlevelData(levelOrder - 1));
(icon['starsp'] as MapStarComp).visible = true; (icon['starsp'] as MapStarComp).visible = true;
}else if(levelOrder==homeData.levels.length+1){ } else if (levelOrder == homeData.playerlevel + 1) {
this.setGray(icon,2); this.setGray(icon, 2);
(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 = 'nums_fnt'; (icon['bmptxt'] as eui.BitmapLabel).font = 'nums_fnt';
(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); // console.log(icon,this.pic);
this.pic.x = 50; this.pic.x = 50;
this.pic.y = 37+7; this.pic.y = 37 + 7;
icon.addChildAt(this.pic,1); 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 })
.set({ .set({
scaleX:1, scaleX: 1,
scaleY:1, scaleY: 1,
alpha:1 alpha: 1
}) })
.to({ scaleX: 2, scaleY: 2, alpha: 0 }, 1000).wait(1000); .to({ scaleX: 2, scaleY: 2, alpha: 0 }, 1000).wait(1000);
// console.log("当前关卡,添加water_light",levelOrder,this.pic); // console.log("当前关卡,添加water_light",levelOrder,this.pic);
} }
}else{ } else {
this.setGray(icon,2); this.setGray(icon, 2);
(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['starsp'] as MapStarComp).visible = false; (icon['starsp'] as MapStarComp).visible = false;
if(havewater_light){ if (havewater_light) {
// console.log("当前关卡,移除water_light",levelOrder); // console.log("当前关卡,移除water_light",levelOrder);
icon.removeChild(this.pic); icon.removeChild(this.pic);
} }
} }
var isinrank = false; var isinrank = false;
var avatarrank; var avatarrank;
for(var ir=0;ir<this.maprankdata.length;ir++){ for (var ir = 0; ir < this.maprankdata.length; ir++) {
var irdata = this.maprankdata[ir]; var irdata = this.maprankdata[ir];
if(irdata.levelNum==levelOrder){ if (irdata.levelNum == levelOrder) {
isinrank = true; isinrank = true;
avatarrank = irdata.rank; avatarrank = irdata.rank;
break; break;
} }
} }
var avatarname:string = "avatarank"; var avatarname: string = "avatarank";
var avatar = icon.getChildByName(avatarname); var avatar = icon.getChildByName(avatarname);
if(avatar){ if (avatar) {
avatar.parent.removeChild(avatar); avatar.parent.removeChild(avatar);
} }
if(isinrank){ if (isinrank) {
const avatar = new AvatarComp(); const avatar = new AvatarComp();
avatar.loadSkin(); avatar.loadSkin();
avatar.start(avatarrank); avatar.start(avatarrank);
...@@ -983,70 +705,70 @@ export default class MapScene extends Scene { ...@@ -983,70 +705,70 @@ export default class MapScene extends Scene {
avatar.x = 6; avatar.x = 6;
avatar.y = -avatar.height + 10; avatar.y = -avatar.height + 10;
if (!icon['starsp'].visible) { if (!icon['starsp'].visible) {
avatar.y = - avatar.height; avatar.y = - avatar.height;
} }
} }
if(!icon.hasEventListener(egret.TouchEvent.TOUCH_TAP)){ if (!icon.hasEventListener(egret.TouchEvent.TOUCH_TAP)) {
icon.addEventListener(egret.TouchEvent.TOUCH_TAP,this.clickIcon,this); icon.addEventListener(egret.TouchEvent.TOUCH_TAP, this.clickIcon, this);
} }
} }
} }
setGray(icon:eui.Group,type:number=1){ setGray(icon: eui.Group, type: number = 1) {
var avatarname:string = "avatarank"; var avatarname: string = "avatarank";
let nume = icon.numChildren; let nume = icon.numChildren;
for(let i=0;i<nume;i++){ for (let i = 0; i < nume; i++) {
let ichild = icon.getChildAt(i); let ichild = icon.getChildAt(i);
if(ichild.name!=avatarname){ if (ichild.name != avatarname) {
if(type==1){ if (type == 1) {
setGray(ichild); setGray(ichild);
}else{ } else {
ichild.filters = null; ichild.filters = null;
} }
} }
} }
} }
//用户关卡数据更新,更行map //用户关卡数据更新,更行map
freshMapShow(){ freshMapShow() {
// console.log("刷新显示"); // console.log("刷新显示");
var topltxt = this.maptoppart.getIcon(0)['bmptxt'] as eui.BitmapLabel; var topltxt = this.maptoppart.getIcon(0)['bmptxt'] as eui.BitmapLabel;
var onepltxt = this.onemapreppart.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 twopltxt = this.twomapreppart.getIcon(0)['bmptxt'] as eui.BitmapLabel;
var botltxt = this.mapbotpart.getIcon(0)['bmptxt'] as eui.BitmapLabel; var botltxt = this.mapbotpart.getIcon(0)['bmptxt'] as eui.BitmapLabel;
if(topltxt){ if (topltxt) {
var toplevel = Number(topltxt.text)-1; var toplevel = Number(topltxt.text) - 1;
this.changePartLevelShow(this.maptoppart,toplevel,"top"); this.changePartLevelShow(this.maptoppart, toplevel, "top");
} }
if(onepltxt){ if (onepltxt) {
var oneplevel = Number(onepltxt.text)-1; var oneplevel = Number(onepltxt.text) - 1;
this.changePartLevelShow(this.onemapreppart,oneplevel,"mid"); this.changePartLevelShow(this.onemapreppart, oneplevel, "mid");
} }
if(twopltxt){ if (twopltxt) {
var twoplevel = Number(twopltxt.text)-1; var twoplevel = Number(twopltxt.text) - 1;
this.changePartLevelShow(this.twomapreppart,twoplevel,"mid"); this.changePartLevelShow(this.twomapreppart, twoplevel, "mid");
} }
if(botltxt){ if (botltxt) {
var botlevel = Number(botltxt.text)-1; var botlevel = Number(botltxt.text) - 1;
this.changePartLevelShow(this.mapbotpart,botlevel,"bot"); this.changePartLevelShow(this.mapbotpart, botlevel, "bot");
} }
} }
//点击 //点击
clickIcon(e){ clickIcon(e) {
// console.log(e); // console.log(e);
if(e.target.name!='water_light'){ if (e.target.name != 'water_light') {
let icon = e.target as eui.Group; let icon = e.target as eui.Group;
let txt = icon['bmptxt'] as eui.BitmapLabel; let txt = icon['bmptxt'] as eui.BitmapLabel;
// console.log('关卡点击',txt.text); // console.log('关卡点击',txt.text);
var homeData = getHomeData(); var homeData = getHomeData();
var clicklevel = Number(txt.text); var clicklevel = Number(txt.text);
if(clicklevel<=homeData.levels.length+1){//可进行关卡 if (clicklevel <= homeData.playerlevel + 1) {//可进行关卡
PanelCtrl.instance.show('StartPanel', clicklevel); PanelCtrl.instance.show('StartPanel', clicklevel);
NetManager.ins.clickLog(getlogItem(19)); NetManager.ins.clickLog(getlogItem(19));
}else{ } else {
console.log('必须通关前面的关卡才能开启本关'); console.log('必须通关前面的关卡才能开启本关');
} }
} }
} }
showToastQd(){ showToastQd() {
showToast('敬请期待更多关卡~'); showToast('敬请期待更多关卡~');
} }
...@@ -1120,13 +842,13 @@ export default class MapScene extends Scene { ...@@ -1120,13 +842,13 @@ export default class MapScene extends Scene {
const index = Math.floor(mapAdvert.advertList.length * Math.random()); const index = Math.floor(mapAdvert.advertList.length * Math.random());
result = mapAdvert.advertList[index]; result = mapAdvert.advertList[index];
} }
snpmAdStatic.snpmAdReport("show","icon",result); snpmAdStatic.snpmAdReport("show", "icon", result);
this['adBtn'].source = result.img; this['adBtn'].source = result.img;
this['adBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => { this['adBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
if(result.url.length>2){ if (result.url.length > 2) {
NetManager.ins.clickLog1(getlogItem(32)); NetManager.ins.clickLog1(getlogItem(32));
snpmAdStatic.snpmAdReport("click","icon",result); snpmAdStatic.snpmAdReport("click", "icon", result);
window.location.href = decodeURI(result.url); window.location.href = decodeURI(result.url);
} }
}, this); }, this);
...@@ -1139,10 +861,10 @@ export default class MapScene extends Scene { ...@@ -1139,10 +861,10 @@ export default class MapScene extends Scene {
// this.removeIcon(); // this.removeIcon();
// this.actIcon.destory(); // this.actIcon.destory();
if (this.pic) { if (this.pic) {
egret.Tween.removeTweens(this.pic); egret.Tween.removeTweens(this.pic);
if(this.pic.parent){ if (this.pic.parent) {
this.pic.parent.removeChild(this.pic); this.pic.parent.removeChild(this.pic);
} }
} }
...@@ -1167,7 +889,7 @@ export default class MapScene extends Scene { ...@@ -1167,7 +889,7 @@ export default class MapScene extends Scene {
} }
// 如果是尾部 // 如果是尾部
if (lastOrder >= (window['total_level'] - MapBottomPart.LEVEL_NUMS-1)) { if (lastOrder >= (window['total_level'] - MapBottomPart.LEVEL_NUMS - 1)) {
return this.getScrollV2(lastOrder, stageHeight); return this.getScrollV2(lastOrder, stageHeight);
} }
...@@ -1201,14 +923,14 @@ export default class MapScene extends Scene { ...@@ -1201,14 +923,14 @@ export default class MapScene extends Scene {
var maptop_level = MapTopPart.LEVEL_NUMS; var maptop_level = MapTopPart.LEVEL_NUMS;
var maprep_level = MapRpeatPart.LEVEL_NUMS; var maprep_level = MapRpeatPart.LEVEL_NUMS;
var mapbot_level = MapBottomPart.LEVEL_NUMS; var mapbot_level = MapBottomPart.LEVEL_NUMS;
var repeatnum = Math.abs((total_level-maptop_level-mapbot_level)/maprep_level) var repeatnum = Math.abs((total_level - maptop_level - mapbot_level) / maprep_level)
const y0 = this.mapbotpart.y; const y0 = this.mapbotpart.y;
// console.log("底部scroll",y0) // console.log("底部scroll",y0)
lastOrder = lastOrder - repeatnum * MapRpeatPart.LEVEL_NUMS - 7; lastOrder = lastOrder - repeatnum * MapRpeatPart.LEVEL_NUMS - 7;
if(lastOrder<1){ if (lastOrder < 1) {
lastOrder = 1; lastOrder = 1;
}else if(lastOrder>3){ } else if (lastOrder > 3) {
lastOrder = 3; lastOrder = 3;
} }
// console.log("底部scroll",lastOrder); // console.log("底部scroll",lastOrder);
...@@ -1219,7 +941,7 @@ export default class MapScene extends Scene { ...@@ -1219,7 +941,7 @@ export default class MapScene extends Scene {
const totalHeight = maptop_height + const totalHeight = maptop_height +
(repeatnum * maprep_height) (repeatnum * maprep_height)
+ mapbot_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;
...@@ -1294,34 +1016,34 @@ export default class MapScene extends Scene { ...@@ -1294,34 +1016,34 @@ export default class MapScene extends Scene {
// private _avatarsCache = []; // private _avatarsCache = [];
//清楚地图页面的头像 //清楚地图页面的头像
clearAvatar(mappartype:string,mappart:any){ clearAvatar(mappartype: string, mappart: any) {
var mapnums:number; var mapnums: number;
if(mappartype=="top"){ if (mappartype == "top") {
mapnums = MapTopPart.LEVEL_NUMS; mapnums = MapTopPart.LEVEL_NUMS;
}else if(mappartype=="mid"){ } else if (mappartype == "mid") {
mapnums = MapRpeatPart.LEVEL_NUMS; mapnums = MapRpeatPart.LEVEL_NUMS;
}else if(mappartype=="bot"){ } else if (mappartype == "bot") {
mapnums = MapBottomPart.LEVEL_NUMS; mapnums = MapBottomPart.LEVEL_NUMS;
} }
for(var i=0;i<mapnums;i++){ for (var i = 0; i < mapnums; i++) {
let icon = mappart.getIcon(i); let icon = mappart.getIcon(i);
var avatarname:string = "avatarank"; var avatarname: string = "avatarank";
var avatar = icon.getChildByName(avatarname); var avatar = icon.getChildByName(avatarname);
if(avatar){ if (avatar) {
avatar.parent.removeChild(avatar); avatar.parent.removeChild(avatar);
} }
} }
} }
//添加地图页头像 //添加地图页头像
addAvatar(level, ele?) { addAvatar(level, ele?) {
const item = this.getInShowIconByLevel(level); const item = this.getInShowIconByLevel(level);
// console.log('地图页头像',level,item); // console.log('地图页头像',level,item);
if(item){ if (item) {
const parent = item; const parent = item;
var avatarname:string = "avatarank"; var avatarname: string = "avatarank";
var oldavatar = parent.getChildByName('avatarname'); var oldavatar = parent.getChildByName('avatarname');
if(oldavatar){ if (oldavatar) {
oldavatar.parent.removeChild(oldavatar); oldavatar.parent.removeChild(oldavatar);
} }
const avatar = new AvatarComp(); const avatar = new AvatarComp();
...@@ -1341,26 +1063,26 @@ export default class MapScene extends Scene { ...@@ -1341,26 +1063,26 @@ export default class MapScene extends Scene {
// 更新地图上的排行榜 // 更新地图上的排行榜
updateFriends() { updateFriends() {
this.maprankdata = new Array(); this.maprankdata = new Array();
this.clearAvatar("top",this.maptoppart); this.clearAvatar("top", this.maptoppart);
this.clearAvatar("mid",this.onemapreppart); this.clearAvatar("mid", this.onemapreppart);
this.clearAvatar("mid",this.twomapreppart); this.clearAvatar("mid", this.twomapreppart);
this.clearAvatar("bot",this.mapbotpart); this.clearAvatar("bot", this.mapbotpart);
NetManager.ins.hc_mapRank(() => { NetManager.ins.hc_mapRank(() => {
const hc_mapRank = DataManager.ins.getData('hc_mapRank').data; const hc_mapRank = DataManager.ins.getData('hc_mapRank').data;
if (!hc_mapRank) return; if (!hc_mapRank) return;
const { data } = DataManager.ins.getData('hc_userInfo'); const { data } = DataManager.ins.getData('hc_userInfo');
hc_mapRank.forEach((ele) => { hc_mapRank.forEach((ele) => {
if (ele.levelNum == getHomeData().levels.length + 1) { if (ele.levelNum == getHomeData().playerlevel + 1) {
if (data == null) if (data == null)
ele.rank[0].avatar = "http://yun.duiba.com.cn/db_games/default_avatar.png"; ele.rank[0].avatar = "http://yun.duiba.com.cn/db_games/default_avatar.png";
else else
ele.rank[0].avatar = data.avatar || "http://yun.duiba.com.cn/db_games/default_avatar.png"; ele.rank[0].avatar = data.avatar || "http://yun.duiba.com.cn/db_games/default_avatar.png";
} }
this.maprankdata.push({ this.maprankdata.push({
levelNum:ele.levelNum, levelNum: ele.levelNum,
rank:ele.rank[0] rank: ele.rank[0]
}) })
this.addAvatar(ele.levelNum, ele.rank[0]); this.addAvatar(ele.levelNum, ele.rank[0]);
}); });
...@@ -1670,7 +1392,7 @@ export default class MapScene extends Scene { ...@@ -1670,7 +1392,7 @@ export default class MapScene extends Scene {
GDispatcher.addEvent('getInviteInfo', this.getInviteInfo, this); GDispatcher.addEvent('getInviteInfo', this.getInviteInfo, this);
} }
protected removeEvents(){ protected removeEvents() {
// console.log("map-----------removeEvents"); // console.log("map-----------removeEvents");
this['goldBtn'].removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_goldBtn, this); this['goldBtn'].removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_goldBtn, this);
this['guide'].removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_guide, this); this['guide'].removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_guide, this);
...@@ -1695,7 +1417,7 @@ export default class MapScene extends Scene { ...@@ -1695,7 +1417,7 @@ export default class MapScene extends Scene {
GDispatcher.removeEvent('getInviteInfo', this.getInviteInfo, this); GDispatcher.removeEvent('getInviteInfo', this.getInviteInfo, this);
} }
recordClick(){ recordClick() {
PanelCtrl.instance.show('bag'); PanelCtrl.instance.show('bag');
NetManager.ins.clickLog(getlogItem(5)); NetManager.ins.clickLog(getlogItem(5));
} }
...@@ -1746,7 +1468,7 @@ export default class MapScene extends Scene { ...@@ -1746,7 +1468,7 @@ export default class MapScene extends Scene {
async playAni() { async playAni() {
if (this._mc) { if (this._mc) {
await play2(this._mc,121,240-30); await play2(this._mc, 121, 240 - 30);
} }
this['boxLayer'].visible = false; this['boxLayer'].visible = false;
} }
...@@ -1826,19 +1548,19 @@ export default class MapScene extends Scene { ...@@ -1826,19 +1548,19 @@ export default class MapScene extends Scene {
const pics = []; const pics = [];
var total_level = window['total_level']; var total_level = window['total_level'];
for(var i0=0;i0<total_level;i0++){ for (var i0 = 0; i0 < total_level; i0++) {
var i0level = i0+1; var i0level = i0 + 1;
var icon = this.getInShowIconByLevel(i0level); var icon = this.getInShowIconByLevel(i0level);
if(icon&&icon.parent){ if (icon && icon.parent) {
//另加判断当前是否有显示 //另加判断当前是否有显示
var scrollv = this.scroll.viewport.scrollV; var scrollv = this.scroll.viewport.scrollV;
var stageheight = this.stage.stageHeight; var stageheight = this.stage.stageHeight;
var showy0 = scrollv; var showy0 = scrollv;
var showy1 = scrollv+stageheight; var showy1 = scrollv + stageheight;
var icony = icon.y+icon.parent.y; var icony = icon.y + icon.parent.y;
var offsety = 100; var offsety = 100;
//在显示范围内 //在显示范围内
if(icony+offsety>showy0&&icony-offsety<showy1){ if (icony + offsety > showy0 && icony - offsety < showy1) {
keys.push(icon.parent); keys.push(icon.parent);
const p = (icon.localToGlobal(0, 0)); const p = (icon.localToGlobal(0, 0));
const pic = createRedBagIcon(this); const pic = createRedBagIcon(this);
...@@ -1897,34 +1619,34 @@ export default class MapScene extends Scene { ...@@ -1897,34 +1619,34 @@ export default class MapScene extends Scene {
} }
//获取指定显示的icon //获取指定显示的icon
getInShowIconByLevel(level:number){ getInShowIconByLevel(level: number) {
var icon:any; var icon: any;
icon = this.getPartIconByLevel(this.maptoppart,level,'top'); icon = this.getPartIconByLevel(this.maptoppart, level, 'top');
if(!icon){ if (!icon) {
icon = this.getPartIconByLevel(this.onemapreppart,level,'mid'); icon = this.getPartIconByLevel(this.onemapreppart, level, 'mid');
} }
if(!icon){ if (!icon) {
icon = this.getPartIconByLevel(this.twomapreppart,level,'mid'); icon = this.getPartIconByLevel(this.twomapreppart, level, 'mid');
} }
if(!icon){ if (!icon) {
icon = this.getPartIconByLevel(this.mapbotpart,level,'bot'); icon = this.getPartIconByLevel(this.mapbotpart, level, 'bot');
} }
return icon; return icon;
} }
getPartIconByLevel(mapart:any,level:number,mappartype:string){ getPartIconByLevel(mapart: any, level: number, mappartype: string) {
var mapnums:number; var mapnums: number;
if(mappartype=="top"){ if (mappartype == "top") {
mapnums = MapTopPart.LEVEL_NUMS; mapnums = MapTopPart.LEVEL_NUMS;
}else if(mappartype=="mid"){ } else if (mappartype == "mid") {
mapnums = MapRpeatPart.LEVEL_NUMS; mapnums = MapRpeatPart.LEVEL_NUMS;
}else if(mappartype=="bot"){ } else if (mappartype == "bot") {
mapnums = MapBottomPart.LEVEL_NUMS; mapnums = MapBottomPart.LEVEL_NUMS;
} }
for(var i=0;i<mapnums;i++){ for (var i = 0; i < mapnums; i++) {
var icon = mapart.getIcon(i); var icon = mapart.getIcon(i);
var iconlevel = Number(icon['bmptxt'].text); var iconlevel = Number(icon['bmptxt'].text);
if(iconlevel==level){ if (iconlevel == level) {
return icon; return icon;
} }
} }
......
...@@ -64,12 +64,12 @@ export default class HbNoPrize extends Panel { ...@@ -64,12 +64,12 @@ export default class HbNoPrize extends Panel {
onTouchOK() { onTouchOK() {
NetManager.ins.clickLog(getlogItem(60)); NetManager.ins.clickLog(getlogItem(60));
if((getHomeData().levels.length + 1) > window['last_level']) { if((getHomeData().playerlevel + 1) > window['last_level']) {
changeMapScene(); changeMapScene();
super.hidePanel(); super.hidePanel();
return; return;
} }
PanelCtrl.instance.show("StartPanel", getHomeData().levels.length + 1); PanelCtrl.instance.show("StartPanel", getHomeData().playerlevel + 1);
} }
protected get closeBtns(): eui.Button[] { protected get closeBtns(): eui.Button[] {
......
...@@ -50,12 +50,12 @@ export default class HbNoPrize extends Panel { ...@@ -50,12 +50,12 @@ export default class HbNoPrize extends Panel {
onTouchOK() { onTouchOK() {
NetManager.ins.clickLog(getlogItem(60)); NetManager.ins.clickLog(getlogItem(60));
if((getHomeData().levels.length + 1) > window['last_level']) { if((getHomeData().playerlevel + 1) > window['last_level']) {
changeMapScene(); changeMapScene();
super.hidePanel(); super.hidePanel();
return; return;
} }
PanelCtrl.instance.show("StartPanel", getHomeData().levels.length + 1); PanelCtrl.instance.show("StartPanel", getHomeData().playerlevel + 1);
} }
protected get closeBtns(): eui.Button[] { protected get closeBtns(): eui.Button[] {
......
...@@ -94,12 +94,12 @@ export default class HbPrize extends Panel { ...@@ -94,12 +94,12 @@ export default class HbPrize extends Panel {
onTouchOK() { onTouchOK() {
NetManager.ins.clickLog(getlogItem(59)); NetManager.ins.clickLog(getlogItem(59));
if ((getHomeData().levels.length + 1) > window['last_level']) { if ((getHomeData().playerlevel + 1) > window['last_level']) {
changeMapScene(); changeMapScene();
super.hidePanel(); super.hidePanel();
return; return;
} }
PanelCtrl.instance.show("StartPanel", getHomeData().levels.length + 1); PanelCtrl.instance.show("StartPanel", getHomeData().playerlevel + 1);
} }
protected get closeBtns(): eui.Button[] { protected get closeBtns(): eui.Button[] {
......
...@@ -49,13 +49,13 @@ export default class InviteCutTimePanel extends Panel { ...@@ -49,13 +49,13 @@ export default class InviteCutTimePanel extends Panel {
} }
onTouchOK() { onTouchOK() {
if((getHomeData().levels.length + 1) > window['last_level']) { if((getHomeData().playerlevel + 1) > window['last_level']) {
changeMapScene(); changeMapScene();
super.hidePanel(); super.hidePanel();
return; return;
} }
GDispatcher.dispatchEvent("getInviteInfo"); GDispatcher.dispatchEvent("getInviteInfo");
PanelCtrl.instance.show("StartPanel", getHomeData().levels.length + 1); PanelCtrl.instance.show("StartPanel", getHomeData().playerlevel + 1);
} }
initUI() { initUI() {
......
...@@ -50,13 +50,13 @@ export default class InvitePrizePanel extends Panel { ...@@ -50,13 +50,13 @@ export default class InvitePrizePanel extends Panel {
} }
onTouchOK() { onTouchOK() {
if((getHomeData().levels.length + 1) > window['last_level']) { if((getHomeData().playerlevel + 1) > window['last_level']) {
changeMapScene(); changeMapScene();
super.hidePanel(); super.hidePanel();
return; return;
} }
GDispatcher.dispatchEvent("getInviteInfo"); GDispatcher.dispatchEvent("getInviteInfo");
PanelCtrl.instance.show("StartPanel", getHomeData().levels.length + 1); PanelCtrl.instance.show("StartPanel", getHomeData().playerlevel + 1);
} }
onTapGoPrize() { onTapGoPrize() {
......
...@@ -56,12 +56,12 @@ export default class ScratchPrizePanel extends Panel { ...@@ -56,12 +56,12 @@ export default class ScratchPrizePanel extends Panel {
window.location.href = window['__link__']; window.location.href = window['__link__'];
break; break;
case (e.target == this.game_btn): // 继续闯关 case (e.target == this.game_btn): // 继续闯关
if((getHomeData().levels.length + 1) > window['last_level']) { if((getHomeData().playerlevel + 1) > window['last_level']) {
changeMapScene(); changeMapScene();
super.hidePanel(); super.hidePanel();
return; return;
} }
PanelCtrl.instance.show("StartPanel", getHomeData().levels.length + 1); PanelCtrl.instance.show("StartPanel", getHomeData().playerlevel + 1);
break; break;
default: default:
......
...@@ -44,7 +44,7 @@ export default class StartPanel extends Panel { ...@@ -44,7 +44,7 @@ export default class StartPanel extends Panel {
}, DataManager.ins.getData("getUserShareCode").data) }, DataManager.ins.getData("getUserShareCode").data)
} }
if(data > homedata.levels.length) { if(data > homedata.playerlevel) {
addAdComp(68, 890+10, this, 29); addAdComp(68, 890+10, this, 29);
NetManager.ins.showLog(getlogItem(29)); NetManager.ins.showLog(getlogItem(29));
} else } else
......
...@@ -32,12 +32,12 @@ export default class TaskCenterNoPrize extends Panel { ...@@ -32,12 +32,12 @@ export default class TaskCenterNoPrize extends Panel {
this.btn.addEventListener(egret.TouchEvent.TOUCH_TAP, () => { this.btn.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
if(taskData.status == 1) { if(taskData.status == 1) {
// 去闯关 // 去闯关
if((getHomeData().levels.length + 1) > window['last_level']) { if((getHomeData().playerlevel + 1) > window['last_level']) {
changeMapScene(); changeMapScene();
super.hidePanel(); super.hidePanel();
return; return;
} }
PanelCtrl.instance.show("StartPanel", getHomeData().levels.length + 1); PanelCtrl.instance.show("StartPanel", getHomeData().playerlevel + 1);
} else { } else {
window.open(taskData.appIncompletelink); window.open(taskData.appIncompletelink);
super.hidePanel(); super.hidePanel();
......
...@@ -35,12 +35,12 @@ export default class TaskCenterPrize extends Panel { ...@@ -35,12 +35,12 @@ export default class TaskCenterPrize extends Panel {
if(taskData.status == 1) { if(taskData.status == 1) {
NetManager.ins.clickLog(getlogItem(66)); NetManager.ins.clickLog(getlogItem(66));
// 去闯关 // 去闯关
if((getHomeData().levels.length + 1) > window['last_level']) { if((getHomeData().playerlevel + 1) > window['last_level']) {
changeMapScene(); changeMapScene();
super.hidePanel(); super.hidePanel();
return; return;
} }
PanelCtrl.instance.show("StartPanel", getHomeData().levels.length + 1); PanelCtrl.instance.show("StartPanel", getHomeData().playerlevel + 1);
} else { } else {
window.location.href = taskData.appIncompletelink; window.location.href = taskData.appIncompletelink;
super.hidePanel(); super.hidePanel();
......
...@@ -7,7 +7,7 @@ import PanelCtrl from "../../libs/new_wx/ctrls/panelCtrl"; ...@@ -7,7 +7,7 @@ import PanelCtrl from "../../libs/new_wx/ctrls/panelCtrl";
export const gotoNextLevel = (currentLevel?) => { export const gotoNextLevel = (currentLevel?) => {
    if (!currentLevel) {     if (!currentLevel) {
        currentLevel = getHomeData().levels.length;         currentLevel = getHomeData().playerlevel;
    }     }
    const onMapScene = SceneCtrl.instance.currentScene instanceof MapScene;     const onMapScene = SceneCtrl.instance.currentScene instanceof MapScene;
......
...@@ -31,8 +31,8 @@ class Share2 extends ComponentBase { ...@@ -31,8 +31,8 @@ class Share2 extends ComponentBase {
const data = getHomeData(); const data = getHomeData();
this['tipsTxt0'].text = `超过了${Math.ceil(Math.random() * 100)}%的好友`; this['tipsTxt0'].text = `超过了${Math.ceil(Math.random() * 100)}%的好友`;
this['lvTxt'].text = data.levels.length == 0 ? 1 : data.levels.length; this['lvTxt'].text = data.playerlevel == 0 ? 1 : data.playerlevel;
this['lvTxt0'].text = data.levels.length; this['lvTxt0'].text = data.playerlevel;
this['btn1'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => { this['btn1'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
if(iswx()) { //微信端 if(iswx()) { //微信端
......
...@@ -30,7 +30,7 @@ class Share3 extends ComponentBase { ...@@ -30,7 +30,7 @@ class Share3 extends ComponentBase {
const data = getHomeData(); const data = getHomeData();
this['lvTxt'].text = data.levels.length == 0 ? 1 : data.levels.length; this['lvTxt'].text = data.playerlevel == 0 ? 1 : data.playerlevel;
this['btn1'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => { this['btn1'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
if (iswx()) { //微信端 if (iswx()) { //微信端
......
...@@ -166,7 +166,9 @@ export const changeMapScene = (p?) => { ...@@ -166,7 +166,9 @@ export const changeMapScene = (p?) => {
const data = createData(); const data = createData();
if (p) if (p)
data.level = p.level; data.level = p.level;
SceneCtrl.instance.change(ModuleTypes.MAP_SCENE, data); SceneCtrl.instance.change(ModuleTypes.MAP_SCENE, data,function(){
SceneCtrl.instance.mapscene.awakeShow();
});
} }
let _startSceneData; let _startSceneData;
......
...@@ -27,7 +27,7 @@ const config = { ...@@ -27,7 +27,7 @@ const config = {
'/customActivity/happyclear/bigWheel/dojoin': { '/customActivity/happyclear/bigWheel/dojoin': {
data: './happyclear/turnabledojoin.json' data: './happyclear/turnabledojoin.json'
}, },
'/customActivity/happyclear/totalNumRank': { '/customActivity/happyclear/totalNumRankNew': {
data: './happyclear/totalNumRank.json' data: './happyclear/totalNumRank.json'
}, },
'/customActivity/happyclear/userInfo': { '/customActivity/happyclear/userInfo': {
...@@ -36,7 +36,7 @@ const config = { ...@@ -36,7 +36,7 @@ const config = {
'/customActivity/happyclear/levelNumRank': { '/customActivity/happyclear/levelNumRank': {
data: './happyclear/levelNumRank.json' data: './happyclear/levelNumRank.json'
}, },
'/customActivity/happyclear/mapRank': { '/customActivity/happyclear/mapRankNew': {
data: './happyclear/mapRank.json' data: './happyclear/mapRank.json'
}, },
'/customActivity/happyclear/advert': { '/customActivity/happyclear/advert': {
...@@ -54,10 +54,10 @@ const config = { ...@@ -54,10 +54,10 @@ const config = {
'/wechatShare/getShareInfo/v2': { '/wechatShare/getShareInfo/v2': {
data: './happyclear/openTreasureBox.json' data: './happyclear/openTreasureBox.json'
}, },
'/customActivity/happyclear/openTreasureBox': { '/customActivity/happyclear/openTreasureBoxNew': {
data: './happyclear/openTreasureBox.json' data: './happyclear/openTreasureBox.json'
}, },
'/customActivity/happyclear/home': { '/customActivity/happyclear/homeNew': {
data: './happyclear/home.json' data: './happyclear/home.json'
}, },
'/customActivity/happyclear/getLevelInfo': { '/customActivity/happyclear/getLevelInfo': {
...@@ -75,10 +75,10 @@ const config = { ...@@ -75,10 +75,10 @@ const config = {
'/customActivity/happyclear/useProp': { '/customActivity/happyclear/useProp': {
data: './happyclear/useProp.json' data: './happyclear/useProp.json'
}, },
'/hdtool/happyclear/submit': { '/hdtool/happyclear/submitNew': {
data: './happyclear/submit.json' data: './happyclear/submit.json'
}, },
'/hdtool/happyclear/doJoin': { '/hdtool/happyclear/doJoinNew': {
data: './happyclear/doJoin.json' data: './happyclear/doJoin.json'
}, },
'/aaw/music/category': { '/aaw/music/category': {
...@@ -210,6 +210,9 @@ const config = { ...@@ -210,6 +210,9 @@ const config = {
'/customActivity/happyclear/getConfigInfo':{ '/customActivity/happyclear/getConfigInfo':{
data:'./happyclear/getConfigInfo.json' data:'./happyclear/getConfigInfo.json'
}, },
'/customActivity/happyclear/findConsumerRecords': {
data: './happyclear/homelevel.json'
},
}; };
for (let item in config) { for (let item in config) {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"success": true,
"code": "0000000000",
"desc": "OK",
"timestamp": 1603675924466,
"data": [
{
"levelNum": 1,
"maxScore": 35170,
"stars": 3
},
{
"levelNum": 2,
"maxScore": 14500,
"stars": 3
},
{
"levelNum": 3,
"maxScore": 18260,
"stars": 3
},
{
"levelNum": 4,
"maxScore": 11230,
"stars": 3
},
{
"levelNum": 5,
"maxScore": 8000,
"stars": 3
},
{
"levelNum": 6,
"maxScore": 64660,
"stars": 3
},
{
"levelNum": 7,
"maxScore": 27070,
"stars": 3
},
{
"levelNum": 8,
"maxScore": 17930,
"stars": 1
},
{
"levelNum": 9,
"maxScore": 63880,
"stars": 3
},
{
"levelNum": 10,
"maxScore": 11320,
"stars": 1
},
{
"levelNum": 11,
"maxScore": 10760,
"stars": 3
},
{
"levelNum": 12,
"maxScore": 36280,
"stars": 3
},
{
"levelNum": 13,
"maxScore": 75450,
"stars": 3
},
{
"levelNum": 14,
"maxScore": 11270,
"stars": 2
},
{
"levelNum": 15,
"maxScore": 32810,
"stars": 3
},
{
"levelNum": 16,
"maxScore": 22060,
"stars": 3
},
{
"levelNum": 17,
"maxScore": 53670,
"stars": 3
},
{
"levelNum": 18,
"maxScore": 78630,
"stars": 3
},
{
"levelNum": 19,
"maxScore": 96690,
"stars": 3
},
{
"levelNum": 20,
"maxScore": 45790,
"stars": 3
},
{
"levelNum": 21,
"maxScore": 49630,
"stars": 3
},
{
"levelNum": 22,
"maxScore": 54060,
"stars": 3
},
{
"levelNum": 23,
"maxScore": 14170,
"stars": 3
},
{
"levelNum": 24,
"maxScore": 14300,
"stars": 3
}
]
}
\ 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