Commit 0a4b334d authored by wildfirecode's avatar wildfirecode

1

parent f466d79e
...@@ -192,10 +192,8 @@ export default class MapScene extends Scene { ...@@ -192,10 +192,8 @@ export default class MapScene extends Scene {
this['avatar'].visible = true; this['avatar'].visible = true;
const { data } = DataManager.ins.getData('hc_userInfo'); const { data } = DataManager.ins.getData('hc_userInfo');
this['avatar'].source = data.avatar; this['avatar'].source = data.avatar;
const max = 4;
if (data.nickname.length > max) this['nameTxt'].text = getNick(data.nickname);
data.nickname = data.nickname.slice(0, max) + '...';
this['nameTxt'].text = data.nickname;
}); });
} }
...@@ -555,3 +553,10 @@ export default class MapScene extends Scene { ...@@ -555,3 +553,10 @@ export default class MapScene extends Scene {
get skinKey() { return 'Map' } get skinKey() { return 'Map' }
} }
export const getNick = (nickname) => {
if(!nickname) return nickname;
const max = 4;
if (nickname.length > max)
return nickname.slice(0, max) + '...';
return nickname;
}
\ No newline at end of file
import getSkinPath from "../../libs/new_wx/utils/getSkinPath"; import getSkinPath from "../../libs/new_wx/utils/getSkinPath";
import { getNick } from "../mapScene/MapScene";
export default class FriendItem2Renderer extends eui.ItemRenderer { export default class FriendItem2Renderer extends eui.ItemRenderer {
constructor() { constructor() {
...@@ -8,7 +9,7 @@ export default class FriendItem2Renderer extends eui.ItemRenderer { ...@@ -8,7 +9,7 @@ export default class FriendItem2Renderer extends eui.ItemRenderer {
score: eui.Label; score: eui.Label;
dataChanged() { dataChanged() {
const rank = this.data; const {rank,nickName,avatar,maxScore}= this.data;
this['avatar'].mask = this['avatarMask']; this['avatar'].mask = this['avatarMask'];
...@@ -25,9 +26,11 @@ export default class FriendItem2Renderer extends eui.ItemRenderer { ...@@ -25,9 +26,11 @@ export default class FriendItem2Renderer extends eui.ItemRenderer {
this['rankbg'].visible = true; this['rankbg'].visible = true;
} }
this['nameTxt'].text = this.data + 'name'; this['avatar'].source = avatar
this['nameTxt'].text = getNick(nickName);
this.score.textFlow = (new egret.HtmlTextParser).parser( this.score.textFlow = (new egret.HtmlTextParser).parser(
`分数:<font color=0xff4501><b>${15}</b></font>分`); `分数:<font color=0xff4501><b>${maxScore}</b></font>分`);
} }
} }
\ No newline at end of file
...@@ -2,6 +2,7 @@ import Panel from "../../libs/new_wx/components/Panel"; ...@@ -2,6 +2,7 @@ import Panel from "../../libs/new_wx/components/Panel";
import FriendItemRenderer from "./FriendItemRenderer"; import FriendItemRenderer from "./FriendItemRenderer";
import { NetManager } from "../../libs/tw/manager/NetManager"; import { NetManager } from "../../libs/tw/manager/NetManager";
import { DataManager } from "../../libs/tw/manager/DataManager"; import { DataManager } from "../../libs/tw/manager/DataManager";
import { getNick } from "../mapScene/MapScene";
export default class FriendPanel extends Panel { export default class FriendPanel extends Panel {
public list: eui.List; public list: eui.List;
...@@ -39,11 +40,9 @@ export default class FriendPanel extends Panel { ...@@ -39,11 +40,9 @@ export default class FriendPanel extends Panel {
this['avatar0'].visible = true; this['avatar0'].visible = true;
const { data } = DataManager.ins.getData('hc_userInfo'); const { data } = DataManager.ins.getData('hc_userInfo');
this['avatar'].source = this['avatar0'].source = data.avatar; this['avatar'].source = this['avatar0'].source = data.avatar;
const max = 4;
if (data.nickname.length > max) this['nameTxt'].text = getNick(data.nickname);
data.nickname = data.nickname.slice(0, max) + '...'; this['nameTxt0'].text = getNick(data.nickname);
this['nameTxt'].text = data.nickname;
this['nameTxt0'].text = data.nickname;
}); });
} }
......
...@@ -18,6 +18,7 @@ import { ElementType } from "../something/enum/ElementType"; ...@@ -18,6 +18,7 @@ import { ElementType } from "../something/enum/ElementType";
import { PassType } from "../something/enum/PassType"; import { PassType } from "../something/enum/PassType";
import FriendItem2Renderer from "./FriendItem2Renderer"; import FriendItem2Renderer from "./FriendItem2Renderer";
import TargetItemRenderer from "./TargetItemRenderer"; import TargetItemRenderer from "./TargetItemRenderer";
import { DataManager } from "../../libs/tw/manager/DataManager";
export default class StartPanel extends Panel { export default class StartPanel extends Panel {
private _level; private _level;
...@@ -25,14 +26,18 @@ export default class StartPanel extends Panel { ...@@ -25,14 +26,18 @@ export default class StartPanel extends Panel {
public friendlist: eui.List; public friendlist: eui.List;
start(data) { start(data) {
super.start(); super.start();
this.friendlist.useVirtualLayout = false; this.friendlist.useVirtualLayout = false;
this.friendlist.itemRenderer = FriendItem2Renderer; this.friendlist.itemRenderer = FriendItem2Renderer;
const friends = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; this.friendlist.visible = false;
if (friends.length > 5)
friends.length = 5; NetManager.ins.hc_levelNumRank(() => {
const ac = new eui.ArrayCollection(friends); this.friendlist.visible = true;
this.friendlist.dataProvider = ac; 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;
}, data)
setGlow(this['levelTxt'], 0xfa4b09, 1); setGlow(this['levelTxt'], 0xfa4b09, 1);
this['levelTxt'].text = `第${data}关`; this['levelTxt'].text = `第${data}关`;
......
...@@ -3,6 +3,9 @@ const config = { ...@@ -3,6 +3,9 @@ const config = {
'/customActivity/happyclear/userInfo': { '/customActivity/happyclear/userInfo': {
data: './happyclear/userInfo.json' data: './happyclear/userInfo.json'
}, },
'/customActivity/happyclear/levelNumRank': {
data: './happyclear/levelNumRank.json'
},
'/customActivity/happyclear/mapRank': { '/customActivity/happyclear/mapRank': {
data: './happyclear/mapRank.json' data: './happyclear/mapRank.json'
}, },
......
{
"success": true,
"code": null,
"desc": null,
"timestamp": 1566199822308,
"data": [
{
"nickName": "奈何本人没文化,一句卧槽行天下",
"avatar": "http://yun.dui88.com/images/201604/c6s5l4dgea.jpg",
"stars": 1,
"maxScore": 11,
"rank": "1"
},
{
"nickName": "2奈何本人没文化,一句卧槽行天下",
"avatar": "http://yun.dui88.com/images/201604/c6s5l4dgea.jpg",
"stars": 1,
"maxScore": 22,
"rank": "2"
},
{
"nickName": "3奈何本人没文化,一句卧槽行天下",
"avatar": "http://yun.dui88.com/images/201604/c6s5l4dgea.jpg",
"stars": 1,
"maxScore": 333,
"rank": "3"
},
{
"nickName": "4奈何本人没文化,一句卧槽行天下",
"avatar": "http://yun.dui88.com/images/201604/c6s5l4dgea.jpg",
"stars": 1,
"maxScore": 44444,
"rank": "4"
},
{
"nickName": "5奈何本人没文化,一句卧槽行天下",
"avatar": "http://yun.dui88.com/images/201604/c6s5l4dgea.jpg",
"stars": 1,
"maxScore": 123,
"rank": "5"
},
{
"nickName": "6奈何本人没文化,一句卧槽行天下",
"avatar": "http://yun.dui88.com/images/201604/c6s5l4dgea.jpg",
"stars": 1,
"maxScore": 555555,
"rank": "6"
}
]
}
\ 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