Files
fc/dev/project/assets/Scripts/mod/rank/cmp.rank.main.wnd.js
T

73 lines
1.5 KiB
JavaScript
Raw Normal View History

2026-05-23 22:10:14 +08:00
const BridgeWindow = require("bridge.window");
const RankEvent = require("rank_event");
const RankController = require("rank_controller");
cc.Class({
extends: BridgeWindow,
properties: {
nodRank: {
default : null,
type : cc.Node,
}
},
onLoad: function () {
this.bindGEvent(RankEvent.RankEvent_Get_First_data, this.updateRankList.bind(this));
},
onOpenConfigs: function( _params ) {
this.unscheduleAllCallbacks();
let RC = RankController.getInstance();
RC.send_12902();
this.scheduleOnce( ()=> {
this.updateRankList();
},0.3);
},
// 重载:关闭前
onPreClosed: function () {
},
// 排名更新
updateRankList: function () {
const model = RankController.getInstance();
const lst = model.getFirstRankList();
if(!lst ){
nx.bridge.closePanel( "WndRank" );
return;
}
if( lst ){
lst.rank_list.sort( Utils.tableLowerSorter( [ "type" ] ));
nx.gui.gocChildren( this.nodRank, "", lst.rank_list.length );
let chd = this.nodRank.children;
for (let i = 0; i < chd.length; i++) {
let item = chd[i];
let data = lst.rank_list[i];
let cmp = item.getComponent( "cmp.rank.item" );
if( cmp ){
cmp.freshBase( data );
}
}
}
},
});