71 lines
1.7 KiB
JavaScript
71 lines
1.7 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, 'a26dcIQOHJDqIX6zCDOpqID', 'bridge.gwaiting');
|
||
|
|
// Scripts/zbridge/cmps/bridge.gwaiting.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
/******************************************************************
|
||
|
|
*
|
||
|
|
* 全屏等待
|
||
|
|
*
|
||
|
|
******************************************************************/
|
||
|
|
|
||
|
|
var BridgeComponent = require("bridge.component");
|
||
|
|
cc.Class({
|
||
|
|
"extends": BridgeComponent,
|
||
|
|
properties: {
|
||
|
|
gwait: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
payWaiting: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
}
|
||
|
|
},
|
||
|
|
// 载入
|
||
|
|
onLoad: function onLoad() {
|
||
|
|
this._super();
|
||
|
|
|
||
|
|
// 初始化隐藏
|
||
|
|
this.gwait.active = false;
|
||
|
|
this.payWaiting.active = false;
|
||
|
|
|
||
|
|
// 视图监听
|
||
|
|
this.vbind([["GWaitings", this.onWaitingChanged.bind(this)], ["PayWait", this.onPaymentWaiting.bind(this)]]);
|
||
|
|
},
|
||
|
|
// 等待队列改变
|
||
|
|
onWaitingChanged: function onWaitingChanged(_queue) {
|
||
|
|
// 空
|
||
|
|
if (nx.dt.arrEmpty(_queue)) {
|
||
|
|
this.gwait.active = false;
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 非空
|
||
|
|
this.gwait.active = true;
|
||
|
|
|
||
|
|
// 文本
|
||
|
|
var key = _queue[0];
|
||
|
|
nx.gui.setString(this.gwait, "box/txt", nx.text.getKey(key));
|
||
|
|
},
|
||
|
|
// 支付等待
|
||
|
|
onPaymentWaiting: function onPaymentWaiting(_state) {
|
||
|
|
var _this = this;
|
||
|
|
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(function () {
|
||
|
|
_this.payWaiting.active = false;
|
||
|
|
}, 1);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
cc._RF.pop();
|