123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- 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.ShopBankItem = void 0);
- const o = t("App"),
- a = t("GameText"),
- n = t("EffectUtils"),
- r = t("ControllerConst"),
- l = t("NotificationConst"),
- h = (t("ViewConst"), t("BagController")),
- c = t("GlobalAttr"),
- d = t("ShopConst"),
- {property: u, ccclass: p, menu: f} = cc._decorator;
- t = class extends cc.Component {
- constructor() {
- super(...arguments),
- (this.ani = null),
- (this.arrowAni = null),
- (this.bubbleAni = null),
- (this.targetNode = null),
- (this.diamondLab = null),
- (this.priceLab = null),
- (this.progressBar = null),
- (this.minLab = null),
- (this.maxLab = null),
- (this.btnNode = null),
- (this.tipLab = null),
- (this.isUpgradeView = !1),
- (this.showFullAniTime = 0);
- }
- onLoad() {
- this.priceLab && (this.priceLab.string = o.default.Platform.getPrice("shop_bank"));
- var t = c.default.ins.define;
- this.minLab && (this.minLab.string = "" + t.piggybank_purchase_min_count),
- this.maxLab && (this.maxLab.string = "" + t.piggybank_full_count),
- this.isUpgradeView &&
- (o.default.NotificationCenter.addListener(
- l.NotificationConst.STAGE_UPGRADE_UPDATE,
- this.onStageUpgradeUpdate,
- this
- ),
- o.default.NotificationCenter.addListener(l.NotificationConst.PAY_SUCCESS, this.onPaySuccess, this));
- }
- onEnable() {
- this.updateUI(),
- this.arrowAni && (this.arrowAni.node.active = !1),
- this.bubbleAni && ((this.bubbleAni.node.children[0].active = !1), (this.bubbleAni.node.active = !1)),
- (this.showFullAniTime = 0);
- }
- onDisable() {
- o.default.NotificationCenter.removeAll(this);
- }
- onPaySuccess() {
- o.default.TimerManager.doFrame(3, 1, this.updateUI, this);
- }
- onStageUpgradeUpdate(t, e) {
- if (e) {
- const s = o.default.ViewManager.uiRoot;
- e = s.convertToNodeSpaceAR(e);
- var i = this.targetNode.convertToWorldSpaceAR(cc.Vec2.ZERO),
- i = s.convertToNodeSpaceAR(i);
- n.default.instance.playMoneyAni(
- e,
- i,
- h.CostType.diamond,
- s,
- c.default.ins.define.piggybank_get_count,
- () => {
- this.ani &&
- (o.default.ControllerManager.applyFunc(r.ControllerConst.Shop, d.ShopConst.GET_BANK_DIAMOND) >=
- c.default.ins.define.piggybank_purchase_min_count
- ? this.updateUI()
- : (this.ani.play("work"),
- this.ani.once(cc.Animation.EventType.FINISHED, this.updateUI, this)));
- }
- );
- }
- }
- updateUI() {
- var t = o.default.ControllerManager.applyFunc(r.ControllerConst.Shop, d.ShopConst.GET_BANK_DIAMOND);
- this.diamondLab.string = "" + t;
- var e = c.default.ins.define;
- this.progressBar.progress = t / e.piggybank_full_count;
- var i = t >= e.piggybank_purchase_min_count,
- s = t >= e.piggybank_full_count;
- (this.btnNode.active = i),
- this.tipLab &&
- ((this.tipLab.node.active = !i || this.isUpgradeView),
- (this.tipLab.string = s ? a.GameText.getText(94) : a.GameText.getText(93))),
- t == e.piggybank_full_count ? (this.ani.play("full"), this.playFullAni()) : this.ani.play("idle");
- }
- onTouchBuyBtn() {
- return s(this, void 0, void 0, function* () {
- (yield o.default.ControllerManager.applyFunc(r.ControllerConst.Shop, d.ShopConst.BUY_BANK)) &&
- this.updateUI();
- });
- }
- onTouchOpen() {
- o.default.ViewManager.open(41);
- }
- playFullAni() {
- this.isUpgradeView &&
- !this.showFullAniTime &&
- ((this.arrowAni.node.active = !0),
- (this.bubbleAni.node.active = !0),
- this.arrowAni.play("idle"),
- this.bubbleAni.play("idle")),
- (this.showFullAniTime = 5);
- }
- update(t) {
- this.isUpgradeView &&
- ((this.showFullAniTime -= t),
- this.showFullAniTime <= 0 &&
- ((this.arrowAni.node.active = !1),
- (this.bubbleAni.node.children[0].active = !1),
- (this.bubbleAni.node.active = !1),
- (this.showFullAniTime = 0)));
- }
- };
- e([u(cc.Animation)], t.prototype, "ani", void 0),
- e([u(cc.Animation)], t.prototype, "arrowAni", void 0),
- e([u(cc.Animation)], t.prototype, "bubbleAni", void 0),
- e([u(cc.Node)], t.prototype, "targetNode", void 0),
- e([u(cc.Label)], t.prototype, "diamondLab", void 0),
- e([u(cc.Label)], t.prototype, "priceLab", void 0),
- e([u(cc.ProgressBar)], t.prototype, "progressBar", void 0),
- e([u(cc.Label)], t.prototype, "minLab", void 0),
- e([u(cc.Label)], t.prototype, "maxLab", void 0),
- e([u(cc.Node)], t.prototype, "btnNode", void 0),
- e([u(cc.Label)], t.prototype, "tipLab", void 0),
- e([u(cc.Boolean)], t.prototype, "isUpgradeView", void 0),
- (t = e([p, f("view/Shop/ShopBankItem")], t)),
- (i.ShopBankItem = t);
|