Commit dc161287 authored by wildfirecode's avatar wildfirecode

1

parent 849ad0dd
......@@ -1271,7 +1271,7 @@ export class NetManager extends ABNetManager {
public hc_mapRank(callback: Function): void {
const net: INetData = {
name:'mapRank',
name:'hc_mapRank',
uri: window['duiba']+'/customActivity/happyclear/mapRank',
type: 'post',
dataType: 'json',
......
......@@ -61,7 +61,7 @@
</e:List>
<e:Label id="tips" text="在指定步数内消灭目标元素" y="7" size="23" textColor="0x885037" bold="true" horizontalCenter="0"/>
</e:Group>
<e:List id="friendlist" itemRendererSkinName="FriendItem2Skin" horizontalCenter="0" y="973">
<e:List id="friendlist" itemRendererSkinName="FriendItem2Skin" horizontalCenter="0" y="973" visible="false">
<e:ArrayCollection>
<e:Array>
<e:Object a="null"/>
......@@ -75,4 +75,5 @@
<e:HorizontalLayout/>
</e:layout>
</e:List>
<e:Label id="empty" text="该关卡没有好友通关" y="1022" horizontalCenter="0" textColor="0xc33700" size="26"/>
</e:Skin>
\ No newline at end of file
......@@ -6,6 +6,7 @@ export default class AvatarComp extends ComponentBase {
this.touchEnabled=this.touchChildren=false;
super.start(data);
this['avatar'].mask = this['avatarMask'];
this['avatar'].source = data.avatar;
}
get skinKey(): string { return 'Avatar' }
......
......@@ -148,7 +148,7 @@ export default class MapScene extends Scene {
this.updateHomeData();
this.updateAvatars();
this.updateFriends();
this.showLog();
this.updateBox();
......@@ -286,21 +286,25 @@ export default class MapScene extends Scene {
updateScene() {
this.updateHomeData();
}
addAvatar(level, data?) {
addAvatar(level, ele) {
const item = MapScene.starHash[level];
const parent = item.parent;
const avatar = new AvatarComp();
avatar.loadSkin();
avatar.start(data);
avatar.start(ele);
parent.addChild(avatar);
avatar.x = item.x;
avatar.y = item.y - avatar.height;
}
updateAvatars() {
// 4 70
this.addAvatar(4);
this.addAvatar(70);
this.addAvatar(71);
updateFriends() {
NetManager.ins.hc_mapRank(() => {
const { data } = DataManager.ins.getData('hc_mapRank');
data.forEach((ele) => {
this.addAvatar(ele.levelNum,ele.rank[0]);
});
});
}
updateHomeData() {
......@@ -360,7 +364,7 @@ export default class MapScene extends Scene {
}
onTap_inviteBtn() {
NetManager.ins.getInvateInfo((success, res) => {
if(!success || !res.data) {
if (!success || !res.data) {
return;
}
PanelCtrl.instance.show('invite', res.data);
......@@ -559,7 +563,7 @@ export default class MapScene extends Scene {
get skinKey() { return 'Map' }
}
export const getNick = (nickname) => {
if(!nickname) return nickname;
if (!nickname) return nickname;
const max = 4;
if (nickname.length > max)
return nickname.slice(0, max) + '...';
......
......@@ -31,6 +31,6 @@ export default class FriendItem2Renderer extends eui.ItemRenderer {
this['nameTxt'].text = getNick(nickName);
this.score.textFlow = (new egret.HtmlTextParser).parser(
`分数:<font color=0xff4501><b>${maxScore}</b></font>分`);
`<font color=0xff4501><b>${maxScore}</b></font>分`);
}
}
\ No newline at end of file
......@@ -29,14 +29,21 @@ export default class StartPanel extends Panel {
this.friendlist.useVirtualLayout = false;
this.friendlist.itemRenderer = FriendItem2Renderer;
this.friendlist.visible = false;
this['empty'].visible = false;
NetManager.ins.hc_levelNumRank(() => {
this.friendlist.visible = true;
const { data: friends } = DataManager.ins.getData('hc_levelNumRank');
if (friends.length > 5)
friends.length = 5;
const ac = new eui.ArrayCollection(friends);
this.friendlist.dataProvider = ac;
if(friends && friends.length > 0 ) {
this.friendlist.visible = true;
if (friends.length > 5)
friends.length = 5;
const ac = new eui.ArrayCollection(friends);
this.friendlist.dataProvider = ac;
}
else {
this['empty'].visible = true;
}
}, data)
setGlow(this['levelTxt'], 0xfa4b09, 1);
......
const path = require('path');
const config = {
'/customActivity/happyclear/totalNumRank': {
data: './happyclear/totalNumRank.json'
},
'/customActivity/happyclear/userInfo': {
data: './happyclear/userInfo.json'
},
......
......@@ -8,28 +8,28 @@
"nickName": "奈何本人没文化,一句卧槽行天下",
"avatar": "http://yun.dui88.com/images/201604/c6s5l4dgea.jpg",
"stars": 1,
"maxScore": 11,
"maxScore": 1234567,
"rank": "1"
},
{
"nickName": "2奈何本人没文化,一句卧槽行天下",
"avatar": "http://yun.dui88.com/images/201604/c6s5l4dgea.jpg",
"stars": 1,
"maxScore": 22,
"maxScore": 1234567,
"rank": "2"
},
{
"nickName": "3奈何本人没文化,一句卧槽行天下",
"avatar": "http://yun.dui88.com/images/201604/c6s5l4dgea.jpg",
"stars": 1,
"maxScore": 333,
"maxScore": 1234567,
"rank": "3"
},
{
"nickName": "4奈何本人没文化,一句卧槽行天下",
"avatar": "http://yun.dui88.com/images/201604/c6s5l4dgea.jpg",
"stars": 1,
"maxScore": 44444,
"maxScore": 1234567,
"rank": "4"
},
{
......
......@@ -5,11 +5,35 @@
"timestamp":1566199822308,
"data":[
{
"levelNum":1,
"levelNum":4,
"rank":[
{
"nickName":"昵称",
"avatar":"头像",
"avatar":"http://yun.dui88.com/images/201604/c6s5l4dgea.jpg",
"stars":1,
"maxScore":123,
"rank":"排名"
}
]
},
{
"levelNum":70,
"rank":[
{
"nickName":"昵称",
"avatar":"http://yun.dui88.com/images/201604/c6s5l4dgea.jpg",
"stars":1,
"maxScore":123,
"rank":"排名"
}
]
},
{
"levelNum":71,
"rank":[
{
"nickName":"昵称",
"avatar":"http://yun.dui88.com/images/201604/c6s5l4dgea.jpg",
"stars":1,
"maxScore":123,
"rank":"排名"
......
{
"success": true,
"code": null,
"desc": null,
"timestamp": 1566199822308,
"data": {
"user": {
"levelNum": 1,
"nickName": "3奈何本人没文化,一句卧槽行天下",
"avatar": "http://yun.dui88.com/images/201604/c6s5l4dgea.jpg",
"stars": 1,
"maxScore": 1234567,
"rank": 1
},
"list":[
{
"levelNum": 1,
"nickName": "3奈何本人没文化,一句卧槽行天下",
"avatar": "http://yun.dui88.com/images/201604/c6s5l4dgea.jpg",
"stars": 1,
"maxScore": 1234567,
"rank": 1
},
{
"levelNum": 1,
"nickName": "3奈何本人没文化,一句卧槽行天下",
"avatar": "http://yun.dui88.com/images/201604/c6s5l4dgea.jpg",
"stars": 1,
"maxScore": 1234567,
"rank": 1
},
{
"levelNum": 1,
"nickName": "3奈何本人没文化,一句卧槽行天下",
"avatar": "http://yun.dui88.com/images/201604/c6s5l4dgea.jpg",
"stars": 1,
"maxScore": 1234567,
"rank": 1
},
{
"levelNum": 1,
"nickName": "3奈何本人没文化,一句卧槽行天下",
"avatar": "http://yun.dui88.com/images/201604/c6s5l4dgea.jpg",
"stars": 1,
"maxScore": 1234567,
"rank": 1
},
{
"levelNum": 1,
"nickName": "3奈何本人没文化,一句卧槽行天下",
"avatar": "http://yun.dui88.com/images/201604/c6s5l4dgea.jpg",
"stars": 1,
"maxScore": 1234567,
"rank": 1
}
]
}
}
\ 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