WorldMapView.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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 u = t("App"),
  18. p = t("GameText"),
  19. s = t("BaseView"),
  20. f = (t("ViewConst"), t("GameConst")),
  21. g = t("MapService"),
  22. { ccclass: o, property: a, menu: n } = cc._decorator;
  23. t = class extends s.default {
  24. constructor() {
  25. super(...arguments),
  26. (this.scrollView = null),
  27. (this.mask = null),
  28. (this.dianContent = null),
  29. (this.lineContent = null),
  30. (this.nameBgContent = null),
  31. (this.nameLabContent = null),
  32. (this.mapIconContent = null),
  33. (this.mapId = -1),
  34. (this.bgType = 1);
  35. }
  36. initUI() {
  37. super.initUI();
  38. }
  39. open(i = !1) {
  40. i && u.default.ViewManager.close(20), (this.mask.active = !1), (this.mapId = g.default.ins.curId);
  41. const s = g.default.ins.getCurRegionCfgs(),
  42. o = this.mapIconContent.children,
  43. e = this.lineContent.children,
  44. a = this.dianContent.children,
  45. n = this.nameBgContent.children,
  46. r = this.nameLabContent.children;
  47. let l = 0,
  48. h = 0;
  49. for (let t = 0; t < s.length; t++) {
  50. const i = s[t];
  51. var c = parseInt(i.stage);
  52. if (c <= this.mapId) {
  53. (a[t].active = !0),
  54. (r[t].active = !0),
  55. (n[t].active = !0),
  56. (r[t].getComponent(cc.Label).string = t + 1 + "." + p.GameText.getTextByStr(s[t].stage_name));
  57. const i = o[t].getComponent(cc.Sprite);
  58. u.default.CommonUtils.setSpriteFrameByBundle(f.BundleType.MAP_ICON, "stage/" + s[t].stage_icon, i);
  59. var d = o[t].position;
  60. (h = o[t + 1].position.sub(d).len() - 25),
  61. (e[t].width = h),
  62. c == this.mapId && ((e[t].width = 0), (l = t + 1));
  63. }
  64. }
  65. if ((4 < l && (this.scrollView.content.y = -o[l - 1].y - 700), i)) {
  66. const i = u.default.ConfigManager.getConfig("Region")[s[0].region + 1];
  67. cc.tween(e[l - 1])
  68. .delay(1)
  69. .to(2, { width: h })
  70. .call(() => {
  71. (a[l].active = !0), (r[l].active = !0), (n[l].active = !0);
  72. const t = o[l].getComponent(cc.Sprite),
  73. e = r[l].getComponent(cc.Label);
  74. 7 == l ?
  75. ((e.string = l + "." + p.GameText.getTextByStr(i.region_name)),
  76. u.default.CommonUtils.setSpriteFrameByBundle(
  77. f.BundleType.MAP_ICON,
  78. "region/" + i.region_icon,
  79. t
  80. )) :
  81. ((e.string = l + "." + p.GameText.getTextByStr(s[l].stage_name)),
  82. u.default.CommonUtils.setSpriteFrameByBundle(
  83. f.BundleType.MAP_ICON,
  84. "stage/" + s[l].stage_icon,
  85. t
  86. ));
  87. })
  88. .delay(3)
  89. .call(() => {
  90. g.default.ins.switchMap(), this.closeView();
  91. })
  92. .start();
  93. }
  94. }
  95. };
  96. e([a(cc.ScrollView)], t.prototype, "scrollView", void 0),
  97. e([a(cc.Node)], t.prototype, "mask", void 0),
  98. e([a(cc.Node)], t.prototype, "dianContent", void 0),
  99. e([a(cc.Node)], t.prototype, "lineContent", void 0),
  100. e([a(cc.Node)], t.prototype, "nameBgContent", void 0),
  101. e([a(cc.Node)], t.prototype, "nameLabContent", void 0),
  102. e([a(cc.Node)], t.prototype, "mapIconContent", void 0),
  103. (t = e([o], t)),
  104. (i.default = t);