|
@@ -6,43 +6,69 @@ cc.Class({
|
|
scrollView: cc.ScrollView,
|
|
scrollView: cc.ScrollView,
|
|
content: cc.Node,
|
|
content: cc.Node,
|
|
prefabRankItem: cc.Node,
|
|
prefabRankItem: cc.Node,
|
|
- itemScriptName:'',
|
|
|
|
|
|
+ itemScriptName: '',
|
|
},
|
|
},
|
|
|
|
|
|
// LIFE-CYCLE CALLBACKS:
|
|
// LIFE-CYCLE CALLBACKS:
|
|
|
|
|
|
- onLoad () {
|
|
|
|
|
|
+ onLoad() {
|
|
this.listAdapter = new ListViewAdapter(this.scrollView);
|
|
this.listAdapter = new ListViewAdapter(this.scrollView);
|
|
-
|
|
|
|
this.users = [];
|
|
this.users = [];
|
|
|
|
|
|
-
|
|
|
|
|
|
+ //-------------------------------------test--------------------------------------------------------------------------//
|
|
this.mineScore = {
|
|
this.mineScore = {
|
|
- name:"user"+i,
|
|
|
|
- rank:i+1,
|
|
|
|
- score:(100-i*2)
|
|
|
|
|
|
+ nick: "user" + i,
|
|
|
|
+ url: "http://www.psahz.com/uploads/allimg/181006/094Q62X3-2.jpg",
|
|
|
|
+ score: (100 - i * 2)
|
|
};
|
|
};
|
|
|
|
|
|
- this.prefabRankItem.getComponent('RankItem').updateItem(this.mineScore,0);
|
|
|
|
|
|
+ this.prefabRankItem.getComponent('RankItem').updateItem(this.mineScore, 0);
|
|
|
|
|
|
- for(i=0;i<30;i++){
|
|
|
|
|
|
+ for (i = 0; i < 30; i++) {
|
|
this.user = {
|
|
this.user = {
|
|
- name:"user"+i,
|
|
|
|
- rank:i+1,
|
|
|
|
- score:(100-i*2)
|
|
|
|
|
|
+ nick: "user" + i,
|
|
|
|
+ url: "http://www.psahz.com/uploads/allimg/181006/094Q62X3-2.jpg",
|
|
|
|
+ score: (100 - i * 2)
|
|
};
|
|
};
|
|
|
|
|
|
this.users.push(this.user);
|
|
this.users.push(this.user);
|
|
}
|
|
}
|
|
|
|
|
|
this.listAdapter.updateItems(this.users, this.prefabRankItem, this.itemScriptName);
|
|
this.listAdapter.updateItems(this.users, this.prefabRankItem, this.itemScriptName);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //-------------------------------------test--------------------------------------------------------------------------//
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // BK.QQ.getRankListWithoutRoom(attr, order, rankType, function (errCode, cmd, data) {
|
|
|
|
+ // BK.Script.log(1, 1, "getRankListWithoutRoom callback cmd" + cmd + " errCode:" + errCode + " data:" + JSON.stringify(data));
|
|
|
|
+ // // 返回错误码信息
|
|
|
|
+ // if (errCode !== 0) {
|
|
|
|
+ // BK.Script.log(1, 1, '获取排行榜数据失败!错误码:' + errCode);
|
|
|
|
+ // return;
|
|
|
|
+ // }
|
|
|
|
+ // // 解析数据
|
|
|
|
+ // if (data) {
|
|
|
|
+ // for (var i = 0; i < data.data.ranking_list.length; ++i) {
|
|
|
|
+ // var rd = data.data.ranking_list[i];
|
|
|
|
+ // // rd 的字段如下:
|
|
|
|
+ // //var rd = {
|
|
|
|
+ // // url: '', // 头像的 url
|
|
|
|
+ // // nick: '', // 昵称
|
|
|
|
+ // // score: 1, // 分数
|
|
|
|
+ // // selfFlag: false, // 是否是自己
|
|
|
|
+ // //};
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // });
|
|
|
|
+
|
|
},
|
|
},
|
|
|
|
|
|
- start () {
|
|
|
|
|
|
+ start() {
|
|
|
|
|
|
},
|
|
},
|
|
|
|
|
|
- update (dt) {
|
|
|
|
|
|
+ update(dt) {
|
|
if (this.listAdapter) {
|
|
if (this.listAdapter) {
|
|
this.listAdapter.update(dt);
|
|
this.listAdapter.update(dt);
|
|
}
|
|
}
|