Files
fc/dev/project/assets/Scripts/mod/pvp/crosschampion/cmp/cmp.cchampion.final.wnd.js
T
2026-05-23 22:10:14 +08:00

193 lines
6.6 KiB
JavaScript

const BridgeWindow = require("bridge.window");
const crosschampion = require("crosschampion_controller");
const CampfightMod = require( "campfight.mod" )
const RoleController = require( "role_controller" );
const RoleEvent = require( "role_event" );
const ChatController = require( "chat_controller" );
cc.Class({
extends: BridgeWindow,
properties: {
nodSelfInfo: { type: cc.Node, default: null },
nodInfo: { type: cc.Node, default: null },
nodTopThree: { type: cc.Node, default: null },
},
onLoad : function(){
this.bindGEvent( RoleEvent.WorshipOtherRole, this.freshOneWorship.bind(this) );
},
onOpenConfigs( _params ) {
nx.storage.set( "CChampionPro", 1 );
let datata = _params;
let strdesc = nx.text.getKey( "WeeklyCrossChampionTitle" );
if( _params.show == 99 ){
datata = crosschampion.getInstance().getModel().getThreeDatas();
}
if( _params.show == 100 ){
datata = CampfightMod.getInstance().topthree;
datata.rank_list = datata;
strdesc = nx.text.getKey( "CampFitTopThree" );
}
nx.gui.setString( this, "panel/desc/txt", strdesc );
let showInfo = datata;
let showHeader = 0;
if( !showInfo.rank_list ){
nx.gui.setString( this.nodSelfInfo, "bg/rank", nx.text.format( "ladder_god_log_item_tip3", showInfo.rank ) );
nx.gui.setString( this.nodSelfInfo, "bg/cnum", nx.text.getKey( "lab_eleChangeNum" ) + showInfo.cnum );
nx.gui.setString( this.nodSelfInfo, "bg/wnum", nx.text.format( "WinTimes", showInfo.win ) );
}else{
let ufg = game.configs.looks_data.data_data;
if( nx.dt.arrNEmpty( showInfo.rank_list ) ){
let shows = showInfo.rank_list;
for (let i = 0; i < shows.length; i++) {
let info = shows[i];
let nod = this.nodTopThree.children[i];
if( info.face ){
nod = this.nodInfo.children[i];
showHeader++;
}
let cmp = nx.gui.getComponent( nod, "avatar", "cmp.common.header" );
if( cmp ){
cmp.setData( {
face: info.face,
avatar: 1000,
} )
}
let spcmp = nx.gui.getComponent( nod, "spine", "nx.fx.spine" );
if( spcmp ){
let model = "";
if( ufg[info.lookid] ){
model = PathTool.getSpinePath( ufg[info.lookid].model, ufg[info.lookid].model, false );
}
if( nx.dt.strNEmpty( model ) ){
// 战斗迷你
spcmp.load( model, ( _e ) => {
if( !_e ) {
spcmp.action( "stand2", true );
} else {
spcmp.stop();
}
} );
}
}
let servers = nx.dt.strEmpty( info.srv_id ) ? [0,1] : info.srv_id.split( "_" );
let nodwor = nx.gui.find( nod, "wor" );
nodwor.info = {
rid : info.rid,
worship : info.worship,
worship_status : info.worship_status,
rank : info.rank,
};
nx.gui.setString( nod, "base/server", "[" + nx.text.format( "Srever" , servers[1] ) + "]" );
nx.gui.setString( nod, "base/name", info.name );
nx.gui.setString( nod, "level", nx.text.format( "LvNumber", info.lev ) );
nx.gui.setString( nod, "wor/worship", info.worship );
let nodlook = nx.gui.find( nod, "look" );
nodlook.info = {
srv_id : info.srv_id,
rid: info.rid
}
let bcmp = nx.gui.getComponent( nod, "wor", cc.Button );
if( bcmp ){
bcmp.interactable = info.worship_status == 0;
}
// nx.gui.setActive( nodlook, "", nx.dt.strNEmpty( info.srv_id ) );
}
}
}
nx.gui.setActive( this.nodSelfInfo, "", !showInfo.rank_list );
// 获取膜拜信息等
nx.gui.setActive( this.nodInfo, "", showInfo.rank_list && showHeader > 0 );
nx.gui.setActive( this.nodTopThree, "", showInfo.rank_list && showHeader == 0 );
},
// 重载:关闭前
onPreClosed: function () {
nx.bridge.mainui.racewnd = null;
nx.bridge.mainui.isracing = false;
},
freshOneWorship : function( _data ){
let chd = this.nodTopThree.children;
// {"code":1,"msg":"","type":0,"rid":79,"srv_id":"dev_2","idx":7}
for (let i = 0; i < chd.length; i++) {
let nod = chd[i];
let nodwor = nx.gui.find( nod, "wor" );
if( nodwor ){
if( nodwor.info.rid == _data.rid ){
let worship = nodwor.info.worship + 1;
nx.gui.setString( nodwor, "worship", worship );
let cmp = nx.gui.getComponent( nodwor, "", cc.Button );
if( cmp ){
cmp.interactable = false;
}
}
}
}
},
onTouchWor: function( _btn ){
if( _btn.info.worship_status > 0 ){
nx.tbox( nx.text.getKey( "lab_arena_loop_rank_worshiped" ) );
return;
}
let RC = RoleController.getInstance();
if( RC ){
RC.sender10316( _btn.info.rid, _btn.info.srv_id, _btn.info.rank );
}
},
onTouchLook: function( _btn ){
let srv_id = _btn.info.srv_id;
let rid = _btn.info.rid;
if( nx.dt.strEmpty( srv_id )){
nx.tbox( "GuildBatSeePartnerTip" );
return;
}
ChatController.getInstance().openFriendInfo( { srv_id :srv_id, rid :rid } );
// RoleController.getInstance().requestRoleInfo( rid, srv_id );
},
/***
* [26206]:{"rank":33,"cnum":7,"win":3}
*/
});