78 lines
1.9 KiB
JavaScript
78 lines
1.9 KiB
JavaScript
/******************************************************************
|
|
*
|
|
* 集結令 開服活动
|
|
*
|
|
******************************************************************/
|
|
|
|
const BasePage = require( "act.page.base" );
|
|
const NxSpine = require( "nx.fx.spine" );
|
|
const ExpandList = require( "nx.fx.sv.expand" );
|
|
const VipController = require( "vip_controller" );
|
|
|
|
|
|
cc.Class( {
|
|
|
|
extends: BasePage,
|
|
|
|
properties: {
|
|
nodItems : { type: ExpandList, default: null },
|
|
spRole: { default: null, type: NxSpine },
|
|
nodEndTime : { default: null, type: cc.Node },
|
|
nodOp : { type: cc.Node, default: null },
|
|
},
|
|
|
|
// 初始化
|
|
onLoad: function() {
|
|
|
|
this.spRole.load( "resDB/models/H30084/show", ( _e ) => {
|
|
if( !_e ) {
|
|
this.spRole.action( "action1", true );
|
|
} else {
|
|
this.spRole.stop();
|
|
}
|
|
} );
|
|
this.mod = VipController.getInstance();
|
|
this.nodItems.rebuild( this.mod.giftInfo );
|
|
|
|
|
|
// 活动监听
|
|
this.vbind( [
|
|
[ "weeklygift", this.freshWeeklyGiftInfo.bind( this ) ],
|
|
] );
|
|
|
|
|
|
},
|
|
|
|
onEnable: function(){
|
|
|
|
// 请求信息
|
|
this.mod.reqMonthlyGiftData( 1 );
|
|
},
|
|
|
|
freshWeeklyGiftInfo: function( _data ){
|
|
|
|
if( !_data || nx.dt.objEmpty( _data ) ){
|
|
return;
|
|
}
|
|
|
|
let buyList = _data.first_gift;
|
|
|
|
let chd = nx.gui.find( this.nodItems.bindSCV, "view/content" ).children;
|
|
for (let i = 0; i < chd.length; i++) {
|
|
let nod = chd[i];
|
|
let cmp = nod.svItem;
|
|
if( cmp ){
|
|
buyList.forEach( _item => {
|
|
if( _item.id == cmp.mdata.gift.charge_id ){
|
|
cmp.freshLeft( _item.count );
|
|
}
|
|
} )
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
} );
|