101 lines
2.3 KiB
JavaScript
101 lines
2.3 KiB
JavaScript
/******************************************************************
|
|
*
|
|
* 積天好禮
|
|
*
|
|
******************************************************************/
|
|
|
|
const BasePage = require( "act.page.base" );
|
|
const NxExpand = require("nx.fx.sv.expand");
|
|
const FxSpine = require("nx.fx.spine");
|
|
const PathTool = require("pathtool");
|
|
const Payment = require( "payment.mod" );
|
|
|
|
cc.Class( {
|
|
|
|
extends: BasePage,
|
|
|
|
properties: {
|
|
list:{
|
|
default:null,
|
|
type:NxExpand
|
|
},
|
|
roleSp:{
|
|
default:null,
|
|
type:FxSpine
|
|
},
|
|
price:{
|
|
default:null,
|
|
type:cc.Node
|
|
},
|
|
tips:{
|
|
default:null,
|
|
type:cc.Node
|
|
},
|
|
statusLb:{
|
|
default:null,
|
|
type:cc.Node
|
|
}
|
|
},
|
|
|
|
// 初始化
|
|
build: function( _data ) {
|
|
|
|
this._super( _data );
|
|
|
|
// 无效
|
|
if( !this.mod ) {
|
|
return;
|
|
}
|
|
|
|
// 活动监听
|
|
this.mod.vbind( this, [
|
|
[ "luxuryBaseData", this.freshInfos.bind( this ) ],
|
|
] );
|
|
},
|
|
|
|
onEnable(){
|
|
this.mod.reqLuxuryData();
|
|
|
|
let res_path = PathTool.getSpinePath( "H30106", "show", false );
|
|
this.roleSp.load( res_path, ( _e ) => {
|
|
if( !_e ) {
|
|
this.roleSp.action( "action1", true );
|
|
} else {
|
|
this.roleSp.stop();
|
|
}
|
|
} );
|
|
|
|
let val = Payment.getInstance().fmtPrice(7);
|
|
nx.gui.setString(this.price,"",val);
|
|
},
|
|
|
|
onDisable(){
|
|
this.list.rebuild([]);
|
|
},
|
|
|
|
// 销毁
|
|
onDestroy: function() {
|
|
// 活动监听解除
|
|
if( this.mod ) {
|
|
this.mod.vunbind( this );
|
|
}
|
|
|
|
this._super();
|
|
},
|
|
|
|
freshInfos(data){
|
|
if(nx.dt.objEmpty(data))return;
|
|
nx.gui.setString(this.tips,"",cc.js.formatStr(nx.text.getKey("BuyDayCharges"),this.mod.getActDay()));
|
|
this.list.rebuild(data.aim_list);
|
|
let is_finish = false;
|
|
for(let i in data.aim_list){
|
|
if(data.aim_list[i].aim == this.mod.getActDay()){
|
|
is_finish = (data.aim_list[i].status != 0);
|
|
break;
|
|
}
|
|
}
|
|
let str = is_finish?nx.text.getKey("BuyDayNoFinish"):nx.text.getKey("BuyDayFinish");
|
|
nx.gui.setString(this.statusLb,"",str);
|
|
},
|
|
|
|
} ); |