Files
fc/dev/project/assets/Scripts/mod/home/base_kernel/cmp.kernel.preview.js
T
2026-05-23 22:10:14 +08:00

98 lines
3.2 KiB
JavaScript

const BridgeWindow = require( "bridge.window" );
const KernelController = require( "halidom_controller" );
cc.Class({
extends: BridgeWindow,
properties: {
nodCampLogo: { default: null, type : cc.Node},
nodAttr: { default: null, type : cc.Node},
nodDesc: { default: null, type : cc.Node},
},
// 重载:参数打开
onOpenConfigs: function( _params ) {
// 需要 陣營, 等級
// // 当前的初始解锁达成状态
let camp = _params.camp;
let path = "";
switch( camp ){
case 1 :{ path = "prefab/home/base_kernel/ui/img_core_blue" }; break;
case 2 :{ path = "prefab/home/base_kernel/ui/img_core_red" }; break;
case 3 :{ path = "prefab/home/base_kernel/ui/img_core_green" }; break;
case 4 :{ path = "prefab/home/base_kernel/ui/img_core_yellow" }; break;
case 5 :{ path = "prefab/home/base_kernel/ui/img_core_puple" }; break;
}
let diffLog = cc.path.join( "prefab/home/ui/png_logo_" + camp );
nx.gui.setSpriteFrame( this.nodCampLogo, "", diffLog );
let attrsfg = game.configs.halidom_data.data_lvup[camp][100];
let desc = game.configs.halidom_data.data_base[camp].msc;
nx.gui.setString( this.nodDesc, "", desc );
for (let i = 0; i < this.nodAttr.children.length; i++) {
let nod = this.nodAttr.children[i];
nx.bridge.attrs.setAttribute( nod, [ attrsfg.attr[i][0],attrsfg.attr[i][1], i + 1 ] );
}
// this.info = _params;
// // this.cb = _params.cb;
// // 道具刷新
// this.freshInfo();
},
/*******
* send] >>>[14:27:54][22200]:{}
[22200]:{"list":[{"id":5,"lev":1,"exp":0,"step":0,
"all_attr":[{"name":104,"val":1014},{"name":101,"val":84}]}]}
[22201]:{"id":3,"lev":1,"exp":0,"step":0,
"all_attr":[{"name":104,"val":875},{"name":101,"val":81}]}
*/
freshInfo : function(){
let cfg = game.configs.halidom_data.data_base;
let camp = this.info.id;
let name = cfg[camp].name;
nx.gui.setString( this.nodCamp, "name", name );
let path = "";
if( camp == 1 ){
path = "prefab/home/base_kernel/ui/bg_core_blue";
}
if( camp == 2 ){
path = "prefab/home/base_kernel/ui/bg_core_red";
}
if( camp == 3 ){
path = "prefab/home/base_kernel/ui/bg_core_green";
}
if( camp == 4 ){
path = "prefab/home/base_kernel/ui/bg_core_yellow";
}
if( camp == 5 ){
path = "prefab/home/base_kernel/ui/bg_core_puple";
}
nx.gui.setSpriteFrame( this.nodCamp, "", path );
nx.gui.setSpriteFrame( this.nodCampLogo, "", "prefab/home/ui/png_logo_" + camp );
let arrfg = game.configs.attr_data.data_id_to_name;
for (let i = 0; i < this.info.all_attr.length; i++) {
let attr = this.info.all_attr[i];
let node = this.nodAttr.children[i];
if( attr ){
nx.gui.setString( node, "txt", arrfg[attr.name] + ":" + attr.val );
}
}
nx.gui.setString( this.nodDesc, "", cfg[camp].desc );
},
});