123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- var t = require;
- var e = module;
- var i = exports;
- var s =
- (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;
- };
- Object.defineProperty(i, "__esModule", { value: !0 });
- const n = t("App"),
- o = t("BaseView"),
- a = t("ShopConst"),
- r = t("ShopContent"),
- l = t("EffectUtils"),
- h = t("BagController"),
- { property: c, ccclass: d, menu: u } = cc._decorator;
- (e = cc.Class({
- name: "ShopContenteSet",
- properties: { shopType: { type: cc.Enum(a.ShopType), default: 0 }, content: r.ShopContent }
- })),
- (t = class extends o.default {
- constructor() {
- super(...arguments),
- (this.moneyBarList = []),
- (this.scrollView = null),
- (this.widgets = []),
- (this.shopContentes = []),
- (this.controller = null),
- (this.bgType = 1);
- }
- onLoad() {
- n.default.Platform.checkIsNotch() && (this.node.getComponent(cc.Widget).top = 60);
- }
- initUI() {
- super.initUI();
- var t = this.controller.model.shopItemDatas;
- for (const e of this.shopContentes) {
- e.content.setData(t[e.shopType]);
- }
- n.default.Platform.checkIsNotch() &&
- this.widgets.forEach(t => {
- t.top += 50;
- });
- }
- open(e) {
- super.open();
- for (const t of this.shopContentes)
- this.isShowContent(t.shopType) ? t.content.initContent() : (t.content.node.active = !1);
- this.onTouchScrollView(),
- n.default.TimerManager.doTimer(
- 500,
- 1,
- () => {
- for (let t = 0; t < this.shopContentes.length; t++)
- if (e == this.shopContentes[t].shopType) {
- this.scrollView.scrollToOffset(cc.v2(0, -this.shopContentes[t].content.node.y), 1);
- break;
- }
- },
- this
- );
- }
- updateContentUI(t) {
- for (const e of this.shopContentes) t == e.shopType && e.content.updateUI();
- }
- updateMonthCard(t) { }
- updateTime(t) {
- for (const e of this.shopContentes) e.shopType == a.ShopType.BOX && e.content.updateUI();
- }
- playGetCoinAni(t, e = 0) {
- t %= h.CostType.coin;
- let i = this.moneyBarList[t];
- const s = n.default.ViewManager.uiRoot;
- var o = cc.Vec2.ZERO,
- a = i.convertToWorldSpaceAR(i.getChildByName("icon").position),
- a = s.convertToNodeSpaceAR(a);
- l.default.instance.playMoneyAni(o, a, t, s, e);
- }
- onTouchScrollView() {
- var t = this.scrollView.getContentPosition().y;
- for (const s of this.shopContentes) {
- var e = t + s.content.node.y,
- i = t + (s.content.node.y - s.content.node.height);
- e < -this.scrollView.node.height || 0 < i
- ? s.content.hideContent()
- : this.isShowContent(s.shopType) && s.content.showContent();
- }
- }
- isShowContent(t) {
- let e = !0;
- switch (t) {
- case a.ShopType.Diamond:
- case a.ShopType.GIFT:
- e = n.default.Platform.getIsShowPay();
- }
- return e;
- }
- });
- s([c([cc.Node])], t.prototype, "moneyBarList", void 0),
- s([c(cc.ScrollView)], t.prototype, "scrollView", void 0),
- s([c([cc.Widget])], t.prototype, "widgets", void 0),
- s([c(e)], t.prototype, "shopContentes", void 0),
- (t = s([d, u("view/Shop/ShopView")], t)),
- (i.default = t);
|