Files
fc/dev/project/assets/Scripts/mod/home/cmps/cmp.home.footmark.item.js
T

73 lines
1.8 KiB
JavaScript
Raw Normal View History

2026-05-23 22:10:14 +08:00
/******************************************************************
*
* 家园足迹项
*
******************************************************************/
const SVCItem = require( "nx.fx.sv.expand.item" );
const BCC = require( "backpack_const" );
const TimeTool = require( "timetool" );
const Home = require( "home.mod" );
cc.Class( {
extends: SVCItem,
properties: {
},
// 数据重置
rebind: function( _idx, _data, _key ) {
this._super( _idx, _data, _key );
if( nx.dt.objEmpty( _data ) ) {
return;
}
this.freshBase();
},
// 更新
freshBase: function() {
nx.gui.setString( this, "name", this.mdata.name );
let txt = nx.bridge.time.toDescAgo( this.mdata.time );
nx.gui.setString( this, "date", txt );
nx.gui.setActive( this, "visit", !!this.mdata.is_home );
if( nx.dt.arrEmpty( this.mdata.rewards) ) {
nx.gui.setString( this, "desc", nx.text.getKey( "HomeVisitRec" ) );
}
else {
let reward = this.mdata.rewards[0];
let cfgs = gitemdata( reward.base_id );
let color = BCC.quality_color( cfgs.quality || 1 );
let name = nx.text.getKey( cfgs.name );
if( reward.num > 1 ) {
name += "X" + reward.num;
}
txt = nx.text.format( "HomeVisitRecGet", color, name );
nx.gui.setString( this, "desc", txt );
}
},
// 点击回访
onTouchVisit: function() {
if( nx.dt.objEmpty( this.mdata ) ) {
return;
}
nx.bridge.closePanel( "WndHomeFootmark" );
nx.bridge.createPanel( "WndHome", {
srv_id :this.mdata.srv_id,
rid : this.mdata.rid,
} );
},
} );