Commit eb6316d9 authored by 邱旭's avatar 邱旭

1

parents b5305459 1b9d4977
......@@ -1269,11 +1269,25 @@ export class NetManager extends ABNetManager {
this.send(net);
}
public hc_totalNumRank(callback: Function): void {
const net: INetData = {
name:'hc_totalNumRank',
uri: window['duiba']+'/customActivity/happyclear/totalNumRank',
type: 'get',
dataType: 'json',
param: {
activityId: DataManager.ins.customCfgData.actId
},
hideMsg:true,
callback: callback
};
this.send(net);
}
public hc_mapRank(callback: Function): void {
const net: INetData = {
name:'mapRank',
name:'hc_mapRank',
uri: window['duiba']+'/customActivity/happyclear/mapRank',
type: 'post',
type: 'get',
dataType: 'json',
param: {
activityId: DataManager.ins.customCfgData.actId
......@@ -1303,7 +1317,7 @@ export class NetManager extends ABNetManager {
const net: INetData = {
name:'hc_userInfo',
uri: window['duiba']+'/customActivity/happyclear/userInfo',
type: 'post',
type: 'get',
dataType: 'json',
param: {
activityId: DataManager.ins.customCfgData.actId
......
......@@ -4,7 +4,7 @@
<e:Label id="nameTxt" text="Label" y="89.5" size="16" textColor="0x784325" horizontalCenter="0.5"/>
<e:Label text="分数:12345分" y="115.29" id="score" size="16" anchorOffsetX="0" anchorOffsetY="0" textColor="0x784325" horizontalCenter="0.5"/>
<e:Group x="22" y="14">
<e:Image id="avatar" y="0" source="testavatar_png" width="64" height="64" x="0"/>
<e:Image id="avatar" y="0" width="64" height="64" x="0" source=""/>
<e:Rect id="avatarMask" width="64" height="64" y="0" ellipseWidth="64" ellipseHeight="64"/>
</e:Group>
<e:Group x="8">
......
......@@ -7,7 +7,7 @@
<e:Label text="第15关" x="189" y="54.29" id="progress" size="24" textColor="0x784325"/>
<e:Label text="分数:123分" x="297" y="54.29" id="score" size="24" anchorOffsetX="0" anchorOffsetY="0" textColor="0x784325"/>
<e:Group x="108.87" y="23.79">
<e:Image id="avatar" y="0" source="testavatar_png" width="60" height="60" x="0"/>
<e:Image id="avatar" y="0" width="60" height="60" x="0" source=""/>
<e:Rect id="avatarMask" width="60" height="60" y="0" ellipseWidth="60" ellipseHeight="60"/>
</e:Group>
<e:Group x="10" y="16">
......
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="FriendSkin" width="750" height="1206" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image source="friendbg_png" y="31" horizontalCenter="1"/>
<e:Label id="star" text="X55" x="597.94" y="329.79" size="24"/>
<e:Label id="star" text="X0" x="597.94" y="329.79" size="24"/>
<e:Button id="closeBtn" label="" x="632.94" y="164.98">
<e:skinName>
<e:Skin states="up,down,disabled" xmlns:w="http://ns.egret.com/wing">
......@@ -12,7 +12,7 @@
</e:Button>
<e:Scroller id="scroll" width="546" height="555" y="412.35" scrollPolicyV="on" scrollPolicyH="off" x="122">
<e:Group>
<e:List id="list" width="100%" itemRendererSkinName="FriendItemSkin">
<e:List id="list" width="100%" itemRendererSkinName="FriendItemSkin" visible="false">
<e:ArrayCollection>
<e:Array>
<e:Object a="taskname1"/>
......@@ -42,16 +42,17 @@
</e:skinName>
</e:Button>
<e:Group x="323.87" y="104.79">
<e:Image id="avatar" y="0" source="testavatar_png" width="120" height="120" x="0"/>
<e:Image id="avatar" y="0" width="120" height="120" x="0" source=""/>
<e:Rect id="avatarMask" width="120" height="120" y="0" ellipseWidth="120" ellipseHeight="120"/>
</e:Group>
<e:Group x="226.87" y="308.79">
<e:Image id="avatar0" y="0" source="testavatar_png" width="60" height="60" x="0"/>
<e:Image id="avatar0" y="0" width="60" height="60" x="0" source=""/>
<e:Rect id="avatarMask0" width="60" height="60" y="0" ellipseWidth="60" ellipseHeight="60"/>
</e:Group>
<e:Label id="nameTxt0" text="nickname" y="245" textColor="0x784325" horizontalCenter="6.5"/>
<e:Label id="rankTxt" text="73" x="112" y="311" width="86" textAlign="center" verticalAlign="middle" height="52" size="48"/>
<e:Label id="nameTxt" text="Label" x="306" y="307" size="24"/>
<e:Label id="progress" text="第15关" x="306" y="340.79" size="24"/>
<e:Label id="score" text="分数:123分" x="414" y="340.79" size="24" anchorOffsetX="0" anchorOffsetY="0"/>
<e:Label id="rankTxt" text="0" x="112" y="311" width="86" textAlign="center" verticalAlign="middle" height="52" size="48"/>
<e:Label id="nameTxt" text="-" x="306" y="307" size="24"/>
<e:Label id="progress" text="第0关" x="306" y="340.79" size="24"/>
<e:Label id="score" text="分数:0分" x="414" y="340.79" size="24" anchorOffsetX="0" anchorOffsetY="0"/>
<e:Label id="empty" text="您还没有好友" y="636" textColor="0x784325" horizontalCenter="6.5"/>
</e:Skin>
\ No newline at end of file
......@@ -5,7 +5,7 @@
<e:Group id="scrollGroup">
</e:Group>
</e:Scroller>
<e:Group id="treasureboxBtn" y="-3.06" x="467.84">
<e:Group id="treasureboxBtn" y="-3.06" x="516.26" scaleX="0.8" scaleY="0.8">
<e:Image source="宝箱bg_png" y="22"/>
<e:Group x="41.08" y="45.48">
<e:Rect id="rect" width="124" height="45" x="0" y="0" visible="false"/>
......@@ -20,7 +20,7 @@
<e:Label id="boxNumsTxt" text="0" x="0" verticalAlign="middle" textAlign="center" size="18" width="46" y="6.14"/>
</e:Group>
</e:Group>
<e:Group id="top" x="36" y="24">
<e:Group id="top" x="167.04" y="18.05" scaleX="0.8" scaleY="0.8">
<e:Image source="元宝bg_png" x="0" y="0"/>
<e:Label id="bloodTxt" text="5" x="12.71" y="22.84" width="49" verticalAlign="middle" textAlign="center" size="36"/>
<e:Label id="fullTxt" text="已满" x="76.71" y="29.84" width="82" verticalAlign="middle" textAlign="center" size="24" visible="false"/>
......@@ -67,7 +67,7 @@
</e:Skin>
</e:skinName>
</e:Button>
<e:Group id="friendBtn" x="13.56" y="126.88" width="171" height="120">
<e:Group id="friendBtn" x="5.96" y="22.31" width="171" height="120">
<e:Image source="avatar_png" y="0" horizontalCenter="0"/>
<e:Group x="38.5" y="10">
<e:Image id="avatar" y="0" source="testavatar_png" width="96" height="96" x="0"/>
......@@ -85,7 +85,7 @@
</e:Skin>
</e:skinName>
</e:Button>
<e:Group id="inviteGroup" x="32" y="265.37">
<e:Group id="inviteGroup" x="24.4" y="163.76">
<e:Button id="inviteBtn" label="" x="0" y="1.54">
<e:skinName>
<e:Skin states="up,down,disabled">
......
......@@ -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();
......@@ -288,23 +288,38 @@ export default class MapScene extends Scene {
updateScene() {
this.updateHomeData();
}
<<<<<<< HEAD
addAvatar(level, data?) {
=======
addAvatar(level, ele) {
>>>>>>> 1b9d497733f7cbfe7761bf3b695a3c602abebc61
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;
}
<<<<<<< HEAD
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]);
});
});
>>>>>>> 1b9d497733f7cbfe7761bf3b695a3c602abebc61
}
updateHomeData() {
......@@ -367,7 +382,7 @@ export default class MapScene extends Scene {
onTap_inviteBtn() {
NetManager.ins.getInvateInfo((success, res) => {
if(!success || !res.data) {
if (!success || !res.data) {
return;
}
let flag = res.data.completeFlag;
......@@ -594,7 +609,7 @@ export default class MapScene extends Scene {
}
}
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
import getSkinPath from "../../libs/new_wx/utils/getSkinPath";
import { getNick } from "../mapScene/MapScene";
export default class FriendItemRenderer extends eui.ItemRenderer {
constructor() {
......@@ -8,8 +9,7 @@ export default class FriendItemRenderer extends eui.ItemRenderer {
progress: eui.Label;
score: eui.Label;
dataChanged() {
const rank = this.data;
const rank = this.data.rank;
this['avatar'].mask = this['avatarMask'];
this['rank1'].visible = this['rank2'].visible = this['rank3'].visible = this['rankTxt'].visible = false;
......@@ -24,10 +24,12 @@ export default class FriendItemRenderer extends eui.ItemRenderer {
this['rankTxt'].visible = true;
}
this['nameTxt'].text = this.data + 'name';
this['nameTxt'].text = getNick(this.data.nickName) ;
this['avatar'].source = this.data.avatar;
this['star'].text = `X${this.data.stars}`;
this.progress.textFlow = (new egret.HtmlTextParser).parser(
`第<font color=0xff4501><b>${15}</b></font>关`);
`第<font color=0xff4501><b>${this.data.levelNum}</b></font>关`);
this.score.textFlow = (new egret.HtmlTextParser).parser(
`分数:<font color=0xff4501><b>${15}</b></font>分`);
`<font color=0xff4501><b>${this.data.maxScore}</b></font>分`);
}
}
\ No newline at end of file
......@@ -11,22 +11,38 @@ export default class FriendPanel extends Panel {
start(data) {
super.start();
this.showlog();
this['btn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTapInvite, this);
this['avatar'].mask = this['avatarMask'];
this['avatar0'].mask = this['avatarMask0'];
this.list.useVirtualLayout = false;
this.list.itemRenderer = FriendItemRenderer;
this.updateMyInfo();
this.list.visible = false;
this['empty'].visible = false;
NetManager.ins.hc_totalNumRank(() => {
const { data: hc_totalNumRank } = DataManager.ins.getData('hc_totalNumRank');
const { list, user } = hc_totalNumRank;
if (user) {
this.progress.textFlow = (new egret.HtmlTextParser).parser(
`第<font color=0xfff000><b>${15}</b></font>关`);
`第<font color=0xfff000><b>${user.levelNum}</b></font>关`);
this.score.textFlow = (new egret.HtmlTextParser).parser(
`分数:<font color=0xfff000><b>${15}</b></font>分`);
`<font color=0xfff000><b>${user.maxScore}</b></font>分`);
this['rankTxt'].text = user.rank
this['star'].text = `X${user.stars}`
}
this['avatar'].mask = this['avatarMask'];
this['avatar0'].mask = this['avatarMask0'];
this.list.useVirtualLayout = false;
this.list.itemRenderer = FriendItemRenderer;
const ac = new eui.ArrayCollection([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
if (list && list.length > 0) {
this.list.visible = true;
this['empty'].visible = false;
const ac = new eui.ArrayCollection(list);
this.list.dataProvider = ac;
this['btn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTapInvite, this);
} else {
this.list.visible = false;
this['empty'].visible = true;
}
})
}
private updateMyInfo() {
......
......@@ -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 && 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": 555,
"nickName": "奈何本人没文化,一句卧槽行天下",
"avatar": "http://yun.dui88.com/images/201604/c6s5l4dgea.jpg",
"stars": 666,
"maxScore": 1234567,
"rank": 123
},
"list":[
{
"levelNum": 11,
"nickName": "1奈何本人没文化,一句卧槽行天下",
"avatar": "http://yun.dui88.com/images/201604/c6s5l4dgea.jpg",
"stars": 11,
"maxScore": 111111,
"rank": 1
},
{
"levelNum": 22,
"nickName": "2奈何本人没文化,一句卧槽行天下",
"avatar": "http://yun.dui88.com/images/201604/c6s5l4dgea.jpg",
"stars": 22,
"maxScore": 222222,
"rank": 2
},
{
"levelNum": 33,
"nickName": "3奈何本人没文化,一句卧槽行天下",
"avatar": "http://yun.dui88.com/images/201604/c6s5l4dgea.jpg",
"stars": 33,
"maxScore": 33333,
"rank": 3
},
{
"levelNum": 44,
"nickName": "3奈何本人没文化,一句卧槽行天下",
"avatar": "http://yun.dui88.com/images/201604/c6s5l4dgea.jpg",
"stars": 44,
"maxScore": 4444444,
"rank": 4
},
{
"levelNum": 55,
"nickName": "3奈何本人没文化,一句卧槽行天下",
"avatar": "http://yun.dui88.com/images/201604/c6s5l4dgea.jpg",
"stars": 55,
"maxScore": 1234567,
"rank": 5
},
{
"levelNum": 55,
"nickName": "3奈何本人没文化,一句卧槽行天下",
"avatar": "http://yun.dui88.com/images/201604/c6s5l4dgea.jpg",
"stars": 55,
"maxScore": 1234567,
"rank": 5
},
{
"levelNum": 9999,
"nickName": "99奈何本人没文化,一句卧槽行天下",
"avatar": "http://yun.dui88.com/images/201604/c6s5l4dgea.jpg",
"stars": 55,
"maxScore": 1234567,
"rank": 999
}
]
}
}
\ 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