var t = require; var e = module; var i = exports; var e = (this && this.__decorate) || function (t, e, i, s) { var o, a = arguments.length, n = a < 3 ? e : null === s ? (s = Object.getOwnPropertyDescriptor(e, i)) : s; if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) n = Reflect.decorate(t, e, i, s); else for (var r = t.length - 1; 0 <= r; r--) (o = t[r]) && (n = (a < 3 ? o(n) : 3 < a ? o(e, i, n) : o(e, i)) || n); return 3 < a && n && Object.defineProperty(e, i, n), n; }, s = (this && this.__awaiter) || function (t, n, r, l) { return new (r = r || Promise)(function (i, e) { function s(t) { try { a(l.next(t)); } catch (t) { e(t); } } function o(t) { try { a(l.throw(t)); } catch (t) { e(t); } } function a(t) { var e; t.done ? i(t.value) : ((e = t.value) instanceof r ? e : new r(function (t) { t(e); }) ).then(s, o); } a((l = l.apply(t, n || [])).next()); }); }; Object.defineProperty(i, "__esModule", {value: !0}); const o = t("App"), a = t("BaseView"), n = t("NotificationConst"), r = (t("ViewConst"), t("LayerManager"), t("MaillistItem")), {ccclass: l, property: h} = cc._decorator; t = class extends a.default { constructor() { super(...arguments), (this.mailItem = null), (this.content = null), (this.empty = null), (this.bgType = 1); } open() { super.open(), this.initView(), o.default.NotificationCenter.addListener(n.NotificationConst.UPDATE_MAIL_LIST, this.initView, this); } initView() { return s(this, void 0, void 0, function* () { this.content.removeAllChildren(); let t = !0; const e = this.controller.serverMailData; for (var i in e) { const s = e[i]; this.creatMailItem(s.id, s.title, s.expire_time, s.create_time, s.state), (t = !1); } const s = this.controller.getLocalMail(); if (s) for (var o in s) { const e = s[o]; this.creatMailItem(e.id, e.title, e.expire_time, e.create_time, e.state), (t = !1); } this.empty.active = t; }); } creatMailItem(t, e, i, s, o) { let a = cc.instantiate(this.mailItem); this.content.addChild(a), a.getComponent(r.default).setData(t, e, i, s, o); } onDisable() { o.default.NotificationCenter.removeListener(n.NotificationConst.UPDATE_MAIL_LIST, this.initView, this); } onTouchDel() { return s(this, void 0, void 0, function* () { yield this.controller.delAllMailByReaded(), this.initView(); }); } onTouchGet() { return s(this, void 0, void 0, function* () { yield this.controller.gainAllMailReward(), this.initView(); }); } }; (t.VIEW_INFO = {prefabName: "mail/MailListView", zIndex: 100, key: 45}), e([h(cc.Node)], t.prototype, "mailItem", void 0), e([h(cc.Node)], t.prototype, "content", void 0), e([h(cc.Node)], t.prototype, "empty", void 0), (t = e([l], t)), (i.default = t);