143 lines
3.8 KiB
JavaScript
143 lines
3.8 KiB
JavaScript
/******************************************************************
|
|
*
|
|
* 活动推送弹窗
|
|
*
|
|
******************************************************************/
|
|
|
|
const BridgeWindow = require( "bridge.window" );
|
|
const NxSpine = require( "nx.fx.spine" );
|
|
const ActMod = require( "acts.mod" );
|
|
|
|
cc.Class( {
|
|
|
|
extends: BridgeWindow,
|
|
|
|
properties: {
|
|
|
|
spMain: { default: null, type: NxSpine },
|
|
ckClose: { default: null, type: cc.Node },
|
|
lstEntry: { default: [], type: cc.Node },
|
|
imgLogo: { default: null, type: cc.Node },
|
|
nodClose: { default: null, type: cc.Node },
|
|
},
|
|
|
|
// 重载:参数打开
|
|
onOpenConfigs: function( _params ) {
|
|
|
|
nx.gui.setActive( this.ckClose, "", false );
|
|
nx.gui.setActive( this.ckClose, "mk/on", false );
|
|
nx.gui.setActive( this.ckClose, "mk/off", true );
|
|
nx.gui.setActive( this.imgLogo, "", false );
|
|
nx.gui.setActive( this.nodClose, "", false );
|
|
|
|
// 无效参数
|
|
if( nx.dt.objEmpty( _params ) ||
|
|
!nx.dt.numPositive( _params.id, false ) ) {
|
|
this.delayClose();
|
|
return;
|
|
}
|
|
|
|
let DATA = game.configs.login_popup_data;
|
|
let info = DATA ? DATA.data_get_popup[ _params.id ] : null;
|
|
if( nx.dt.objEmpty( info ) ) {
|
|
nx.error( `$ActPopup:无效弹窗配置${ _params.id }!` );
|
|
this.delayClose();
|
|
return;
|
|
}
|
|
|
|
// 入口统计
|
|
this.entries = [];
|
|
for( let i = 1; i <= 6; ++i ) {
|
|
let name = info[ `name${ i }` ];
|
|
let source = info[ `source${ i }` ];
|
|
if( nx.dt.strNEmpty( name ) && nx.dt.numPositive( source, false ) ) {
|
|
this.entries.push( {
|
|
name: nx.text.getKey( name ),
|
|
source: source
|
|
} );
|
|
}
|
|
}
|
|
|
|
// 第一步
|
|
this.doStep1();
|
|
},
|
|
|
|
// 第一步
|
|
doStep1: function() {
|
|
|
|
this.lstEntry.forEach( _node => {
|
|
_node.active = false;
|
|
} );
|
|
|
|
this.spMain.action( "play1", false, ( _event ) => {
|
|
if( _event == "move" ) {
|
|
nx.gui.setActive( this.imgLogo, "", true );
|
|
nx.gui.setActive( this.nodClose, "", true );
|
|
}
|
|
if( _event == "complete" ) {
|
|
this.doStep2();
|
|
}
|
|
} );
|
|
},
|
|
|
|
// 第二步
|
|
doStep2: function() {
|
|
|
|
this.spMain.action( "play2", true );
|
|
nx.gui.setActive( this.ckClose, "", true );
|
|
nx.gui.setActive( this.imgLogo, "", true );
|
|
nx.gui.setActive( this.nodClose, "", true );
|
|
|
|
// 入口设置
|
|
for( let i = 0; i < this.lstEntry.length; ++i ) {
|
|
|
|
let node = this.lstEntry[ i ];
|
|
if( !node ) {
|
|
continue;
|
|
}
|
|
|
|
let ifo = this.entries[ i ];
|
|
if( !ifo ) {
|
|
node.active = false;
|
|
continue;
|
|
}
|
|
|
|
node.active = true;
|
|
nx.gui.setString( node, "txt", ifo.name );
|
|
}
|
|
|
|
},
|
|
|
|
// 点击入口
|
|
onTouchEntry: function( _index ) {
|
|
|
|
let index = parseInt( _index ) || 0;
|
|
let ifo = this.entries[ index - 1 ];
|
|
if( ifo ) {
|
|
nx.bridge.jumper.jump2Window( ifo.source );
|
|
this.onTouchClose();
|
|
}
|
|
},
|
|
|
|
// 开关切换
|
|
onTogClose: function() {
|
|
|
|
let close = nx.gui.isActive( this.ckClose, "mk/on" );
|
|
nx.gui.setActive( this.ckClose, "mk/on", !close );
|
|
nx.gui.setActive( this.ckClose, "mk/off", close );
|
|
},
|
|
|
|
// 点击关闭
|
|
onTouchClose: function() {
|
|
|
|
let close = nx.gui.isActive( this.ckClose, "mk/on" );
|
|
if( close ) {
|
|
ActMod.getInstance().reqClosePushPopup();
|
|
}
|
|
|
|
// 关闭
|
|
this.close();
|
|
},
|
|
|
|
} );
|