Commit 01bd4a11 authored by wildfirecode's avatar wildfirecode

1

parent 92739795
......@@ -12,11 +12,11 @@ export default class PrizePanel extends Panel {
_level;
updateOption(option: any) {
const { categoryType, img, num, propType,realValue } = option;// 2次数 3道具 4元宝 5实物 6优惠券 7虚拟商品
const { categoryType, img, num, propType, realValue } = option;// 2次数 3道具 4元宝 5实物 6优惠券 7虚拟商品
this['propnums'].text = 'x1';
this['propnums2'].text = 'x1';
if(num){
if (num) {
this['propnums'].text = 'x' + num;
this['propnums2'].text = 'x' + num;
}
......@@ -71,7 +71,7 @@ export default class PrizePanel extends Panel {
this.setStar(hc_submitData.stars);
addRankFriendList(84,889.74,this);
addRankFriendList(84, 889.74, this);
}
showlog() {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -51,16 +51,16 @@ export default class MapScene extends Scene {
sendInvite() {
const code = Utils.getRequestByKey('shareCode');
if(!code) return;
if(doHelpFlag) {
if (!code) return;
if (doHelpFlag) {
return;
}
if(code.indexOf("12345678") == -1) { // 邀请有礼
if (code.indexOf("12345678") == -1) { // 邀请有礼
const dojoin = DataManager.ins.getData('hc_doJoin');
if(!dojoin) return;
if (!dojoin) return;
NetManager.ins.doHelp((success, res) => {
doHelpFlag = true;
switch(true) {
switch (true) {
case (res.code == "400017"):
showToast("您不是新用户呢~");
break;
......@@ -73,7 +73,7 @@ export default class MapScene extends Scene {
default:
break;
}
if(!success) {
if (!success) {
return;
}
showToast("助力成功");
......@@ -83,7 +83,7 @@ export default class MapScene extends Scene {
const _code = code.slice(8);
NetManager.ins.scratchDoHelp((success, res) => {
doHelpFlag = true;
switch(true) {
switch (true) {
case (res.code == "0000024"):
showToast("今日刮卡次数已达到上线限哦~");
break;
......@@ -96,7 +96,7 @@ export default class MapScene extends Scene {
default:
break;
}
if(!success) {
if (!success) {
return;
}
showToast("帮刮成功!");
......@@ -139,6 +139,14 @@ export default class MapScene extends Scene {
async start(data?) {
super.start();
NetManager.ins.hc_submit(() => {
const submitData = DataManager.ins.getData('hc_submit').data;
PanelCtrl.instance.show(ModuleTypes.PRIZE_PANEL, {
level: 1,
option: submitData.option
})
}, 1, 1, '', '', '')
this.addIcon(); // 添加Icon
this.sendInvite();
......@@ -149,7 +157,7 @@ export default class MapScene extends Scene {
GDispatcher.dispatchEvent("getInviteInfo"); // 查询邀请信息,控制邀请有礼角标
this['avatar'].mask = this['avatarMask'];
if(getBgOn() && MapScene['firstPlayBgTag'] == true) {
if (getBgOn() && MapScene['firstPlayBgTag'] == true) {
playBg();
}
......@@ -166,12 +174,12 @@ export default class MapScene extends Scene {
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}
let { noticeAdvert } = hc_advert;
if (noticeAdvert == null) {
noticeAdvert = { enable: false }
}
if(noticeAdvert && noticeAdvert.enable && nowTimerStr2 != oldTimerStr2) {
if (noticeAdvert && noticeAdvert.enable && nowTimerStr2 != oldTimerStr2) {
// if (!adTag) {
panels.push('ad');
// adTag = true;
......@@ -184,9 +192,9 @@ export default class MapScene extends Scene {
// panels.push('back');
// }
const {signInfoVO} = DataManager.ins.getData('getSignInfo');
if(signInfoVO.continueDay < 7) { //表示明天还可以签到
if(signInfoVO.todaySigned == 0 && oldTimerStr != nowTimerStr) {
const { signInfoVO } = DataManager.ins.getData('getSignInfo');
if (signInfoVO.continueDay < 7) { //表示明天还可以签到
if (signInfoVO.todaySigned == 0 && oldTimerStr != nowTimerStr) {
panels.push('sign');
localStorage.setItem('nowTimerStr' + window['CFG'].consumerId, nowTimerStr);
}
......@@ -195,12 +203,12 @@ export default class MapScene extends Scene {
// 红包雨强提示
const hbRainRes = DataManager.ins.getData(NetName.HBRAIN_BASEINFO);
if(hbRainRes.data) {
if(hbRainRes.data.currentSession || hbRainRes.data.nextSession) {
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) {
if (nowTimerStr3 != oldTimerStr3) {
panels.push('HbCutTime');
localStorage.setItem('nowTimer3Str' + window['CFG'].consumerId, nowTimerStr3);
}
......@@ -209,11 +217,11 @@ export default class MapScene extends Scene {
// 任务中心可领奖强提示
let canShow = localStorage.getItem('taskCenter' + window['CFG'].consumerId);
if(canShow == 'true'){
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) {
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;
}
......@@ -223,15 +231,15 @@ export default class MapScene extends Scene {
localStorage.setItem('taskCenter' + window['CFG'].consumerId, 'false');
let res = DataManager.ins.getData('hc_redBombBaseInfo');
if(res.data > 0){
if (res.data > 0) {
let showBomb = localStorage.getItem('showBomb' + window['CFG'].consumerId);
if(showBomb != 'false'){
if (showBomb != 'false') {
localStorage.setItem('showBomb' + window['CFG'].consumerId, 'false');
panels.push('BombTips2Panel');
}
}
if(!readCache() && getHomeData().levels.length <= 0) { //引导
if (!readCache() && getHomeData().levels.length <= 0) { //引导
const guide = new GuideCon(() => {
PanelCtrl.instance.showPanels(panels, [], this.onAllPanelHide);
});
......@@ -271,19 +279,19 @@ export default class MapScene extends Scene {
let target;
const homeData = getHomeData();
if(homeData.levels.length == 0) {
if (homeData.levels.length == 0) {
target = 1;
} else if(homeData.levels.length == window['total_level']) {
} 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) {
for (const key in MapScene.iconHash) {
const levelOrder = parseInt(key);
const element = MapScene.iconHash[key];
if(!element.hasEventListener(egret.TouchEvent.TOUCH_TAP)) {
if (!element.hasEventListener(egret.TouchEvent.TOUCH_TAP)) {
element.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
if(
if (
(levelOrder > (getHomeData().levels.length + 1) && levelOrder > 1)
|| (levelOrder > window['last_level'])
) {
......@@ -296,7 +304,7 @@ export default class MapScene extends Scene {
}
}
if(homeData.levels.length < window['total_level']) {
if (homeData.levels.length < window['total_level']) {
const targetIcon = MapScene.iconHash[target];
const light = RES.getRes('lightani_png');
......@@ -309,7 +317,7 @@ export default class MapScene extends Scene {
pic.anchorOffsetY = 61;
// pic.x = 50 - 2;
// 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;
}
......@@ -319,8 +327,8 @@ export default class MapScene extends Scene {
this.showLog();
this.updateBox();
if(data.level) {
if(homeData.remainEnargy == 0)
if (data.level) {
if (homeData.remainEnargy == 0)
PanelCtrl.instance.show('bloodPanel')
else
......@@ -328,8 +336,8 @@ export default class MapScene extends Scene {
}
this.stage.once(egret.TouchEvent.TOUCH_TAP, () => {
if(!MapScene['firstPlayBgTag']) {
if(getBgOn()) {
if (!MapScene['firstPlayBgTag']) {
if (getBgOn()) {
playBg();
}
MapScene['firstPlayBgTag'] = true;
......@@ -337,7 +345,7 @@ export default class MapScene extends Scene {
}, this);
let lastOrder = homeData.levels.length + 1;
if(homeData.levels.length >= window['total_level'])
if (homeData.levels.length >= window['total_level'])
lastOrder = window['total_level'];
this.scroll.viewport.scrollV = this.getScrollV(lastOrder, this.stage.stageHeight);
// console.warn(this.getScrollV(lastOrder, this.stage.stageHeight))
......@@ -347,7 +355,7 @@ export default class MapScene extends Scene {
Promise.all([
RES.getResAsync(`${key}_json`),
RES.getResAsync(`${key}_png`)]);
} catch(error) {
} catch (error) {
}
......@@ -355,7 +363,7 @@ export default class MapScene extends Scene {
}
onAllPanelHide = () => {
if(!localStorage.getItem('activityguide')) {
if (!localStorage.getItem('activityguide')) {
// NetManager.ins.hbRainBaseInfo((success, res) => {
// if(!success) {
// if(res.code == "600054" || res.code == "600055") {
......@@ -379,21 +387,21 @@ export default class MapScene extends Scene {
const y1 = this.stage.stageHeight + this.scroll.viewport.scrollV - offset;
// console.log(y0, y1);
let count = 0;
for(const key in MapScene.iconHash) {
for (const key in MapScene.iconHash) {
const icon = MapScene.iconHash[key];
if(icon['visibleY'] >= y0 && icon['visibleY'] <= y1) {
if (icon['visibleY'] >= y0 && icon['visibleY'] <= y1) {
icon.show();
} else if(icon.parent) {
} else if (icon.parent) {
icon.hide();
}
if(icon.parent)
if (icon.parent)
count++;
}
if(this._avatarsCache) {
if (this._avatarsCache) {
this._avatarsCache.forEach((item) => {
if(item.parent) item.parent.addChild(item);
if (item.parent) item.parent.addChild(item);
});
}
......@@ -414,7 +422,7 @@ export default class MapScene extends Scene {
}
private removeIcon() {
for(let k in this.icons) {
for (let k in this.icons) {
this.icons[k].destory();
}
this.icons = {};
......@@ -426,20 +434,20 @@ export default class MapScene extends Scene {
this['nameTxt'].text = '';
// NetManager.ins.hc_userInfo(() => {
this['avatar'].visible = true;
const {data} = DataManager.ins.getData('hc_userInfo');
if(data)
const { data } = DataManager.ins.getData('hc_userInfo');
if (data)
this['avatar'].source = data.avatar || "http://yun.duiba.com.cn/db_games/default_avatar.png";
else
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);
// });
}
updateSign() {
const {signInfoVO} = DataManager.ins.getData('getSignInfo');
if(signInfoVO.continueDay < 7) { //表示明天还可以签到
const { signInfoVO } = DataManager.ins.getData('getSignInfo');
if (signInfoVO.continueDay < 7) { //表示明天还可以签到
this['sign_s1'].visible = signInfoVO.todaySigned == 0;
this['sign_s2'].visible = !this['sign_s1'].visible;
} else {
......@@ -449,17 +457,17 @@ export default class MapScene extends Scene {
updateAdData() {
const hc_advert = DataManager.ins.getData('hc_advert').data || {};
let {mapAdvert} = hc_advert;
if(mapAdvert == null)
mapAdvert = {enable: false, advertList: []}
let { mapAdvert } = hc_advert;
if (mapAdvert == null)
mapAdvert = { enable: false, advertList: [] }
this['adBtn'].visible = mapAdvert.enable;
if(this['adBtn'].visible) {
if (this['adBtn'].visible) {
NetManager.ins.showLog(getlogItem(32));
}
if(mapAdvert.enable) {
if (mapAdvert.enable) {
let result;
result = mapAdvert.advertList;
if(Array.isArray(mapAdvert.advertList)) {
if (Array.isArray(mapAdvert.advertList)) {
const index = Math.floor(mapAdvert.advertList.length * Math.random());
result = mapAdvert.advertList[index];
}
......@@ -477,10 +485,10 @@ export default class MapScene extends Scene {
this.removeIcon();
this.actIcon.destory();
if(this['pic'])
if (this['pic'])
egret.Tween.removeTweens(this['pic']);
if(this.inviteTimer) {
if (this.inviteTimer) {
this.inviteTimer.stop();
this.inviteTimer.removeEventListener(egret.TimerEvent.TIMER, this.inviteCutTimer, this);
}
......@@ -488,18 +496,18 @@ export default class MapScene extends Scene {
this.scroll.removeEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this);
this._avatarsCache.forEach((item) => {
if(item.parent) item.parent.removeChild(item);
if (item.parent) item.parent.removeChild(item);
});
this._avatarsCache = null;
}
getScrollV(lastOrder, stageHeight) {
// lastOrder = 69;
if(lastOrder <= 7) {//顶部的1-7关
if (lastOrder <= 7) {//顶部的1-7关
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);
}
//中部的4个循环*13 8~59
......@@ -510,7 +518,7 @@ export default class MapScene extends Scene {
const ylist = [26, 158, 302, 435, 547, 674, 821, 897, 969, 1072, 1137, 1254, 1367];
const y0 = this._data.top.height;//顶部的高度
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 y1 = ylist[a0 - 1];
const y2 = y0 + y1 + a1 * this._data.list[0].height;
......@@ -520,7 +528,7 @@ export default class MapScene extends Scene {
getScrollV1(lastOrder, stageHeight) {
const ylist = [492, 550.35, 744, 803, 810, 975, 1089.69].map(i => i + 40);
const targetY = ylist[lastOrder - 1] - stageHeight / 2;
if(targetY <= 0) return 0
if (targetY <= 0) return 0
return targetY;
}
......@@ -532,7 +540,7 @@ export default class MapScene extends Scene {
+ 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 targetY = y0 + ylist[lastOrder - 1] - stageHeight / 2;
if(targetY >= (totalHeight - stageHeight)) return totalHeight - stageHeight
if (targetY >= (totalHeight - stageHeight)) return totalHeight - stageHeight
return targetY;
}
......@@ -555,7 +563,7 @@ export default class MapScene extends Scene {
updateBox() {
const homeData = getHomeData();
if(homeData.canReceiveTreasureBoxNum <= 0)
if (homeData.canReceiveTreasureBoxNum <= 0)
setGray(this['box']);
this['boxiconWrapper'].visible = homeData.canReceiveTreasureBoxNum > 0;
this['totalStarTxt'].text = `${homeData.totalStars}/${homeData.nextRangeStarsNum}`;
......@@ -579,7 +587,7 @@ export default class MapScene extends Scene {
parent.addChild(avatar);
avatar.x = item.x + 10;
avatar.y = item.y - avatar.height - 30;
if(!MapScene.starHash[level].visible) {
if (!MapScene.starHash[level].visible) {
avatar.y = item.y - avatar.height;
}
this._avatarsCache.push(avatar);
......@@ -588,11 +596,11 @@ export default class MapScene extends Scene {
updateFriends() {
NetManager.ins.hc_mapRank(() => {
const hc_mapRank = DataManager.ins.getData('hc_mapRank').data;
if(!hc_mapRank) return;
const {data} = DataManager.ins.getData('hc_userInfo');
if (!hc_mapRank) return;
const { data } = DataManager.ins.getData('hc_userInfo');
hc_mapRank.forEach((ele) => {
if(ele.levelNum == getHomeData().levels.length + 1) {
if(data == null)
if (ele.levelNum == getHomeData().levels.length + 1) {
if (data == null)
ele.rank[0].avatar = "http://yun.duiba.com.cn/db_games/default_avatar.png";
else
ele.rank[0].avatar = data.avatar || "http://yun.duiba.com.cn/db_games/default_avatar.png";
......@@ -607,24 +615,24 @@ export default class MapScene extends Scene {
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);
}
for(let i = 0; i < homeData.levels.length; i++) {
for (let i = 0; i < homeData.levels.length; i++) {
const level = homeData.levels[i];
const star = MapScene.starHash[i + 1];
if(level) {
if (level) {
star.setStar(level.stars);
this.enableIcon(level.levelNum);
} else {
this.disableIcon(level.levelNum);
}
}
if(homeData.levels.length == 0) {
if (homeData.levels.length == 0) {
const star = MapScene.starHash[1];
star.setStar(0);
this.enableIcon(1);
} else if(homeData.levels.length == window['last_level']) {
} else if (homeData.levels.length == window['last_level']) {
} else {
const star = MapScene.starHash[homeData.levels.length + 1];
......@@ -638,11 +646,11 @@ export default class MapScene extends Scene {
updateTimerView() {
//更新倒计时
if(this._countDown == null) {
if (this._countDown == null) {
this._countDown = new CountDown(this['countdown']);
}
const data = getHomeData();
if(data.remainEnargy >= BLOOD_NUMS_MAX) { //满了
if (data.remainEnargy >= BLOOD_NUMS_MAX) { //满了
this._countDown.stop();
this['fullTxt'].visible = true;
......@@ -669,28 +677,28 @@ export default class MapScene extends Scene {
onTap_inviteBtn() {
NetManager.ins.clickLog(getlogItem(33));
NetManager.ins.getInviteInfo((success, res) => {
if(!success || !res.data) {
if (!success || !res.data) {
return;
}
const flag = res.data.completeFlag;
switch(true) {
switch (true) {
case (flag == 0): // 未完成
this.loadsvga(res);
break;
case (flag == 1): // 完成未开奖 待领奖 请求领奖接口
try {
if(window['getRST']) window['getRST']();
} catch(error) {
if (window['getRST']) window['getRST']();
} catch (error) {
console.warn(error)
}
NetManager.ins.acceptInvitationPrize((success, res) => {
if(!success) {
if (!success) {
showToast("哎呀,萌狮开小差啦!\n过会再来看吧!");
GDispatcher.dispatchEvent("getInviteInfo");
return;
}
// console.log(res.data);
if(res.data.completeFlag == 3) {
if (res.data.completeFlag == 3) {
showToast("哎呀,萌狮开小差啦!\n过会再来看吧!");
GDispatcher.dispatchEvent("getInviteInfo");
} else {
......@@ -705,7 +713,7 @@ export default class MapScene extends Scene {
case (flag == 4): // 可以开启下一次发任务
NetManager.ins.acceptInvitationInfo((success, res) => {
if(!success) {
if (!success) {
return;
}
this.loadsvga(res);
......@@ -721,7 +729,7 @@ export default class MapScene extends Scene {
}
loadsvga(res) {
if(MapScene['svga']) {
if (MapScene['svga']) {
const mv = MapScene['svga']
mv.gotoAndStop(1);
res.data.svga = mv;
......@@ -746,21 +754,21 @@ export default class MapScene extends Scene {
*/
getInviteInfo() {
const hc_advert = DataManager.ins.getData('hc_advert').data || {};
const {mapAdvert} = hc_advert;
const { mapAdvert } = hc_advert;
// tslint:disable-next-line: cyclomatic-complexity
NetManager.ins.getInviteInfo((success, res) => {
if(!success || !res.data) {
if (!success || !res.data) {
return;
}
const flag = res.data.completeFlag;
if(this.inviteTimer) {
if (this.inviteTimer) {
this.inviteTimer.stop();
}
switch(true) {
switch (true) {
case (flag == 0): // 未完成 显示倒计时
this["inviteGroup"].visible = true;
this["inviteGroup"].touchEnabled = true;
if(!mapAdvert || mapAdvert.enable == false) {
if (!mapAdvert || mapAdvert.enable == false) {
this['activitys'].y = 458;
this['guideInner'].y = 185;
}
......@@ -777,7 +785,7 @@ export default class MapScene extends Scene {
NetManager.ins.showLog(getlogItem(33));
this["inviteGroup"].visible = true;
this["inviteGroup"].touchEnabled = true;
if(!mapAdvert || mapAdvert.enable == false) {
if (!mapAdvert || mapAdvert.enable == false) {
this['activitys'].y = 458;
this['guideInner'].y = 185;
}
......@@ -789,7 +797,7 @@ export default class MapScene extends Scene {
case (flag == 3): // 领奖失败 无角标
this["inviteGroup"].visible = true;
this["inviteGroup"].touchEnabled = true;
if(!mapAdvert || mapAdvert.enable == false) {
if (!mapAdvert || mapAdvert.enable == false) {
this['activitys'].y = 458;
this['guideInner'].y = 185;
}
......@@ -800,7 +808,7 @@ export default class MapScene extends Scene {
case (flag == 4): // 可以开启下一次发任务 显示立即到账
this["inviteGroup"].visible = true;
this["inviteGroup"].touchEnabled = true;
if(!mapAdvert || mapAdvert.enable == false) {
if (!mapAdvert || mapAdvert.enable == false) {
this['activitys'].y = 458;
this['guideInner'].y = 185;
}
......@@ -812,7 +820,7 @@ export default class MapScene extends Scene {
case (flag == 5): // 等待开启下一次发任务 无角标
this["inviteGroup"].visible = true;
this["inviteGroup"].touchEnabled = true;
if(!mapAdvert || mapAdvert.enable == false) {
if (!mapAdvert || mapAdvert.enable == false) {
this['activitys'].y = 458;
this['guideInner'].y = 185;
}
......@@ -824,7 +832,7 @@ export default class MapScene extends Scene {
this["inviteGroup"].visible = false;
this["inviteGroup"].touchEnabled = false;
this['adBtn'].y = 323.76;
if(mapAdvert && mapAdvert.enable) {
if (mapAdvert && mapAdvert.enable) {
this['guideInner'].y = 185;
this['activitys'].y = 458;
} else {
......@@ -841,7 +849,7 @@ export default class MapScene extends Scene {
// 倒计时
private inviteCutTimer() {
const timer = this.convertTime(this.cutTime -= 1000);
if(timer.hour === "00"
if (timer.hour === "00"
&& timer.min === "00"
&& timer.sec === "00") {
this.inviteTimer.stop();
......@@ -934,9 +942,9 @@ export default class MapScene extends Scene {
async onTap_boxLayer() {
NetManager.ins.clickLog(getlogItem(1));
const data = getHomeData();
if(data.canReceiveTreasureBoxNum > 0) {
if (data.canReceiveTreasureBoxNum > 0) {
this['boxLayer'].visible = true;
if(!this._mc)
if (!this._mc)
this._mc = await loadSvga(getResPath() + 'resource/assets/svgas/box.svga', this['boxani']);
this._mc.stop();
this._mc.gotoAndStop(1);
......@@ -948,18 +956,18 @@ export default class MapScene extends Scene {
await wait(50);
this._mc.visible = true;
const a = 100, b = 10;
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: 0}, a / 2)
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: 0 }, a / 2)
.wait(1000);
}
}
async playAni() {
if(this._mc) {
if (this._mc) {
egret.Tween.removeTweens(this._mc);
this._mc.gotoAndPlay(1, true);
await this.onPlaySTOP();
......@@ -970,7 +978,7 @@ export default class MapScene extends Scene {
async onPlaySTOP() {
return new Promise((r) => {
const func = () => {
if(this._mc.currentFrame >= 100) {
if (this._mc.currentFrame >= 100) {
this._mc.removeEventListener(egret.Event.ENTER_FRAME, func, this);
this._mc.stop();
r();
......@@ -989,14 +997,14 @@ export default class MapScene extends Scene {
this['boxani'].touchChildren = false;
await this.playAni();
try {
if(window['getRST']) window['getRST']();
} catch(error) {
if (window['getRST']) window['getRST']();
} catch (error) {
console.warn(error)
}
NetManager.ins.hc_openTreasureBox((success) => {
this['boxani'].touchEnabled = true;
this['boxani'].touchChildren = true;
if(success) {
if (success) {
const hc_openTreasureBox = DataManager.ins.getData('hc_openTreasureBox');
const boxdata = hc_openTreasureBox.data;
const homeData = DataManager.ins.getData('hc_home').data;
......@@ -1006,7 +1014,7 @@ export default class MapScene extends Scene {
homeData.isGetAllTreasureBox = boxdata.isGetAllTreasureBox;
this.updateBox();
if(hc_openTreasureBox.success && boxdata && boxdata.option) {
if (hc_openTreasureBox.success && boxdata && boxdata.option) {
PanelCtrl.instance.show('box');
} else {
......@@ -1040,7 +1048,7 @@ export default class MapScene extends Scene {
onTap_bloodBtn() {
NetManager.ins.clickLog(getlogItem(2));
if(getHomeData().remainEnargy > 0)
if (getHomeData().remainEnargy > 0)
PanelCtrl.instance.show('bloodPanel');
else
PanelCtrl.instance.show('blood2Panel');
......@@ -1065,14 +1073,14 @@ export default class MapScene extends Scene {
showRedBagAni() {
const hash = MapScene.iconHash;
const keys = [];
for(const key in hash) {
for (const key in hash) {
const ele = hash[key];
if(ele.parent)
if (ele.parent)
keys.push(key);
}
const p0 = new egret.Point(750 / 2, 750 / 1.5);
const pics = [];
for(const key of keys) {
for (const key of keys) {
const icon = MapScene.iconHash[key] as egret.DisplayObject;
const p = (icon.localToGlobal(0, 0));
const pic = createRedBagIcon(this);
......@@ -1089,7 +1097,7 @@ export default class MapScene extends Scene {
pic.visible = true;
const p2 = pic['__p2__'] as egret.Point;
let dir = 100;
if(p2.y < p0.y)
if (p2.y < p0.y)
dir *= -1;
const p1x = (p0.x + p2.x) / 2 + dir;
const p1y = (p0.y + p2.y) / 2;
......@@ -1099,16 +1107,16 @@ export default class MapScene extends Scene {
this.addChild(mc);
const x0 = pic['__icon__'].x;
const y0 = pic['__icon__'].y;
egret.Tween.get(pic['__icon__']).to({y: y0 + 10}, 100).to({y: y0}, 100);
egret.Tween.get(pic['__icon__']).to({ y: y0 + 10 }, 100).to({ y: y0 }, 100);
const light = new egret.Bitmap(RES.getRes('maplight2_png'));
light.anchorOffsetX = 75;
light.anchorOffsetY = 49;
light.x = 50;
light.y = 40 + 5;
pic['__icon__'].addChildAt(light, 0);
egret.Tween.get(light).to({scaleX: 1.5, scaleY: 1.5,}, 200).call(() => {
egret.Tween.get(light).to({ scaleX: 1.5, scaleY: 1.5, }, 200).call(() => {
pic['__icon__'].removeChild(light);
if(index == pics.length - 1){
if (index == pics.length - 1) {
showToast('铃铛隐藏在任意关卡中,快去找他们吧~');
}
});
......@@ -1118,9 +1126,9 @@ export default class MapScene extends Scene {
}
}
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;
}
\ 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