MainCat.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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("CostumeConst"),
  18. o = t("GlobalAttr"),
  19. a = t("Chef"),
  20. d = {
  21. [s.CostumeParts.head]: {
  22. skin: "装备/帽子/hat_",
  23. slot1: "head1/maozi",
  24. slot2: "head4/maozi",
  25. targetAttaName1: "head1/maozi",
  26. targetAttaName2: "head4/maozi"
  27. },
  28. [s.CostumeParts.body]: {
  29. skin: "装备/衣服/wear_",
  30. slot1: "cat1/lj2",
  31. slot2: "cat1/lj",
  32. targetAttaName1: "Cat1",
  33. targetAttaName2: "Cat1"
  34. },
  35. [s.CostumeParts.hand]: {
  36. skin: "装备/手持/item_",
  37. slot1: "lam1/zhuangbei",
  38. slot2: "lam3/zhuangbei",
  39. targetAttaName1: "lam1/zhuangbei",
  40. targetAttaName2: "lam3/zhuangbei"
  41. }
  42. },
  43. {ccclass: n} = cc._decorator;
  44. e = e(
  45. [n],
  46. (e = class extends a.default {
  47. constructor() {
  48. super(...arguments),
  49. (this.selfAttr = null),
  50. (this.isWaiter = !1),
  51. (this.curEquMap = Object.create(null)),
  52. (this.skinName = "装备/服务员/waiter_03"),
  53. (this.defaultAttachment = Object.create(null));
  54. }
  55. resetSlot(t) {
  56. var e = this.defaultAttachment[t];
  57. if (e)
  58. for (const i in e) {
  59. const t = e[i];
  60. t.slot.setAttachment(t.attachment);
  61. }
  62. }
  63. updateSlot(e) {
  64. for (const r in d) {
  65. var i = d[r],
  66. s = e[r];
  67. if (s) {
  68. if (!this.curEquMap[r] || this.curEquMap[r] !== s.cfg.idx) {
  69. this.resetSlot(r),
  70. (this.curEquMap[r] = s.cfg.idx),
  71. (this.defaultAttachment[r] = Object.create(null));
  72. const e = s.cfg.idx % 100,
  73. l = i.skin + (e < 10 ? "0" + e : e);
  74. let t = this.sp.skeletonData.getRuntimeData();
  75. var o = this.sp._skeleton.slots,
  76. a = t.findSkin(l);
  77. for (const h in a.attachments) {
  78. const e = a.attachments[h];
  79. for (const c in e)
  80. if ("Cat_1" !== c) {
  81. var n = e[c];
  82. let t = o[h];
  83. t &&
  84. ((this.defaultAttachment[r][c] = {slot: t, attachment: t.getAttachment()}),
  85. t.setAttachment(n));
  86. }
  87. }
  88. }
  89. } else this.resetSlot(r), (this.curEquMap[r] = null), (this.defaultAttachment[r] = null);
  90. }
  91. }
  92. getPerfectDishRate() {
  93. return (
  94. o.default.ins.perfectDishRate +
  95. this.selfAttr.getAttrValue(s.CostumeAbilityType.perfect_dish_rate, 0) / 100
  96. );
  97. }
  98. getCookMoneyRate() {
  99. return o.default.ins.cookMoneyRate;
  100. }
  101. calSpeed() {
  102. var t = o.default.ins,
  103. e = (this.selfAttr.getAttrValue(s.CostumeAbilityType.move_speed, 0) * t.define.crew_move_speed) / 100;
  104. this.isWaiter ? (this.moveSpeed = e + t.waiterspeed) : (this.moveSpeed = e + t.chefspeed);
  105. }
  106. getInstaCompletedDishRate() {
  107. return (
  108. o.default.ins.instaCompletedDishRate +
  109. this.selfAttr.getAttrValue(s.CostumeAbilityType.instaCompleted_dish_rate, 0) / 100
  110. );
  111. }
  112. getCookSpeedRate() {
  113. return this.isWaiter
  114. ? o.default.ins.waiterProductionSpeed +
  115. this.selfAttr.getAttrValue(s.CostumeAbilityType.production_speed, 0) / 100
  116. : o.default.ins.chefProductionSpeed +
  117. this.selfAttr.getAttrValue(s.CostumeAbilityType.production_speed, 0) / 100;
  118. }
  119. })
  120. );
  121. i.default = e;