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

View File

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

View File

@ -1,4 +1,5 @@
const jcgamelog = require('../../jcfw/service/jcgamelog');
const NetManage = require('../../manages/NetManage');
const { operation, OperationType } = require('../../Operation/Operation');
cc.Class({
@ -17,6 +18,24 @@ cc.Class({
default: null,
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:
@ -26,9 +45,48 @@ cc.Class({
},
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');
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() {
cc.Notifier.off('clickrankhero', this);
},
@ -45,22 +103,7 @@ cc.Class({
);
},
start() {
var data = JSON.parse(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,
});
}
this.initTable(this.rankData);
},
onclose() {
this.node.destroy();

View File

@ -635,4 +635,14 @@ module.exports = {
.addKV("name", name);
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);
},
};