ShopBuffViewIcon.js 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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("ViewConst"), t("TimeCom")),
  20. {property: n, ccclass: r, menu: l} = cc._decorator;
  21. t = class extends o.default {
  22. constructor() {
  23. super(...arguments),
  24. (this.item = null),
  25. (this.content = null),
  26. (this.arrow = null),
  27. (this.rePoint = null),
  28. (this.isPlayIng = !1),
  29. (this.controller = null),
  30. (this.bgType = 0);
  31. }
  32. initUI() {
  33. super.initUI(), (this.itemMap = new Map());
  34. }
  35. open() {
  36. super.open();
  37. }
  38. updateBuffItem(e, i) {
  39. if (!this.itemMap.has(i.buffIndex)) {
  40. let t = cc.instantiate(this.item);
  41. this.content.addChild(t),
  42. (t.y = 30 * this.itemMap.size + 50),
  43. this.itemMap.set(i.buffIndex, t.getComponent(a.TimeCom)),
  44. this.itemMap.get(i.buffIndex).setIcon(e),
  45. (this.content.height = 30 * this.itemMap.size + 50);
  46. }
  47. this.itemMap.get(i.buffIndex).setTime(i.buffEndTime),
  48. (this.arrow.active = !0),
  49. (this.rePoint.active = !1),
  50. this.content.active && this.hideItem();
  51. }
  52. updateTime(i) {
  53. this.itemMap &&
  54. (this.itemMap.forEach((t, e) => {
  55. t.updateTime(i) && (t.node.removeFromParent(), t.destroy(), this.itemMap.delete(e));
  56. }),
  57. this.itemMap.size || ((this.rePoint.active = !0), (this.arrow.active = !1)));
  58. }
  59. showItem() {
  60. var t = 30 * this.itemMap.size + 48;
  61. (this.isPlayIng = !0),
  62. (this.arrow.scaleY = -1),
  63. cc
  64. .tween(this.arrow)
  65. .to(0.1, {y: t})
  66. .call(() => {
  67. (this.content.active = !0), (this.isPlayIng = !1);
  68. })
  69. .start();
  70. }
  71. hideItem() {
  72. (this.isPlayIng = !0),
  73. (this.content.active = !1),
  74. (this.arrow.scaleY = 1),
  75. cc
  76. .tween(this.arrow)
  77. .to(0.1, {y: 48})
  78. .call(() => {
  79. this.isPlayIng = !1;
  80. })
  81. .start();
  82. }
  83. onTouchIcon() {
  84. s.default.ViewManager.open(28);
  85. }
  86. onTouchArrow() {
  87. this.isPlayIng || (this.content.active ? this.hideItem() : this.showItem());
  88. }
  89. };
  90. e([n(cc.Prefab)], t.prototype, "item", void 0),
  91. e([n(cc.Node)], t.prototype, "content", void 0),
  92. e([n(cc.Node)], t.prototype, "arrow", void 0),
  93. e([n(cc.Node)], t.prototype, "rePoint", void 0),
  94. (t = e([r, l("view/Shop/ShopBuffViewIcon")], t)),
  95. (i.default = t);