TestSort.js 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. var t = require;
  2. var e = module;
  3. var i = exports;
  4. var s =
  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 { ccclass: o, property: a, playOnFocus: n, executeInEditMode: r, menu: l } = cc._decorator;
  18. e = class {
  19. constructor() {
  20. (this.draw = null), (this._RoundMax = 100), (this._radius = 10), (this.Pos_6 = []);
  21. }
  22. set roundMax(t) {
  23. (this._RoundMax = t), this.___Start();
  24. }
  25. get roundMax() {
  26. return this._RoundMax;
  27. }
  28. set radius(t) {
  29. (this._radius = t), this.___Start();
  30. }
  31. get radius() {
  32. return this._radius;
  33. }
  34. Instantiate(t) {}
  35. onLoad() {
  36. this.___Start();
  37. }
  38. ___Start() {
  39. this.draw.clear();
  40. let e = cc.v2(),
  41. o = this.Pos_6;
  42. this.Instantiate(e);
  43. var t = this._RoundMax,
  44. a = this._radius;
  45. for (let s = 1; s <= t; s++) {
  46. for (let t = 0; t < 6; t++)
  47. (o[t] = cc
  48. .v2(Math.sin((60 * t * Math.PI) / 180) * a * s, Math.cos((60 * t * Math.PI) / 180) * a * s)
  49. .addSelf(e)),
  50. this.Instantiate(o[t]);
  51. if (1 < s)
  52. for (let i = 0; i < 6; i++) {
  53. let e = o[(i + 1) % 6].sub(o[i]).normalize();
  54. for (let t = 1; t < s; t++) {
  55. var n = e.mul(a * t).addSelf(o[i]);
  56. this.Instantiate(n);
  57. }
  58. }
  59. }
  60. this.draw.fill();
  61. } *
  62. getNextPoint(e, i = -3) {
  63. yield e;
  64. let s = [],
  65. t = this._RoundMax;
  66. for (let t = 0; t < 6; t++)
  67. (s[t] = cc.v2(
  68. 124 * Math.sin(((60 * t + i) * Math.PI) / 180),
  69. 124 * Math.cos(((60 * t + i) * Math.PI) / 180)
  70. )),
  71. 2 <= t && t <= 5 && (yield s[t].add(e));
  72. for (let i = 2; i <= t; i++)
  73. for (let t = 2; t <= 5; t++) {
  74. var o = (t + 1) % 6,
  75. a = s[t].mul(i).addSelf(e);
  76. if ((yield a, 5 != t)) {
  77. let e = s[o].sub(s[t]).normalizeSelf();
  78. for (let t = 1; t < i; t++) yield e.mul(124 * t).addSelf(a);
  79. }
  80. }
  81. return null;
  82. }
  83. };
  84. s([a(cc.Graphics)], e.prototype, "draw", void 0),
  85. s([a()], e.prototype, "roundMax", null),
  86. s([a()], e.prototype, "radius", null),
  87. (e = s([o, r, n], e)),
  88. (i.default = e);