CongratulationView.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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("BagConst"),
  21. r = t("CostumeItem"),
  22. l = t("GameConst"),
  23. h = t("CongratulationItem"),
  24. { ccclass: c, property: d, menu: u } = cc._decorator;
  25. t = class extends o.default {
  26. constructor() {
  27. super(...arguments),
  28. (this.content = null),
  29. (this.ani = null),
  30. (this.congratulationItem = null),
  31. (this.passIcon = null),
  32. (this.passRewardIcon = null),
  33. (this.passCountLab = null),
  34. (this.titleLab = null),
  35. (this.items = []),
  36. (this.showItems = null),
  37. (this.callBack = null),
  38. (this.bgType = 1);
  39. }
  40. initUI() {
  41. super.initUI();
  42. }
  43. open(t, e, i) {
  44. super.open(),
  45. (this.callBack = i),
  46. t instanceof Array ? ((this.showItems = t), this.resetView(this.showItems.pop())) : this.resetView(t, e);
  47. }
  48. showItem(t, e) {
  49. t =
  50. "number" == typeof t ?
  51. s.default.ControllerManager.applyFunc(a.ControllerConst.Item, n.BagConst.GET_ITEM, t) :
  52. t;
  53. if (((this.passIcon.node.active = !1), (this.congratulationItem.node.active = !0), t.isCostume())) {
  54. const i = t;
  55. this.congratulationItem.setCostumeItemData(i.getTempCostume(), e);
  56. } else this.congratulationItem.setItemData(t, e);
  57. }
  58. showCostumeItem(t, e) {
  59. (this.passIcon.node.active = !1),
  60. (this.congratulationItem.node.active = !0),
  61. this.congratulationItem.setCostumeItemData(t, e);
  62. }
  63. showCongratulationData(t) {
  64. t.type == l.CongratulationType.Pass ?
  65. ((this.passIcon.node.active = !0),
  66. (this.congratulationItem.node.active = !1),
  67. s.default.CommonUtils.setSpriteFrame(t.iconUrl, this.passRewardIcon),
  68. (this.passCountLab.string = "x" + t.cnt),
  69. s.default.CommonUtils.setSpriteFrameByBundle(l.BundleType.MAP_ICON, t.passIcon, this.passIcon)) :
  70. ((this.passIcon.node.active = !1),
  71. (this.congratulationItem.node.active = !0),
  72. t.data ?
  73. t.data instanceof r.default ?
  74. this.showCostumeItem(t.data, t.cnt) :
  75. this.showItem(t.data, t.cnt) :
  76. this.congratulationItem.setCustomeData(t));
  77. }
  78. resetView(t, e = 1) {
  79. for (const s of this.ani.node.children) s.scale = 0;
  80. let i = "恭喜获得";
  81. t instanceof r.default ?
  82. this.showCostumeItem(t, 1) :
  83. t instanceof l.CongratulationData ?
  84. (this.showCongratulationData(t), t.type == l.CongratulationType.Pass && (i = "新店开业")) :
  85. this.showItem(t, e),
  86. (this.titleLab.string = i),
  87. this.ani.once(cc.Animation.EventType.FINISHED, () => {
  88. this.ani.play("idle");
  89. }),
  90. this.ani.play("work");
  91. }
  92. onTouchClose() {
  93. this.showItems && this.showItems.length ?
  94. this.resetView(this.showItems.pop()) :
  95. (this.closeView(), this.callBack && (this.callBack(), (this.callBack = null)));
  96. }
  97. };
  98. e([d(cc.Node)], t.prototype, "content", void 0),
  99. e([d(cc.Animation)], t.prototype, "ani", void 0),
  100. e([d(h.default)], t.prototype, "congratulationItem", void 0),
  101. e([d(cc.Sprite)], t.prototype, "passIcon", void 0),
  102. e([d(cc.Sprite)], t.prototype, "passRewardIcon", void 0),
  103. e([d(cc.Label)], t.prototype, "passCountLab", void 0),
  104. e([d(cc.Label)], t.prototype, "titleLab", void 0),
  105. (t = e([c], t)),
  106. (i.default = t);