SwitchMapView.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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("GameText"),
  19. a = t("BaseView"),
  20. n = t("ControllerConst"),
  21. r = (t("ViewConst"), t("BagConst")),
  22. l = t("GameConst"),
  23. h = t("MachineService"),
  24. c = t("MapService"),
  25. { ccclass: d, property: u, menu: p } = cc._decorator;
  26. t = class extends a.default {
  27. constructor() {
  28. super(...arguments),
  29. (this.nowIconSpr = null),
  30. (this.newIconSpr = null),
  31. (this.nowNameLab = null),
  32. (this.newNameLab = null),
  33. (this.rewardNumLab = null),
  34. (this.conditionRichText = null),
  35. (this.btn = null),
  36. (this.btnLab = null),
  37. (this.rewardNode = null),
  38. (this.rewardIcon = null),
  39. (this.mapId = -1),
  40. (this.bgType = 1);
  41. }
  42. open() {
  43. if ((super.open(), this.mapId != c.default.ins.curId)) {
  44. this.mapId = c.default.ins.curId;
  45. const e = c.default.ins.curCfg,
  46. i = this.mapId + 1;
  47. if (0 < e.clear_reward_suitcasekey_count) {
  48. (this.rewardNode.active = !0), (this.rewardNumLab.string = "x" + e.clear_reward_suitcasekey_count);
  49. const i = s.default.ControllerManager.applyFunc(
  50. n.ControllerConst.Item,
  51. r.BagConst.GET_ITEM,
  52. e.clear_reward_suitcasekey_idx
  53. );
  54. s.default.CommonUtils.setSpriteFrame(i.getItemPic(), this.rewardIcon);
  55. } else this.rewardNode.active = !1;
  56. var t = s.default.ConfigManager.getConfig("StageSet")[i];
  57. s.default.CommonUtils.setSpriteFrameByBundle(
  58. l.BundleType.MAP_ICON,
  59. "stage/" + e.stage_icon,
  60. this.nowIconSpr
  61. ),
  62. s.default.CommonUtils.setSpriteFrameByBundle(
  63. l.BundleType.MAP_ICON,
  64. "stage/" + t.stage_icon,
  65. this.newIconSpr
  66. ),
  67. (this.newNameLab.string = o.GameText.getTextByStr(t.stage_name)),
  68. (this.nowNameLab.string = o.GameText.getTextByStr(e.stage_name)),
  69. (this.conditionRichText.string = `<b><color=#b86860>\u6240\u6709\u5de5\u4f5c\u53f0\u9762\u8fbe\u5230</c><color=#6c9f64>${e.machine_max_lv}\u7b49\u7ea7</color><color=#b86860>\uff01\uff01</c></b>`),
  70. this.updateBtnState();
  71. }
  72. }
  73. initUI() {
  74. super.initUI();
  75. }
  76. updateBtnState() {
  77. var t = h.default.ins.isAllMachineMax();
  78. (this.btn.interactable = t), this.btnLab.setMaterial(0, t ? this.btn.normalMaterial : this.btn.grayMaterial);
  79. }
  80. onTouchBtn() {
  81. console.error('必须请求服务器接口...得到消息之后才可以判断是否下一关');
  82. setTimeout(() => {
  83. c.default.ins.switchMap(), this.closeView();
  84. }, 1000 * 2)
  85. }
  86. onTouchWorldMap() {
  87. s.default.ViewManager.open(54, !0);
  88. }
  89. };
  90. e([u(cc.Sprite)], t.prototype, "nowIconSpr", void 0),
  91. e([u(cc.Sprite)], t.prototype, "newIconSpr", void 0),
  92. e([u(cc.Label)], t.prototype, "nowNameLab", void 0),
  93. e([u(cc.Label)], t.prototype, "newNameLab", void 0),
  94. e([u(cc.Label)], t.prototype, "rewardNumLab", void 0),
  95. e([u(cc.RichText)], t.prototype, "conditionRichText", void 0),
  96. e([u(cc.Button)], t.prototype, "btn", void 0),
  97. e([u(cc.Label)], t.prototype, "btnLab", void 0),
  98. e([u(cc.Node)], t.prototype, "rewardNode", void 0),
  99. e([u(cc.Sprite)], t.prototype, "rewardIcon", void 0),
  100. (t = e([d], t)),
  101. (i.default = t);