add second rank

This commit is contained in:
guoqing.zhu 2022-05-30 17:33:30 +08:00
parent 19751ba3d4
commit 73022c1d8c
4 changed files with 98 additions and 29 deletions

View File

@ -1731,7 +1731,7 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 41, "width": 110,
"height": 28 "height": 28
}, },
"_anchorPoint": { "_anchorPoint": {
@ -2459,10 +2459,12 @@
}, },
{ {
"__type__": "cc.ClickEvent", "__type__": "cc.ClickEvent",
"target": null, "target": {
"__id__": 1
},
"component": "", "component": "",
"_componentId": "55dadiCkx9MBJ4P07bCUnLB", "_componentId": "edcc4x5mGVLhpXyDw8n3EfX",
"handler": "onclicktype", "handler": "onClickFirstRank",
"customEventData": "0" "customEventData": "0"
}, },
{ {
@ -2511,7 +2513,7 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 41, "width": 110,
"height": 28 "height": 28
}, },
"_anchorPoint": { "_anchorPoint": {
@ -3239,10 +3241,12 @@
}, },
{ {
"__type__": "cc.ClickEvent", "__type__": "cc.ClickEvent",
"target": null, "target": {
"__id__": 1
},
"component": "", "component": "",
"_componentId": "55dadiCkx9MBJ4P07bCUnLB", "_componentId": "edcc4x5mGVLhpXyDw8n3EfX",
"handler": "onclicktype", "handler": "onClickSecondRank",
"customEventData": "1" "customEventData": "1"
}, },
{ {
@ -8759,6 +8763,15 @@
"spine_hero": { "spine_hero": {
"__id__": 247 "__id__": 247
}, },
"nd_btn1": {
"__id__": 48
},
"nd_btn2": {
"__id__": 70
},
"tableContent": {
"__id__": 165
},
"_id": "" "_id": ""
}, },
{ {

View File

@ -19,11 +19,12 @@ export var allBaseNet = {
isDevEnv(); isDevEnv();
function isDevEnv() { function isDevEnv() {
var toreturn = false return true
if(cc.debug){ // var toreturn = false
return true; // if(cc.debug){
} // return true;
return toreturn // }
// return false
} }
if (isDevEnv()) { if (isDevEnv()) {
@ -33,6 +34,8 @@ if (isDevEnv()) {
singapore: '-test.kingsome.cn', singapore: '-test.kingsome.cn',
turkey: '-test-kingsome.cn', turkey: '-test-kingsome.cn',
}; };
}else{
console.log("正式服")
} }
const netIdHash = (function () { const netIdHash = (function () {

View File

@ -1,4 +1,5 @@
const jcgamelog = require('../../jcfw/service/jcgamelog'); const jcgamelog = require('../../jcfw/service/jcgamelog');
const NetManage = require('../../manages/NetManage');
const { operation, OperationType } = require('../../Operation/Operation'); const { operation, OperationType } = require('../../Operation/Operation');
cc.Class({ cc.Class({
@ -17,6 +18,24 @@ cc.Class({
default: null, default: null,
type: sp.Skeleton, type: sp.Skeleton,
}, },
nd_btn1:{
default: null,
type: cc.Node,
},
nd_btn2:{
default: null,
type: cc.Node,
},
tableContent:{
default:null,
type:cc.Node
}
}, },
// LIFE-CYCLE CALLBACKS: // LIFE-CYCLE CALLBACKS:
@ -26,9 +45,48 @@ cc.Class({
}, },
onLoad() { onLoad() {
// set can open
NetManage.getRankOpenList((res)=>{
var rankList = res.list;
if(rankList.includes(2) && this.nd_btn2) this.nd_btn2.active = true;
});
jcgamelog.addOperation(OperationType.BUTTON, 'get into rank'); jcgamelog.addOperation(OperationType.BUTTON, 'get into rank');
cc.Notifier.on('clickrankhero', this, this.clickrankhero.bind(this)); cc.Notifier.on('clickrankhero', this, this.clickrankhero.bind(this));
}, },
onClickFirstRank(){
NetManage.getactivityRankingList(1, (data) => {
this.initTable(JSON.stringify(data));
});
},
onClickSecondRank(){
NetManage.getactivityRankingList(2, (data) => {
this.initTable(JSON.stringify(data));
});
},
initTable(rankData){
this.tableContent.destroyAllChildren();
var data = JSON.parse(rankData);
this.nd_my.getComponent('cellRank').initdata(data.my_ranked);
setTimeout(() => {
this.tableView
.getComponent('tableView')
.initTableView(data.rows.length, {
array: data.rows,
target: this,
});
if (data.rows.length > 0) {
cc.Notifier.emit('clickrankhero', {
account_id: data.rows[0].user.account_id,
hero_id: data.rows[0].user.hero_id,
});
}
}, 100);
},
onDestroy() { onDestroy() {
cc.Notifier.off('clickrankhero', this); cc.Notifier.off('clickrankhero', this);
}, },
@ -45,22 +103,7 @@ cc.Class({
); );
}, },
start() { start() {
var data = JSON.parse(this.rankData); this.initTable(this.rankData);
this.nd_my.getComponent('cellRank').initdata(data.my_ranked);
this.tableView
.getComponent('tableView')
.initTableView(data.rows.length, {
array: data.rows,
target: this,
});
if (data.rows.length > 0) {
cc.Notifier.emit('clickrankhero', {
account_id: data.rows[0].user.account_id,
hero_id: data.rows[0].user.hero_id,
});
}
}, },
onclose() { onclose() {
this.node.destroy(); this.node.destroy();

View File

@ -635,4 +635,14 @@ module.exports = {
.addKV("name", name); .addKV("name", name);
this.getResponce(cb, this.urlbd); this.getResponce(cb, this.urlbd);
}, },
getRankOpenList(cb) {
this.urlbd.clear();
this.urlbd
.addKV("c", "Ranking")
.addKV("a", "getOpenList")
.addKV("account_id", this.account_id)
.addKV("session_id", this.session_id)
this.getResponce(cb, this.urlbd);
},
}; };