Files
fc/dev/project/assets/Scripts/mod/acts/taskDaily/cmp.act.task.daily.item.js
T

66 lines
1.5 KiB
JavaScript
Raw Normal View History

2026-05-23 22:10:14 +08:00
/******************************************************************
* Copyright(C) 2019 - 2020 Nx Studio
*
* 日常任务模版任務項
*
* 2018.05.18
******************************************************************/
const SVCItem = require( "nx.fx.sv.expand.item" );
const ItemLayout = require( "cmp.common.itemlayout" );
cc.Class( {
extends: SVCItem,
properties: {
nodRewards: { default: null, type: ItemLayout },
},
// 数据重置
rebind: function( _idx, _data, _key ) {
this._super( _idx, _data, _key );
if( nx.dt.objEmpty( _data ) ) {
return;
}
// 设置
this.setData( _data );
},
// 设置
setData: function( _data ) {
this.nodRewards.rebuild( _data.award );
nx.gui.setString( this, "name", nx.text.getKey( _data.desc ) );
nx.gui.setString( this, "prog", `${_data.value}/${_data.target_val}` );
nx.gui.setActive( this, "get", _data.finish == 1 );
nx.gui.setActive( this, "yet", _data.finish == 0 );
nx.gui.setActive( this, "got", _data.finish == 2 );
},
// 点击跳转
onTouchJump: function() {
let id = this.mdata ? this.mdata.jump_id : 0;
if( nx.dt.numPositive( id, false ) ) {
nx.bridge.jumper.jump2Window( id );
}
},
// 点击领取
onTouchReward: function() {
if( !this.mdata || !this.mdata.mod ) {
return;
}
this.mdata.mod.reqFinish( this.mdata.id );
},
} );