123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- 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}), (i.ShopBuffItem = void 0);
- const o = t("App"),
- a = t("GameText"),
- n = t("AdShareBtnCtr"),
- r = t("ControllerConst"),
- l = t("NotificationConst"),
- h = (t("ViewConst"), t("BagConst")),
- c = t("BagController"),
- d = t("BuffMgr"),
- u = t("MyBigLong"),
- p = t("ShopConst"),
- f = t("ShopItem"),
- {property: g, ccclass: m, menu: _} = cc._decorator;
- t = class extends f.ShopItem {
- constructor() {
- super(...arguments),
- (this.title = null),
- (this.descLab = null),
- (this.buffTimeNode = null),
- (this.buffTimeLab = null),
- (this.adShareBtnCtr = null),
- (this.adBtn = null),
- (this.adNode = null),
- (this.coolNode = null),
- (this.coolTimeLab = null),
- (this.costBtn = null),
- (this.adCoolTime = 0),
- (this.buffEndTime = 0),
- (this.buffIndex = 0),
- (this.item = null);
- }
- initItem() {
- var t;
- (this.item = o.default.ControllerManager.applyFunc(
- r.ControllerConst.Item,
- h.BagConst.GET_ITEM,
- this.data.cfg.itemId
- )),
- o.default.CommonUtils.setSpriteFrame(this.item.getItemPic(), this.icon),
- (this.title.string = a.GameText.getTextByStr(this.item.data.name)),
- (this.buffIndex = this.item.data.buff ? this.item.data.buff.buffIndex : 0),
- this.data.cfg.ad && (this.adShareBtnCtr.adType = this.data.cfg.arg0),
- this.updateBtnState(),
- this.item.data.buff
- ? (this.descLab.string = a.GameText.getTextByStr(this.item.data.desc))
- : ((t = this.item.getCnt()),
- (this.node.active = !!t),
- (this.descLab.string = a.GameText.getText(63).format(u.default.toString(t))));
- }
- updateBtnState() {
- var t;
- this.data.cfg.ad
- ? ((this.adBtn.node.active = !0),
- (this.costBtn.active = !1),
- (t = o.default.DateUtils.secondNow()),
- (t = this.data.time + this.data.cfg.ad > t),
- (this.adBtn.interactable = !t),
- (this.adNode.active = !t),
- (this.coolNode.active = t) && (this.adCoolTime = 1e3 * (this.data.time + this.data.cfg.ad)))
- : ((this.adBtn.node.active = !1),
- (this.costBtn.active = !0),
- (this.costLab.string = this.data.cfg.diamond.toString()));
- }
- updateTime(t) {
- var e = o.default.DateUtils.Now();
- if (this.buffEndTime) {
- let t = (this.buffEndTime - e) / 1e3;
- t < 0
- ? ((t = 0),
- (this.buffEndTime = 0),
- (this.buffTimeLab.node.active = !1),
- (this.buffTimeNode.active = !1))
- : ((this.buffTimeLab.node.active = !0),
- (this.buffTimeNode.active = !0),
- (this.buffTimeLab.string = o.default.DateUtils.getFormatBySecond(t, 10)));
- }
- if (this.adCoolTime) {
- let t = (this.adCoolTime - e) / 1e3;
- t < 0
- ? ((t = 0), (this.adCoolTime = 0), this.updateBtnState())
- : (this.coolTimeLab.string = o.default.DateUtils.getFormatBySecond(t, 10));
- }
- }
- updateBuffState() {
- var t = d.default.ins.getGlobalBuffByIndex(this.buffIndex);
- t && t.buffEndTime && (this.buffEndTime = t.buffEndTime);
- }
- onTouchBuyBtn() {
- return s(this, void 0, void 0, function* () {
- var t, e;
- (yield o.default.ControllerManager.applyFunc(
- r.ControllerConst.Shop,
- p.ShopConst.BUY,
- this.data,
- this.adShareBtnCtr.adType
- )) &&
- (this.updateBuffState(),
- this.updateBtnState(),
- this.item.data.buff
- ? o.default.ViewManager.open(31, this.item)
- : ((t = this.item.getCnt()),
- (e = this.costBtn.convertToWorldSpaceAR(cc.Vec2.ZERO)),
- o.default.NotificationCenter.dispatch(
- l.NotificationConst.PLAY_MONEY_ANI,
- c.CostType.coin,
- t,
- e
- )));
- });
- }
- };
- e([g(cc.Label)], t.prototype, "title", void 0),
- e([g(cc.Label)], t.prototype, "descLab", void 0),
- e([g(cc.Node)], t.prototype, "buffTimeNode", void 0),
- e([g(cc.Label)], t.prototype, "buffTimeLab", void 0),
- e([g(n.default)], t.prototype, "adShareBtnCtr", void 0),
- e([g(cc.Button)], t.prototype, "adBtn", void 0),
- e([g(cc.Node)], t.prototype, "adNode", void 0),
- e([g(cc.Node)], t.prototype, "coolNode", void 0),
- e([g(cc.Label)], t.prototype, "coolTimeLab", void 0),
- e([g(cc.Node)], t.prototype, "costBtn", void 0),
- (t = e([m, _("view/Shop/item/ShopBuffItem")], t)),
- (i.ShopBuffItem = t);
|