75 lines
1.7 KiB
JavaScript
75 lines
1.7 KiB
JavaScript
/******************************************************************
|
|
*
|
|
* 全屏等待
|
|
*
|
|
******************************************************************/
|
|
|
|
const BridgeComponent = require( "bridge.component" );
|
|
|
|
cc.Class({
|
|
|
|
extends: BridgeComponent,
|
|
|
|
properties: {
|
|
gwait: { default: null, type: cc.Node },
|
|
payWaiting: { default: null, type: cc.Node },
|
|
},
|
|
|
|
// 载入
|
|
onLoad: function() {
|
|
|
|
this._super();
|
|
|
|
// 初始化隐藏
|
|
this.gwait.active = false;
|
|
this.payWaiting.active = false;
|
|
|
|
// 视图监听
|
|
this.vbind( [
|
|
[ "GWaitings", this.onWaitingChanged.bind( this ) ],
|
|
[ "PayWait", this.onPaymentWaiting.bind( this ) ]
|
|
] );
|
|
|
|
},
|
|
|
|
// 等待队列改变
|
|
onWaitingChanged: function( _queue ) {
|
|
|
|
// 空
|
|
if( nx.dt.arrEmpty( _queue ) ) {
|
|
this.gwait.active = false;
|
|
return;
|
|
}
|
|
|
|
// 非空
|
|
this.gwait.active = true;
|
|
|
|
// 文本
|
|
let key = _queue[0];
|
|
nx.gui.setString( this.gwait, "box/txt", nx.text.getKey( key ) );
|
|
|
|
},
|
|
|
|
// 支付等待
|
|
onPaymentWaiting: function( _state ) {
|
|
|
|
if( nx.dt.objEmpty( _state ) ) {
|
|
this.payWaiting.active = false;
|
|
return;
|
|
}
|
|
|
|
this.payWaiting.active = true;
|
|
nx.gui.setActive( this.payWaiting, "box/sp", !_state.done );
|
|
nx.gui.setString( this.payWaiting, "box/txt", nx.text.getKey( _state.msg ) );
|
|
|
|
this.unscheduleAllCallbacks();
|
|
if( _state.done ) {
|
|
this.scheduleOnce( () => {
|
|
this.payWaiting.active = false;
|
|
}, 1 );
|
|
}
|
|
|
|
},
|
|
|
|
});
|