65 lines
1.9 KiB
JavaScript
65 lines
1.9 KiB
JavaScript
/******************************************************************
|
|
*
|
|
* 伙伴属性详情界面
|
|
*
|
|
******************************************************************/
|
|
|
|
const BridgeWindow = require( "bridge.window" );
|
|
const PartnerCalculate = require( "partner_calculate" );
|
|
|
|
cc.Class( {
|
|
|
|
extends: BridgeWindow,
|
|
|
|
properties: {
|
|
lstBase: { default: null, type: cc.Node },
|
|
lstPower: { default: null, type : cc.Node },
|
|
},
|
|
|
|
// 重载:参数打开
|
|
onOpenConfigs: function( _params ) {
|
|
/***********
|
|
* {"partner_id":17,
|
|
* "power":13444,"atk":2364,"def_p":0,"def_s":0,"hp":20171,"speed":5,
|
|
* "hit_rate":0,"dodge_rate":10,"crit_rate":0,"crit_ratio":0,"hit_magic":0,
|
|
* "dodge_magic":50,"dam":0,"res":0,"cure":11,"be_cure":0,"tenacity":0,"def":0,
|
|
* "dam_p":0,"dam_s":0,"res_p":12,"res_s":0}
|
|
*/
|
|
nx.gui.setString( this.lstPower, "", _params.power );
|
|
this.props = _params;
|
|
// // 无效
|
|
// if( nx.dt.objEmpty( this.partner ) ) {
|
|
// this.scheduleOnce( () => {
|
|
// this.close();
|
|
// }, 0.03 );
|
|
// return;
|
|
// }
|
|
|
|
// 刷新
|
|
this.fresh();
|
|
},
|
|
|
|
// 刷新
|
|
fresh: function() {
|
|
|
|
// 单项填充
|
|
const self = this;
|
|
|
|
|
|
// 基础属性
|
|
const BPS = [ 'atk', 'hp', 'def', 'speed','def_p','def_s','hit_rate','dodge_rate', 'crit_rate', 'crit_ratio', 'hit_magic',
|
|
'dodge_magic', 'dam', 'res', 'cure', 'be_cure', 'tenacity', 'dam_p', 'dam_s', 'res_p', 'res_s' ];
|
|
nx.gui.gocChildren( this.lstBase, "", BPS.length );
|
|
const CHD = this.lstBase.children;
|
|
|
|
for( let i = 0; i < BPS.length; ++i ) {
|
|
nx.bridge.attrs.setAttribute( CHD[ i ], [ BPS[ i ],self.props[ BPS[ i ] ], i+1 ] );
|
|
nx.gui.setActive( CHD[ i ], "", self.props[ BPS[ i ] ] != 0 );
|
|
}
|
|
|
|
|
|
// 其他
|
|
},
|
|
|
|
} );
|