cabe166a-134f-463b-8237-b3db36ce4b06.js
2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
"use strict";
cc._RF.push(module, 'cabe1ZqE09GO4I3s9s2zksG', 'UIBase');
// scripts/ui/UIBase.ts
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.UIBase = void 0;
var UIBase = /** @class */ (function (_super) {
__extends(UIBase, _super);
function UIBase() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.enableParam = null;
_this._tweenobj = { progress: 0 };
_this._usePopUpEffect = true;
_this._useCloseEffect = true;
_this._closing = false;
return _this;
// private onCloseEffectUpdate(target: { progress: number }, ratio: number) {
// // target.setScale(ratio, ratio, 1);
// this.node.setScale(target.progress, target.progress);
// // log(target.progress, ratio);
// }
}
Object.defineProperty(UIBase.prototype, "closing", {
/**正在关闭特效中 */
get: function () { return this._closing; },
enumerable: false,
configurable: true
});
/**弹出特效,子类可复写 */
UIBase.prototype.onPopUpEffect = function () {
if (this._usePopUpEffect) {
this.node.setScale(0.1, 0.1, 1);
this._tweenobj.progress = 0;
cc.tween(this._tweenobj).to(0.2, { progress: 1 }, { onUpdate: this.onEffectUpdate.bind(this), easing: 'backOut' }).call(this.onPopUpEffectFinish.bind(this)).start();
}
};
UIBase.prototype.onEffectUpdate = function (target, ratio) {
this.node.setScale(target.progress, target.progress);
};
UIBase.prototype.onPopUpEffectFinish = function () {
};
UIBase.prototype.onBeforeClose = function () {
cc.Tween.stopAllByTarget(this._tweenobj);
};
UIBase.prototype.onCloseEffect = function (callBack, callBackThisObj) {
var _this = this;
if (this._useCloseEffect) {
this._closing = true;
this._tweenobj.progress = 1;
cc.tween(this._tweenobj).to(0.2, { progress: 0 }, { onUpdate: this.onEffectUpdate.bind(this), easing: 'backIn' }).call(function () {
_this._closing = false;
callBack.call(callBackThisObj);
}).start();
}
else {
callBack.call(callBackThisObj);
}
};
return UIBase;
}(cc.Component));
exports.UIBase = UIBase;
cc._RF.pop();