ShopViewIcon.js 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. var t = require;
  2. var e = module;
  3. var i = exports;
  4. e =
  5. (this && this.__decorate) ||
  6. function (t, e, i, s) {
  7. var o,
  8. a = arguments.length,
  9. n = a < 3 ? e : null === s ? (s = Object.getOwnPropertyDescriptor(e, i)) : s;
  10. if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) n = Reflect.decorate(t, e, i, s);
  11. else
  12. for (var r = t.length - 1; 0 <= r; r--)
  13. (o = t[r]) && (n = (a < 3 ? o(n) : 3 < a ? o(e, i, n) : o(e, i)) || n);
  14. return 3 < a && n && Object.defineProperty(e, i, n), n;
  15. };
  16. Object.defineProperty(i, "__esModule", {value: !0});
  17. const s = t("App"),
  18. o = t("BaseView"),
  19. a = t("ControllerConst"),
  20. n = (t("ViewConst"), t("ADController"), t("ADManageBase"), t("BagConst")),
  21. r = t("ShopConst"),
  22. {ccclass: l, property: h, menu: c} = cc._decorator;
  23. t = class extends o.default {
  24. constructor() {
  25. super(...arguments),
  26. (this.bubbleNode = null),
  27. (this.iconSpr = null),
  28. (this.boxItems = []),
  29. (this.time = 0),
  30. (this.showIndexArry = null),
  31. (this.showIndex = 0);
  32. }
  33. initUI() {
  34. super.initUI();
  35. const t = s.default.ControllerManager.applyFunc(
  36. a.ControllerConst.Shop,
  37. r.ShopConst.GET_ITEM_DATA_BY_TYPE,
  38. r.ShopType.BOX
  39. );
  40. for (const e of t) {
  41. const t = s.default.ControllerManager.applyFunc(a.ControllerConst.Item, n.BagConst.GET_ITEM, e.cfg.itemId);
  42. this.boxItems.push(t);
  43. }
  44. }
  45. open() {
  46. super.open(), this.updateShowIndexs(), this.updateBubble(s.default.DateUtils.Now());
  47. }
  48. updateShowIndexs() {
  49. let e = [];
  50. var t = s.default.ControllerManager.applyFunc(a.ControllerConst.AD, 4, 7),
  51. i = s.default.ControllerManager.applyFunc(a.ControllerConst.AD, 3, 7);
  52. (t.freeCnt < i.freeCnt || t.adCnt < i.adTimes) && e.push(0);
  53. for (let t = 1; t < this.boxItems.length; t++) this.boxItems[t].cnt && e.push(t);
  54. e.length ? ((this.bubbleNode.active = !0), (this.showIndexArry = e)) : (this.bubbleNode.active = !1);
  55. }
  56. updateBubble(t) {
  57. !this.bubbleNode.active ||
  58. t - this.time < 5e3 ||
  59. ((this.time = t),
  60. (this.bubbleNode.active = !0),
  61. this.showIndex++,
  62. (this.showIndex = this.showIndex % this.showIndexArry.length),
  63. (t = this.showIndexArry[this.showIndex]),
  64. s.default.CommonUtils.setSpriteFrame(this.boxItems[t].getItemPic(), this.iconSpr));
  65. }
  66. onTouchIcon() {
  67. s.default.ViewManager.open(7);
  68. }
  69. };
  70. e([h(cc.Node)], t.prototype, "bubbleNode", void 0),
  71. e([h(cc.Sprite)], t.prototype, "iconSpr", void 0),
  72. (t = e([l, c("view/Shop/ShopViewIcon")], t)),
  73. (i.default = t);