123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- var t = require;
- var e = module;
- var i = exports;
- Object.defineProperty(i, "__esModule", {value: !0}), (i.VIEW_CLOSE_TYPE = void 0);
- const s = t("ViewAni"),
- o = t("App"),
- a = t("ViewManager");
- var n;
- ((t = n = i.VIEW_CLOSE_TYPE || (i.VIEW_CLOSE_TYPE = {}))[(t.NORMAL = 0)] = "NORMAL"),
- (t[(t.DESTORY_VIEW = 1)] = "DESTORY_VIEW"),
- (t[(t.DESTORY_VIEW_AND_RES = 2)] = "DESTORY_VIEW_AND_RES"),
- (i.default = class extends cc.Component {
- constructor() {
- super(...arguments),
- (this.controller = null),
- (this._myParent = null),
- (this._isInit = !1),
- (this.bgType = 0),
- (this.closeType = n.DESTORY_VIEW),
- (this.bgImg = null),
- (this.viewId = null),
- (this._isFullScreen = !1),
- (this.isEnterAniFInish = !1),
- (this.closeResole = null),
- (this.initComplete = null);
- }
- isFullScreen() {
- return this._isFullScreen;
- }
- start() {
- (this.viewAni = this.getComponent(s.default)),
- this.viewAni && (this.viewAni.view = this),
- this.initComplete && ((this.enabled = !1), this.initComplete(), (this.initComplete = null));
- }
- enterAniFinish() {
- this.isEnterAniFInish = !0;
- }
- exitAniFinish() {
- this.isEnterAniFInish = !1;
- }
- isInit() {
- return this._isInit;
- }
- applyFunc(t) {
- return this.controller.applyFunc.apply(this.controller, arguments);
- }
- applyControllerFunc(t, e) {
- return this.controller.applyControllerFunc.apply(this.controller, arguments);
- }
- isShow() {
- return this.node.parent && this.node.active && (!this.viewAni || !this.viewAni.isExiting);
- }
- addToParent(t) {
- this.node.parent || (t.addChild(this.node), o.default.ViewManager.checkIsNeedAddBg(), this.playEnterAni());
- }
- onExitAniFinish() {
- this.closeType == n.DESTORY_VIEW
- ? o.default.ViewManager.destoryView(this.viewId)
- : this.closeType == n.DESTORY_VIEW_AND_RES &&
- (o.default.ViewManager.destoryView(this.viewId), o.default.ViewManager.releaseViewRes(this.viewId));
- }
- removeFromParent() {
- this.viewAni && this.viewAni.isExitAni() && this.viewAni.enabled
- ? this.viewAni.onExit()
- : (this.node && this.node.parent && this.node.parent.removeChild(this.node, !1),
- (this.node.active = !1),
- o.default.ViewManager.checkIsNeedAddBg(),
- this.onExitAniFinish());
- }
- initUI() {
- this._isInit = !0;
- }
- onTouchClose() {
- o.default.ViewManager.closeView(this);
- }
- awaitClose() {
- return (
- this.closePromise ||
- ((this.closePromise = new Promise(t => {
- this.closeResole = t;
- })),
- this.closePromise)
- );
- }
- onTouchBg() {}
- initData() {}
- destroyView() {
- (this.controller = null), (this._myParent = null);
- }
- open() {
- this.sendOpenMsg();
- }
- playEnterAni() {
- (this.viewAni = this.getComponent(s.default)),
- this.viewAni && this.viewAni.enabled
- ? (this.viewAni.view = this).viewAni.onEnter()
- : this.enterAniFinish();
- }
- reOpen() {}
- close() {
- (this.initComplete = null),
- this.sendCloseMsg(),
- this.closeResole && (this.closeResole(), (this.closeResole = null), (this.closePromise = null));
- }
- sendOpenMsg() {}
- changeScenePre() {}
- sendCloseMsg() {
- o.default.NotificationCenter.dispatch(a.ViewManagerEvent.VIEW_IS_CLOSE, this.viewId);
- }
- closeView() {
- o.default.ViewManager.closeView(this);
- }
- onDestroy() {
- o.default.TimerManager.removeAll(this), o.default.NotificationCenter.removeAll(this);
- }
- loadResource() {
- return new Promise(t => {
- this.initComplete = t;
- });
- }
- setVisible(t) {
- this.node.active = t;
- }
- });
|