Commit 56df4c40 authored by 邱旭's avatar 邱旭

Merge branch '1101' into dev

parents 4cfae1e0 db2d92bf
...@@ -10,7 +10,7 @@ import { getRepeatCount } from "../startScene/StartScene"; ...@@ -10,7 +10,7 @@ import { getRepeatCount } from "../startScene/StartScene";
export default class MapBottomPart extends ComponentBase { export default class MapBottomPart extends ComponentBase {
static LEVEL_NUMS = 11; static LEVEL_NUMS = 11;
getTxt(i): eui.BitmapLabel { return this[`txt${i}`]; } getTxt(i): eui.BitmapLabel { return this[`txt${i}`]; }
start() { start({repeatHeight,topHeight}) {
super.start(); super.start();
const repeatCount =getRepeatCount(); const repeatCount =getRepeatCount();
for (let i = 0; i < MapBottomPart.LEVEL_NUMS; i++) { for (let i = 0; i < MapBottomPart.LEVEL_NUMS; i++) {
...@@ -31,6 +31,7 @@ export default class MapBottomPart extends ComponentBase { ...@@ -31,6 +31,7 @@ export default class MapBottomPart extends ComponentBase {
const icon = MapScene.iconHash[levelOrder] = this.getIcon(i); const icon = MapScene.iconHash[levelOrder] = this.getIcon(i);
this.removeChild(icon); this.removeChild(icon);
icon.show = ()=>{this.addChild(icon)}; icon.show = ()=>{this.addChild(icon)};
icon.hide = ()=>{this.removeChild(icon)};
icon['nums'] = icon.getChildAt(0); icon['nums'] = icon.getChildAt(0);
icon['bmptxt']=icon.getChildAt(1); icon['bmptxt']=icon.getChildAt(1);
icon['mappart']=this; icon['mappart']=this;
...@@ -39,6 +40,7 @@ export default class MapBottomPart extends ComponentBase { ...@@ -39,6 +40,7 @@ export default class MapBottomPart extends ComponentBase {
star.loadSkin(); star.start(); star.loadSkin(); star.start();
MapScene.starHash[levelOrder] = star; MapScene.starHash[levelOrder] = star;
icon.addChild(star); icon.addChild(star);
icon['visibleY'] = icon.y + topHeight + repeatHeight * repeatCount;
} }
} }
......
...@@ -12,7 +12,6 @@ export default class MapRpeatPart extends ComponentBase { ...@@ -12,7 +12,6 @@ export default class MapRpeatPart extends ComponentBase {
super(); super();
this._index = i; this._index = i;
this._topHeight=topHeight; this._topHeight=topHeight;
// createData()
} }
start() { start() {
...@@ -21,9 +20,11 @@ export default class MapRpeatPart extends ComponentBase { ...@@ -21,9 +20,11 @@ export default class MapRpeatPart extends ComponentBase {
const levelOrder = MapTopPart.LEVEL_NUMS + this._index * MapRpeatPart.LEVEL_NUMS + i + 1; const levelOrder = MapTopPart.LEVEL_NUMS + this._index * MapRpeatPart.LEVEL_NUMS + i + 1;
this.getTxt(i).text = levelOrder + ''; this.getTxt(i).text = levelOrder + '';
const icon = MapScene.iconHash[levelOrder] = this.getIcon(i); const icon = MapScene.iconHash[levelOrder] = this.getIcon(i);
this.removeChild(icon); this.removeChild(icon);
icon.show = ()=>{this.addChild(icon)}; icon.show = ()=>{this.addChild(icon)};
icon.hide = ()=>{this.removeChild(icon)};
icon['nums'] = icon.getChildAt(0); icon['nums'] = icon.getChildAt(0);
icon['bmptxt']=icon.getChildAt(1); icon['bmptxt']=icon.getChildAt(1);
icon['mappart']=this; icon['mappart']=this;
...@@ -32,7 +33,8 @@ export default class MapRpeatPart extends ComponentBase { ...@@ -32,7 +33,8 @@ export default class MapRpeatPart extends ComponentBase {
star.loadSkin(); star.start(); star.loadSkin(); star.start();
MapScene.starHash[levelOrder] = star; MapScene.starHash[levelOrder] = star;
icon.addChild(star); icon.addChild(star);
icon['visibleY'] = this._topHeight + this icon['visibleY'] = this._topHeight + this.height * this._index + icon.y;
console.log(icon['visibleY'] );
} }
this['animal1'].visible = this._index % 2; this['animal1'].visible = this._index % 2;
......
...@@ -43,22 +43,22 @@ export default class MapScene extends Scene { ...@@ -43,22 +43,22 @@ export default class MapScene extends Scene {
sendInvite() { sendInvite() {
const code = Utils.getRequestByKey('shareCode'); const code = Utils.getRequestByKey('shareCode');
if(!code) return; if (!code) return;
if(doHelpFlag) { if (doHelpFlag) {
return; return;
} }
if(code.indexOf("12345678") == -1){ // 邀请有礼 if (code.indexOf("12345678") == -1) { // 邀请有礼
const dojoin = DataManager.ins.getData('hc_doJoin'); const dojoin = DataManager.ins.getData('hc_doJoin');
if(!dojoin) return; if (!dojoin) return;
NetManager.ins.doHelp((success, res) => { NetManager.ins.doHelp((success, res) => {
doHelpFlag = true; doHelpFlag = true;
switch(true) { switch (true) {
case (res.code == "400017"): showToast("您不是新用户呢~"); break; case (res.code == "400017"): showToast("您不是新用户呢~"); break;
case (res.code == "0000022"): showToast("不可以给自己助力哦~"); break; case (res.code == "0000022"): showToast("不可以给自己助力哦~"); break;
case (res.code == "0200202"):showToast("已经给好友助力过了哦~"); break; case (res.code == "0200202"): showToast("已经给好友助力过了哦~"); break;
default: break; default: break;
} }
if(!success) { return; } if (!success) { return; }
showToast("助力成功"); showToast("助力成功");
NetManager.ins.showLog(getlogItem(36)); NetManager.ins.showLog(getlogItem(36));
}, code, dojoin.data); }, code, dojoin.data);
...@@ -66,13 +66,13 @@ export default class MapScene extends Scene { ...@@ -66,13 +66,13 @@ export default class MapScene extends Scene {
const _code = code.slice(8); const _code = code.slice(8);
NetManager.ins.scratchDoHelp((success, res) => { NetManager.ins.scratchDoHelp((success, res) => {
doHelpFlag = true; doHelpFlag = true;
switch(true) { switch (true) {
case (res.code == "0000024"): showToast("今日刮卡次数已达到上线限哦~"); break; case (res.code == "0000024"): showToast("今日刮卡次数已达到上线限哦~"); break;
case (res.code == "0000022"): showToast("不可以给自己刮哦~"); break; case (res.code == "0000022"): showToast("不可以给自己刮哦~"); break;
case (res.code == "0000023"):showToast("已经给好友刮过了哦~"); break; case (res.code == "0000023"): showToast("已经给好友刮过了哦~"); break;
default: break; default: break;
} }
if(!success) { return; } if (!success) { return; }
showToast("帮刮成功!"); showToast("帮刮成功!");
NetManager.ins.showLog(getlogItem(52)); NetManager.ins.showLog(getlogItem(52));
NetManager.ins.showLog(getlogItem(36)); NetManager.ins.showLog(getlogItem(36));
...@@ -98,7 +98,7 @@ export default class MapScene extends Scene { ...@@ -98,7 +98,7 @@ export default class MapScene extends Scene {
GDispatcher.dispatchEvent("getInviteInfo"); // 查询邀请信息,控制邀请有礼角标 GDispatcher.dispatchEvent("getInviteInfo"); // 查询邀请信息,控制邀请有礼角标
this['avatar'].mask = this['avatarMask']; this['avatar'].mask = this['avatarMask'];
if(getBgOn() && MapScene['firstPlayBgTag'] == true) { if (getBgOn() && MapScene['firstPlayBgTag'] == true) {
playBg(); playBg();
} }
...@@ -115,12 +115,12 @@ export default class MapScene extends Scene { ...@@ -115,12 +115,12 @@ export default class MapScene extends Scene {
const oldTimerStr2 = localStorage.getItem('nowTimer2Str' + window['CFG'].consumerId); const oldTimerStr2 = localStorage.getItem('nowTimer2Str' + window['CFG'].consumerId);
const hc_advert = DataManager.ins.getData('hc_advert').data; const hc_advert = DataManager.ins.getData('hc_advert').data;
let {noticeAdvert} = hc_advert; let { noticeAdvert } = hc_advert;
if(noticeAdvert == null) { if (noticeAdvert == null) {
noticeAdvert = {enable: false} noticeAdvert = { enable: false }
} }
if(noticeAdvert && noticeAdvert.enable && nowTimerStr2 != oldTimerStr2) { if (noticeAdvert && noticeAdvert.enable && nowTimerStr2 != oldTimerStr2) {
// if (!adTag) { // if (!adTag) {
panels.push('ad'); panels.push('ad');
// adTag = true; // adTag = true;
...@@ -129,20 +129,20 @@ export default class MapScene extends Scene { ...@@ -129,20 +129,20 @@ export default class MapScene extends Scene {
} }
const backData = DataManager.ins.getData('hc_getBackReward'); const backData = DataManager.ins.getData('hc_getBackReward');
if(backData.success && backData.data) { if (backData.success && backData.data) {
panels.push('back'); panels.push('back');
} }
const {signInfoVO} = DataManager.ins.getData('getSignInfo'); const { signInfoVO } = DataManager.ins.getData('getSignInfo');
if(signInfoVO.continueDay < 7) { //表示明天还可以签到 if (signInfoVO.continueDay < 7) { //表示明天还可以签到
if(signInfoVO.todaySigned == 0 && oldTimerStr != nowTimerStr) { if (signInfoVO.todaySigned == 0 && oldTimerStr != nowTimerStr) {
panels.push('sign'); panels.push('sign');
localStorage.setItem('nowTimerStr' + window['CFG'].consumerId, nowTimerStr); localStorage.setItem('nowTimerStr' + window['CFG'].consumerId, nowTimerStr);
} }
} }
this.updateSign(); this.updateSign();
if(!readCache() && getHomeData().levels.length <= 0) { //引导 if (!readCache() && getHomeData().levels.length <= 0) { //引导
const guide = new GuideCon(() => { const guide = new GuideCon(() => {
PanelCtrl.instance.showPanels(panels); PanelCtrl.instance.showPanels(panels);
...@@ -166,7 +166,7 @@ export default class MapScene extends Scene { ...@@ -166,7 +166,7 @@ export default class MapScene extends Scene {
this['rect'].scaleX = 0.5 this['rect'].scaleX = 0.5
//进度条文本发光 //进度条文本发光
setGlow(this['totalStarTxt'], 0x0083e8, 1); setGlow(this['totalStarTxt'], 0x0083e8, 1);
this.topPart = data.top; this.topPart = data.top;
this.repeatsPart = data.list; this.repeatsPart = data.list;
this.bottomPart = data.bottom; this.bottomPart = data.bottom;
...@@ -184,18 +184,18 @@ export default class MapScene extends Scene { ...@@ -184,18 +184,18 @@ export default class MapScene extends Scene {
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];
element.addEventListener(egret.TouchEvent.TOUCH_TAP, () => { element.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
if( if (
(levelOrder > (homeData.levels.length + 1) && levelOrder > 1) (levelOrder > (homeData.levels.length + 1) && levelOrder > 1)
|| (levelOrder > window['last_level']) || (levelOrder > window['last_level'])
) { ) {
...@@ -207,7 +207,7 @@ export default class MapScene extends Scene { ...@@ -207,7 +207,7 @@ export default class MapScene extends Scene {
}, this); }, this);
} }
if(homeData.levels.length < window['total_level']) { if (homeData.levels.length < window['total_level']) {
const targetIcon = MapScene.iconHash[target]; const targetIcon = MapScene.iconHash[target];
const light = RES.getRes('lightani_png'); const light = RES.getRes('lightani_png');
...@@ -220,7 +220,7 @@ export default class MapScene extends Scene { ...@@ -220,7 +220,7 @@ export default class MapScene extends Scene {
pic.anchorOffsetY = 61; pic.anchorOffsetY = 61;
// pic.x = 50 - 2; // pic.x = 50 - 2;
// pic.y = 37 + 10; // pic.y = 37 + 10;
egret.Tween.get(pic, {loop: true}).to({scaleX: 2, scaleY: 2, alpha: 0}, 1000).wait(1000); egret.Tween.get(pic, { loop: true }).to({ scaleX: 2, scaleY: 2, alpha: 0 }, 1000).wait(1000);
this['pic'] = pic; this['pic'] = pic;
} }
...@@ -230,8 +230,8 @@ export default class MapScene extends Scene { ...@@ -230,8 +230,8 @@ export default class MapScene extends Scene {
this.showLog(); this.showLog();
this.updateBox(); this.updateBox();
if(data.level) { if (data.level) {
if(homeData.remainEnargy == 0) if (homeData.remainEnargy == 0)
PanelCtrl.instance.show('bloodPanel') PanelCtrl.instance.show('bloodPanel')
else else
...@@ -239,8 +239,8 @@ export default class MapScene extends Scene { ...@@ -239,8 +239,8 @@ export default class MapScene extends Scene {
} }
this.stage.once(egret.TouchEvent.TOUCH_TAP, () => { this.stage.once(egret.TouchEvent.TOUCH_TAP, () => {
if(!MapScene['firstPlayBgTag']) { if (!MapScene['firstPlayBgTag']) {
if(getBgOn()) { if (getBgOn()) {
playBg(); playBg();
} }
MapScene['firstPlayBgTag'] = true; MapScene['firstPlayBgTag'] = true;
...@@ -248,7 +248,7 @@ export default class MapScene extends Scene { ...@@ -248,7 +248,7 @@ 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);
// console.warn(this.getScrollV(lastOrder, this.stage.stageHeight)) // console.warn(this.getScrollV(lastOrder, this.stage.stageHeight))
...@@ -258,10 +258,30 @@ export default class MapScene extends Scene { ...@@ -258,10 +258,30 @@ export default class MapScene extends Scene {
Promise.all([ Promise.all([
RES.getResAsync(`${key}_json`), RES.getResAsync(`${key}_json`),
RES.getResAsync(`${key}_png`)]); RES.getResAsync(`${key}_png`)]);
} catch(error) { } catch (error) {
} }
this.scroll.addEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this);
}
onEnterFrame() {
const offset =0;
const y0 = 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++;
}
} }
// 添加图标 // 添加图标
...@@ -277,20 +297,20 @@ export default class MapScene extends Scene { ...@@ -277,20 +297,20 @@ export default class MapScene extends Scene {
this['nameTxt'].text = ''; this['nameTxt'].text = '';
// NetManager.ins.hc_userInfo(() => { // NetManager.ins.hc_userInfo(() => {
this['avatar'].visible = true; this['avatar'].visible = true;
const {data} = DataManager.ins.getData('hc_userInfo'); const { data } = DataManager.ins.getData('hc_userInfo');
if(data) if (data)
this['avatar'].source = data.avatar || "http://yun.duiba.com.cn/db_games/default_avatar.png"; this['avatar'].source = data.avatar || "http://yun.duiba.com.cn/db_games/default_avatar.png";
else else
this['avatar'].source = "http://yun.duiba.com.cn/db_games/default_avatar.png"; this['avatar'].source = "http://yun.duiba.com.cn/db_games/default_avatar.png";
if(data && data.nickname) if (data && data.nickname)
this['nameTxt'].text = getNick(data.nickname); this['nameTxt'].text = getNick(data.nickname);
// }); // });
} }
updateSign() { updateSign() {
const {signInfoVO} = DataManager.ins.getData('getSignInfo'); const { signInfoVO } = DataManager.ins.getData('getSignInfo');
if(signInfoVO.continueDay < 7) { //表示明天还可以签到 if (signInfoVO.continueDay < 7) { //表示明天还可以签到
this['sign_s1'].visible = signInfoVO.todaySigned == 0; this['sign_s1'].visible = signInfoVO.todaySigned == 0;
this['sign_s2'].visible = !this['sign_s1'].visible; this['sign_s2'].visible = !this['sign_s1'].visible;
} else { } else {
...@@ -300,17 +320,17 @@ export default class MapScene extends Scene { ...@@ -300,17 +320,17 @@ export default class MapScene extends Scene {
updateAdData() { updateAdData() {
const hc_advert = DataManager.ins.getData('hc_advert').data; const hc_advert = DataManager.ins.getData('hc_advert').data;
let {mapAdvert} = hc_advert; let { mapAdvert } = hc_advert;
if(mapAdvert == null) if (mapAdvert == null)
mapAdvert = {enable: false, advertList: []} mapAdvert = { enable: false, advertList: [] }
this['adBtn'].visible = mapAdvert.enable; this['adBtn'].visible = mapAdvert.enable;
if(this['adBtn'].visible) { if (this['adBtn'].visible) {
NetManager.ins.showLog(getlogItem(32)); NetManager.ins.showLog(getlogItem(32));
} }
if(mapAdvert.enable) { if (mapAdvert.enable) {
let result; let result;
result = mapAdvert.advertList; result = mapAdvert.advertList;
if(Array.isArray(mapAdvert.advertList)) { if (Array.isArray(mapAdvert.advertList)) {
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];
} }
...@@ -324,22 +344,24 @@ export default class MapScene extends Scene { ...@@ -324,22 +344,24 @@ export default class MapScene extends Scene {
destroy() { destroy() {
super.destroy(); super.destroy();
if(this['pic']) if (this['pic'])
egret.Tween.removeTweens(this['pic']); egret.Tween.removeTweens(this['pic']);
if(this.inviteTimer) { if (this.inviteTimer) {
this.inviteTimer.stop(); this.inviteTimer.stop();
this.inviteTimer.removeEventListener(egret.TimerEvent.TIMER, this.inviteCutTimer, this); this.inviteTimer.removeEventListener(egret.TimerEvent.TIMER, this.inviteCutTimer, this);
} }
this.scroll.removeEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this);
} }
getScrollV(lastOrder, stageHeight) { getScrollV(lastOrder, stageHeight) {
// lastOrder = 69; // lastOrder = 69;
if(lastOrder <= 7) {//顶部的1-7关 if (lastOrder <= 7) {//顶部的1-7关
return this.getScrollV1(lastOrder, stageHeight); return this.getScrollV1(lastOrder, stageHeight);
} }
if(lastOrder >= window['total_level'] - 10) {//底部的60-70关 70-10 if (lastOrder >= window['total_level'] - 10) {//底部的60-70关 70-10
return this.getScrollV2(lastOrder, stageHeight); return this.getScrollV2(lastOrder, stageHeight);
} }
//中部的4个循环*13 8~59 //中部的4个循环*13 8~59
...@@ -350,7 +372,7 @@ export default class MapScene extends Scene { ...@@ -350,7 +372,7 @@ export default class MapScene extends Scene {
const ylist = [26, 158, 302, 435, 547, 674, 821, 897, 969, 1072, 1137, 1254, 1367]; const ylist = [26, 158, 302, 435, 547, 674, 821, 897, 969, 1072, 1137, 1254, 1367];
const y0 = this._data.top.height;//顶部的高度 const y0 = this._data.top.height;//顶部的高度
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 * this._data.list[0].height;
...@@ -360,7 +382,7 @@ export default class MapScene extends Scene { ...@@ -360,7 +382,7 @@ export default class MapScene extends Scene {
getScrollV1(lastOrder, stageHeight) { getScrollV1(lastOrder, stageHeight) {
const ylist = [492, 550.35, 744, 803, 810, 975, 1089.69].map(i => i + 40); const ylist = [492, 550.35, 744, 803, 810, 975, 1089.69].map(i => i + 40);
const targetY = ylist[lastOrder - 1] - stageHeight / 2; const targetY = ylist[lastOrder - 1] - stageHeight / 2;
if(targetY <= 0) return 0 if (targetY <= 0) return 0
return targetY; return targetY;
} }
...@@ -372,7 +394,7 @@ export default class MapScene extends Scene { ...@@ -372,7 +394,7 @@ export default class MapScene extends Scene {
+ this._data.bottom.height; + this._data.bottom.height;
const ylist = [44, 148.44, 331, 403, 513, 660, 829.69, 949.69, 1052.69, 1148.69, 1209.69].map(i => i + 40); const ylist = [44, 148.44, 331, 403, 513, 660, 829.69, 949.69, 1052.69, 1148.69, 1209.69].map(i => i + 40);
const targetY = y0 + ylist[lastOrder - 1] - stageHeight / 2; const targetY = y0 + ylist[lastOrder - 1] - stageHeight / 2;
if(targetY >= (totalHeight - stageHeight)) return totalHeight - stageHeight if (targetY >= (totalHeight - stageHeight)) return totalHeight - stageHeight
return targetY; return targetY;
} }
...@@ -382,7 +404,7 @@ export default class MapScene extends Scene { ...@@ -382,7 +404,7 @@ export default class MapScene extends Scene {
} }
enableIcon(level) { enableIcon(level) {
MapScene.iconHash[level].filters = []; this.resetGray(level);
MapScene.starHash[level].visible = true; MapScene.starHash[level].visible = true;
} }
...@@ -394,7 +416,7 @@ export default class MapScene extends Scene { ...@@ -394,7 +416,7 @@ export default class MapScene extends Scene {
updateBox() { updateBox() {
const homeData = getHomeData(); const homeData = getHomeData();
if(homeData.canReceiveTreasureBoxNum <= 0) if (homeData.canReceiveTreasureBoxNum <= 0)
setGray(this['box']); setGray(this['box']);
this['boxiconWrapper'].visible = homeData.canReceiveTreasureBoxNum > 0; this['boxiconWrapper'].visible = homeData.canReceiveTreasureBoxNum > 0;
this['totalStarTxt'].text = `${homeData.totalStars}/${homeData.nextRangeStarsNum}`; this['totalStarTxt'].text = `${homeData.totalStars}/${homeData.nextRangeStarsNum}`;
...@@ -416,7 +438,7 @@ export default class MapScene extends Scene { ...@@ -416,7 +438,7 @@ export default class MapScene extends Scene {
parent.addChild(avatar); parent.addChild(avatar);
avatar.x = item.x + 10; avatar.x = item.x + 10;
avatar.y = item.y - avatar.height - 30; avatar.y = item.y - avatar.height - 30;
if(!MapScene.starHash[level].visible) { if (!MapScene.starHash[level].visible) {
avatar.y = item.y - avatar.height; avatar.y = item.y - avatar.height;
} }
} }
...@@ -424,11 +446,11 @@ export default class MapScene extends Scene { ...@@ -424,11 +446,11 @@ export default class MapScene extends Scene {
updateFriends() { updateFriends() {
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().levels.length + 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";
...@@ -443,24 +465,24 @@ export default class MapScene extends Scene { ...@@ -443,24 +465,24 @@ export default class MapScene extends Scene {
this['goldTxt'].text = `${homeData.wealth}`; this['goldTxt'].text = `${homeData.wealth}`;
for(let j = 1; j < window['total_level']; j++) { for (let j = 1; j < window['total_level']; j++) {
this.disableIcon(j + 1); this.disableIcon(j + 1);
} }
for(let i = 0; i < homeData.levels.length; i++) { for (let i = 0; i < homeData.levels.length; i++) {
const level = homeData.levels[i]; const level = homeData.levels[i];
const star = MapScene.starHash[i + 1]; const star = MapScene.starHash[i + 1];
if(level) { if (level) {
star.setStar(level.stars); star.setStar(level.stars);
this.enableIcon(level.levelNum); this.enableIcon(level.levelNum);
} else { } else {
this.disableIcon(level.levelNum); this.disableIcon(level.levelNum);
} }
} }
if(homeData.levels.length == 0) { if (homeData.levels.length == 0) {
const star = MapScene.starHash[1]; const star = MapScene.starHash[1];
star.setStar(0); star.setStar(0);
this.enableIcon(1); this.enableIcon(1);
} else if(homeData.levels.length == window['last_level']) { } else if (homeData.levels.length == window['last_level']) {
} else { } else {
const star = MapScene.starHash[homeData.levels.length + 1]; const star = MapScene.starHash[homeData.levels.length + 1];
...@@ -474,11 +496,11 @@ export default class MapScene extends Scene { ...@@ -474,11 +496,11 @@ export default class MapScene extends Scene {
updateTimerView() { updateTimerView() {
//更新倒计时 //更新倒计时
if(this._countDown == null) { if (this._countDown == null) {
this._countDown = new CountDown(this['countdown']); this._countDown = new CountDown(this['countdown']);
} }
const data = getHomeData(); const data = getHomeData();
if(data.remainEnargy >= BLOOD_NUMS_MAX) { //满了 if (data.remainEnargy >= BLOOD_NUMS_MAX) { //满了
this._countDown.stop(); this._countDown.stop();
this['fullTxt'].visible = true; this['fullTxt'].visible = true;
...@@ -499,28 +521,28 @@ export default class MapScene extends Scene { ...@@ -499,28 +521,28 @@ export default class MapScene extends Scene {
onTap_inviteBtn() { onTap_inviteBtn() {
NetManager.ins.clickLog(getlogItem(33)); NetManager.ins.clickLog(getlogItem(33));
NetManager.ins.getInviteInfo((success, res) => { NetManager.ins.getInviteInfo((success, res) => {
if(!success || !res.data) { if (!success || !res.data) {
return; return;
} }
const flag = res.data.completeFlag; const flag = res.data.completeFlag;
switch(true) { switch (true) {
case (flag == 0): // 未完成 case (flag == 0): // 未完成
this.loadsvga(res); this.loadsvga(res);
break; break;
case (flag == 1): // 完成未开奖 待领奖 请求领奖接口 case (flag == 1): // 完成未开奖 待领奖 请求领奖接口
try { try {
if(window['getRST']) window['getRST'](); if (window['getRST']) window['getRST']();
} catch(error) { } catch (error) {
console.warn(error) console.warn(error)
} }
NetManager.ins.acceptInvitationPrize((success, res) => { NetManager.ins.acceptInvitationPrize((success, res) => {
if(!success) { if (!success) {
showToast("哎呀,萌狮开小差啦!\n过会再来看吧!"); showToast("哎呀,萌狮开小差啦!\n过会再来看吧!");
GDispatcher.dispatchEvent("getInviteInfo"); GDispatcher.dispatchEvent("getInviteInfo");
return; return;
} }
// console.log(res.data); // console.log(res.data);
if(res.data.completeFlag == 3) { if (res.data.completeFlag == 3) {
showToast("哎呀,萌狮开小差啦!\n过会再来看吧!"); showToast("哎呀,萌狮开小差啦!\n过会再来看吧!");
GDispatcher.dispatchEvent("getInviteInfo"); GDispatcher.dispatchEvent("getInviteInfo");
} else { } else {
...@@ -535,7 +557,7 @@ export default class MapScene extends Scene { ...@@ -535,7 +557,7 @@ export default class MapScene extends Scene {
case (flag == 4): // 可以开启下一次发任务 case (flag == 4): // 可以开启下一次发任务
NetManager.ins.acceptInvitationInfo((success, res) => { NetManager.ins.acceptInvitationInfo((success, res) => {
if(!success) { if (!success) {
return; return;
} }
this.loadsvga(res); this.loadsvga(res);
...@@ -551,7 +573,7 @@ export default class MapScene extends Scene { ...@@ -551,7 +573,7 @@ export default class MapScene extends Scene {
} }
loadsvga(res) { loadsvga(res) {
if(MapScene['svga']) { if (MapScene['svga']) {
const mv = MapScene['svga'] const mv = MapScene['svga']
mv.gotoAndStop(1); mv.gotoAndStop(1);
res.data.svga = mv; res.data.svga = mv;
...@@ -576,14 +598,14 @@ export default class MapScene extends Scene { ...@@ -576,14 +598,14 @@ export default class MapScene extends Scene {
*/ */
getInviteInfo() { getInviteInfo() {
NetManager.ins.getInviteInfo((success, res) => { NetManager.ins.getInviteInfo((success, res) => {
if(!success || !res.data) { if (!success || !res.data) {
return; return;
} }
const flag = res.data.completeFlag; const flag = res.data.completeFlag;
if(this.inviteTimer) { if (this.inviteTimer) {
this.inviteTimer.stop(); this.inviteTimer.stop();
} }
switch(true) { switch (true) {
case (flag == 0): // 未完成 显示倒计时 case (flag == 0): // 未完成 显示倒计时
this["inviteGroup"].visible = true; this["inviteGroup"].visible = true;
NetManager.ins.showLog(getlogItem(33)); NetManager.ins.showLog(getlogItem(33));
...@@ -596,7 +618,7 @@ export default class MapScene extends Scene { ...@@ -596,7 +618,7 @@ export default class MapScene extends Scene {
this.inviteCutTimer(); this.inviteCutTimer();
break; break;
case (flag == 1): // 完成未开奖 待领奖 显示待领奖 case (flag == 1): // 完成未开奖 待领奖 显示待领奖
NetManager.ins.showLog(getlogItem(33)); NetManager.ins.showLog(getlogItem(33));
this["inviteGroup"].visible = true; this["inviteGroup"].visible = true;
this["inviteTipsBg"].visible = true; this["inviteTipsBg"].visible = true;
this["inviteTips"].visible = true; this["inviteTips"].visible = true;
...@@ -636,7 +658,7 @@ export default class MapScene extends Scene { ...@@ -636,7 +658,7 @@ export default class MapScene extends Scene {
// 倒计时 // 倒计时
private inviteCutTimer() { private inviteCutTimer() {
const timer = this.convertTime(this.cutTime -= 1000); const timer = this.convertTime(this.cutTime -= 1000);
if(timer.hour === "00" if (timer.hour === "00"
&& timer.min === "00" && timer.min === "00"
&& timer.sec === "00") { && timer.sec === "00") {
this.inviteTimer.stop(); this.inviteTimer.stop();
...@@ -723,9 +745,9 @@ export default class MapScene extends Scene { ...@@ -723,9 +745,9 @@ export default class MapScene extends Scene {
async onTap_boxLayer() { async onTap_boxLayer() {
NetManager.ins.clickLog(getlogItem(1)); NetManager.ins.clickLog(getlogItem(1));
const data = getHomeData(); const data = getHomeData();
if(data.canReceiveTreasureBoxNum > 0) { if (data.canReceiveTreasureBoxNum > 0) {
this['boxLayer'].visible = true; this['boxLayer'].visible = true;
if(!this._mc) if (!this._mc)
this._mc = await loadSvga(getResPath() + 'resource/assets/svgas/box.svga', this['boxani']); this._mc = await loadSvga(getResPath() + 'resource/assets/svgas/box.svga', this['boxani']);
this._mc.stop(); this._mc.stop();
this._mc.gotoAndStop(1); this._mc.gotoAndStop(1);
...@@ -737,18 +759,18 @@ export default class MapScene extends Scene { ...@@ -737,18 +759,18 @@ export default class MapScene extends Scene {
await wait(50); await wait(50);
this._mc.visible = true; this._mc.visible = true;
const a = 100, b = 10; const a = 100, b = 10;
egret.Tween.get(this._mc, {loop: true}).set({rotation: b}) egret.Tween.get(this._mc, { loop: true }).set({ rotation: b })
.to({rotation: -b}, a).to({rotation: b}, a) .to({ rotation: -b }, a).to({ rotation: b }, a)
.to({rotation: -b}, a).to({rotation: b}, a) .to({ rotation: -b }, a).to({ rotation: b }, a)
.to({rotation: -b}, a).to({rotation: b}, a) .to({ rotation: -b }, a).to({ rotation: b }, a)
.to({rotation: 0}, a / 2) .to({ rotation: 0 }, a / 2)
.wait(1000); .wait(1000);
} }
} }
async playAni() { async playAni() {
if(this._mc) { if (this._mc) {
egret.Tween.removeTweens(this._mc); egret.Tween.removeTweens(this._mc);
this._mc.gotoAndPlay(1, true); this._mc.gotoAndPlay(1, true);
await this.onPlaySTOP(); await this.onPlaySTOP();
...@@ -759,7 +781,7 @@ export default class MapScene extends Scene { ...@@ -759,7 +781,7 @@ export default class MapScene extends Scene {
async onPlaySTOP() { async onPlaySTOP() {
return new Promise((r) => { return new Promise((r) => {
const func = () => { const func = () => {
if(this._mc.currentFrame >= 100) { if (this._mc.currentFrame >= 100) {
this._mc.removeEventListener(egret.Event.ENTER_FRAME, func, this); this._mc.removeEventListener(egret.Event.ENTER_FRAME, func, this);
this._mc.stop(); this._mc.stop();
r(); r();
...@@ -778,14 +800,14 @@ export default class MapScene extends Scene { ...@@ -778,14 +800,14 @@ export default class MapScene extends Scene {
this['boxani'].touchChildren = false; this['boxani'].touchChildren = false;
await this.playAni(); await this.playAni();
try { try {
if(window['getRST']) window['getRST'](); if (window['getRST']) window['getRST']();
} catch(error) { } catch (error) {
console.warn(error) console.warn(error)
} }
NetManager.ins.hc_openTreasureBox((success) => { NetManager.ins.hc_openTreasureBox((success) => {
this['boxani'].touchEnabled = true; this['boxani'].touchEnabled = true;
this['boxani'].touchChildren = true; this['boxani'].touchChildren = true;
if(success) { if (success) {
const hc_openTreasureBox = DataManager.ins.getData('hc_openTreasureBox'); const hc_openTreasureBox = DataManager.ins.getData('hc_openTreasureBox');
const boxdata = hc_openTreasureBox.data; const boxdata = hc_openTreasureBox.data;
const homeData = DataManager.ins.getData('hc_home').data; const homeData = DataManager.ins.getData('hc_home').data;
...@@ -794,8 +816,8 @@ export default class MapScene extends Scene { ...@@ -794,8 +816,8 @@ export default class MapScene extends Scene {
homeData.totalStarts = boxdata.totalStarts; homeData.totalStarts = boxdata.totalStarts;
homeData.isGetAllTreasureBox = boxdata.isGetAllTreasureBox; homeData.isGetAllTreasureBox = boxdata.isGetAllTreasureBox;
this.updateBox(); this.updateBox();
if(hc_openTreasureBox.success && boxdata && boxdata.option) { if (hc_openTreasureBox.success && boxdata && boxdata.option) {
PanelCtrl.instance.show('box'); PanelCtrl.instance.show('box');
} else { } else {
...@@ -803,7 +825,7 @@ export default class MapScene extends Scene { ...@@ -803,7 +825,7 @@ export default class MapScene extends Scene {
} }
NetManager.ins.hc_home(() => { NetManager.ins.hc_home(() => {
this.updateScene(); this.updateScene();
}, window['collectRuleId']); }, window['collectRuleId']);
} else { } else {
...@@ -829,7 +851,7 @@ export default class MapScene extends Scene { ...@@ -829,7 +851,7 @@ export default class MapScene extends Scene {
onTap_bloodBtn() { onTap_bloodBtn() {
NetManager.ins.clickLog(getlogItem(2)); NetManager.ins.clickLog(getlogItem(2));
if(getHomeData().remainEnargy > 0) if (getHomeData().remainEnargy > 0)
PanelCtrl.instance.show('bloodPanel') PanelCtrl.instance.show('bloodPanel')
else else
PanelCtrl.instance.show('blood2Panel') PanelCtrl.instance.show('blood2Panel')
...@@ -837,8 +859,14 @@ export default class MapScene extends Scene { ...@@ -837,8 +859,14 @@ export default class MapScene extends Scene {
setGray(order: number) { setGray(order: number) {
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).font ='nums3_fnt'; (icon['bmptxt'] as eui.BitmapLabel).font = 'nums3_fnt';
}
resetGray(order: number) {
const icon = MapScene.iconHash[order];
(icon['nums'] as eui.Image).source = 'icon_png';
(icon['bmptxt'] as eui.BitmapLabel).font = 'nums_fnt';
} }
get skinKey() { get skinKey() {
...@@ -846,9 +874,9 @@ export default class MapScene extends Scene { ...@@ -846,9 +874,9 @@ export default class MapScene extends Scene {
} }
} }
export const getNick = (nickname, max = 4) => { export const getNick = (nickname, max = 4) => {
if(!nickname) return nickname; if (!nickname) return nickname;
if(nickname.length > max) if (nickname.length > max)
return nickname.slice(0, max) + '...'; return nickname.slice(0, max) + '...';
return nickname; return nickname;
} }
\ No newline at end of file
import ComponentBase from "../../libs/new_wx/components/ComponentBase"; import ComponentBase from "../../libs/new_wx/components/ComponentBase";
import MapScene from "./MapScene"; import MapScene from "./MapScene";
import MapStarComp from "./MapStarComp"; import MapStarComp from "./MapStarComp";
import { createData } from "../startScene/StartScene";
export default class MapTopPart extends ComponentBase { export default class MapTopPart extends ComponentBase {
static LEVEL_NUMS = 7; static LEVEL_NUMS = 7;
...@@ -18,10 +19,11 @@ export default class MapTopPart extends ComponentBase { ...@@ -18,10 +19,11 @@ export default class MapTopPart extends ComponentBase {
icon['nums'] = icon.getChildAt(0); icon['nums'] = icon.getChildAt(0);
icon['bmptxt']=icon.getChildAt(1); icon['bmptxt']=icon.getChildAt(1);
this.removeChild(icon); this.removeChild(icon);icon.hide = ()=>{this.removeChild(icon)};
icon['mappart']=this; icon['mappart']=this;
icon.show = ()=>{this.addChild(icon)}; icon.show = ()=>{this.addChild(icon)};
icon['visibleY'] = icon.y; icon['visibleY'] = icon.y;
console.log(icon['visibleY']);
} }
} }
......
...@@ -109,21 +109,32 @@ export const changeMapScene = (p?) => { ...@@ -109,21 +109,32 @@ export const changeMapScene = (p?) => {
SceneCtrl.instance.change(ModuleTypes.MAP_SCENE, data); SceneCtrl.instance.change(ModuleTypes.MAP_SCENE, data);
} }
let _startSceneData;
export const createData = () => { export const createData = () => {
if(_startSceneData)return _startSceneData;
const startSceneData: any = {}; const startSceneData: any = {};
startSceneData.top = new MapTopPart(); _startSceneData = startSceneData;
startSceneData.top.loadSkin(); startSceneData.top.start();
startSceneData.bottom = new MapBottomPart(); const repeatCount =getRepeatCount();
startSceneData.bottom.loadSkin(); startSceneData.bottom.start();
const list = []; const list = [];
startSceneData.list = list; startSceneData.list = list;
const repeatCount =getRepeatCount(); startSceneData.top = new MapTopPart();
startSceneData.top.loadSkin(); startSceneData.top.start();
for (let i = 0; i < repeatCount; i++) { for (let i = 0; i < repeatCount; i++) {
const repeat = new MapRpeatPart(i,startSceneData.top.height); const repeat = new MapRpeatPart(i,startSceneData.top.height);
repeat.loadSkin(); repeat.start(); repeat.loadSkin(); repeat.start();
list.push(repeat); list.push(repeat);
} }
startSceneData.bottom = new MapBottomPart();
startSceneData.bottom.loadSkin();
startSceneData.bottom.start({
repeatHeight:list[0].height,
topHeight:startSceneData.top.height
});
return startSceneData return startSceneData
} }
......
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