TipView.js 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. var t = require;
  2. var e = module;
  3. var i = exports;
  4. var s,
  5. e =
  6. (this && this.__decorate) ||
  7. function (t, e, i, s) {
  8. var o,
  9. a = arguments.length,
  10. n = a < 3 ? e : null === s ? (s = Object.getOwnPropertyDescriptor(e, i)) : s;
  11. if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) n = Reflect.decorate(t, e, i, s);
  12. else
  13. for (var r = t.length - 1; 0 <= r; r--)
  14. (o = t[r]) && (n = (a < 3 ? o(n) : 3 < a ? o(e, i, n) : o(e, i)) || n);
  15. return 3 < a && n && Object.defineProperty(e, i, n), n;
  16. };
  17. Object.defineProperty(i, "__esModule", {value: !0}), (i.TIPSTATE = void 0);
  18. const o = t("GameText"),
  19. a = t("BaseView");
  20. ((t = s = i.TIPSTATE || (i.TIPSTATE = {}))[(t.SURE = 0)] = "SURE"),
  21. (t[(t.SURE_CANCEL = 1)] = "SURE_CANCEL"),
  22. (t[(t.NO_SURE = 2)] = "NO_SURE");
  23. const {ccclass: n, property: r} = cc._decorator;
  24. t = class extends a.default {
  25. constructor() {
  26. super(...arguments),
  27. (this.leftBtn = null),
  28. (this.rightBtn = null),
  29. (this.descLab = null),
  30. (this.closeBtn = null),
  31. (this.titleLab = null),
  32. (this.leftBtnLab = null),
  33. (this.rightBtnLab = null),
  34. (this.closeType = 0),
  35. (this.bgType = 1);
  36. }
  37. initUI() {
  38. super.initUI(),
  39. (this.leftBtnLab = this.leftBtn.target.getChildByName("Label").getComponent(cc.Label)),
  40. (this.rightBtnLab = this.rightBtn.target.getChildByName("Label").getComponent(cc.Label));
  41. }
  42. open(t) {
  43. super.open(), this.init(t);
  44. }
  45. init(t) {
  46. if (t) {
  47. switch ((this.data = t).curState) {
  48. case s.SURE:
  49. (this.rightBtn.node.active = !1), (this.leftBtn.node.active = !0);
  50. break;
  51. case s.SURE_CANCEL:
  52. (this.rightBtn.node.active = !0), (this.leftBtn.node.active = !0);
  53. break;
  54. case s.NO_SURE:
  55. (this.rightBtn.node.active = !1), (this.leftBtn.node.active = !1);
  56. break;
  57. default:
  58. (this.rightBtn.node.active = !1), (this.leftBtn.node.active = !0);
  59. }
  60. (this.closeBtn.node.active = t.hasCloseBtn),
  61. (this.leftBtnLab.string = t.leftBtnText || o.GameText.getText(17)),
  62. (this.rightBtnLab.string = t.rightBtnText),
  63. (this.descLab.string = t.tipsStr),
  64. (this.titleLab.string = t.title || o.GameText.getText(lang.ui_tip_view_title));
  65. }
  66. }
  67. onLeftBtn() {
  68. this.data.leftFunc && this.data.leftFunc.apply(this.data.leftThisObj), this.onTouchClose();
  69. }
  70. onRightBtn() {
  71. this.data.rightFunc && this.data.rightFunc.apply(this.data.rightThisObj), this.onTouchClose();
  72. }
  73. };
  74. e([r(cc.Button)], t.prototype, "leftBtn", void 0),
  75. e([r(cc.Button)], t.prototype, "rightBtn", void 0),
  76. e([r(cc.Label)], t.prototype, "descLab", void 0),
  77. e([r(cc.Button)], t.prototype, "closeBtn", void 0),
  78. e([r(cc.Label)], t.prototype, "titleLab", void 0),
  79. (t = e([n], t)),
  80. (i.default = t);