Chef.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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("GlobalAttr"),
  19. a = t("MyBigLong"),
  20. n = t("MapService"),
  21. r = t("BaseMan"),
  22. {ccclass: l, property: h} = cc._decorator;
  23. t = class extends r.default {
  24. constructor() {
  25. super(...arguments),
  26. (this.progress = null),
  27. (this.food = null),
  28. (this.basePos = null),
  29. (this.frontFood = null),
  30. (this.backFood = null),
  31. (this.moneyLab = null),
  32. (this.fireNode = null),
  33. (this.skinName = "装备/服务员/waiter_02");
  34. }
  35. onLoad() {
  36. this.food.node.removeFromParent(), this.initSkin();
  37. }
  38. initSkin() {
  39. if (this.skinName) {
  40. var t = this.sp.skeletonData.getRuntimeData().findSkin(this.skinName),
  41. e = this.sp._skeleton.slots;
  42. for (const o in t.attachments) {
  43. var i = t.attachments[o];
  44. for (const a in i)
  45. if ("Cat_1" !== a) {
  46. let t = e[o];
  47. var s = i[a];
  48. t && t.setAttachment(s);
  49. }
  50. }
  51. }
  52. }
  53. showInstaCompletedDishEffect() {
  54. const t = new cc.Node(),
  55. e = t.addComponent(cc.Label);
  56. (e.string = "立即完成"),
  57. (e.fontSize = 30),
  58. n.default.ins.uiLayer.addChild(t),
  59. (t.position = this.node.position),
  60. (t.y += 100),
  61. cc
  62. .tween(t)
  63. .to(0.1, {scale: 1.1}, {easing: cc.easing.sineOut})
  64. .to(0.1, {scale: 1}, {easing: cc.easing.sineIn})
  65. .to(0.7, {y: t.y + 50})
  66. .delay(0.2)
  67. .to(0.3, {opacity: 0})
  68. .call(() => {
  69. t.destroy();
  70. })
  71. .start();
  72. }
  73. calSpeed() {
  74. this.moveSpeed = o.default.ins.chefspeed;
  75. }
  76. getCookMoneyRate() {
  77. return o.default.ins.cookMoneyRate;
  78. }
  79. getInstaCompletedDishRate() {
  80. return o.default.ins.instaCompletedDishRate;
  81. }
  82. getCookSpeedRate() {
  83. return o.default.ins.chefProductionSpeed;
  84. }
  85. getPerfectDishRate() {
  86. return o.default.ins.perfectDishRate;
  87. }
  88. showFood(t, e) {
  89. (this.food.spriteFrame = t),
  90. 4 === this._direction
  91. ? (this.food.node.removeFromParent(!1), this.backFood.addChild(this.food.node))
  92. : (this.food.node.removeFromParent(!1), this.frontFood.addChild(this.food.node));
  93. const i = (this.moneyLab = s.default.NodePoolMsr.moneyLabPool.pop());
  94. this.node.addChild(i), (i.getComponent(cc.Label).string = a.default.toString(e));
  95. }
  96. hideFood() {
  97. this.food.node.parent && this.food.node.removeFromParent(!1),
  98. (this.food.spriteFrame = null),
  99. this.moneyLab && this.moneyLab.pool.push(this.moneyLab);
  100. }
  101. set direction(t) {
  102. this.food.node.parent &&
  103. t !== this._direction &&
  104. (4 === t
  105. ? (this.food.node.removeFromParent(!1), this.backFood.addChild(this.food.node))
  106. : 4 === this._direction &&
  107. (this.food.node.removeFromParent(!1), this.frontFood.addChild(this.food.node))),
  108. (this._direction = t),
  109. (this.aniPre = r.aniMap[t]),
  110. (this.sp.node.scaleX = 4 < t ? -1 : 1),
  111. (this.state = this._state);
  112. }
  113. showFire() {
  114. this.fireNode ||
  115. (0 < o.default.ins.buffAttr.attr.COOK_SPEED &&
  116. ((this.fireNode = s.default.NodePoolMsr.fireAniPool.pop()),
  117. this.node.addChild(this.fireNode),
  118. this.fireNode.setSiblingIndex(0)));
  119. }
  120. removeFire() {
  121. this.fireNode && (s.default.NodePoolMsr.fireAniPool.push(this.fireNode), (this.fireNode = null));
  122. }
  123. };
  124. e([h(cc.ProgressBar)], t.prototype, "progress", void 0),
  125. e([h(cc.Sprite)], t.prototype, "food", void 0),
  126. e([h(cc.Node)], t.prototype, "frontFood", void 0),
  127. e([h(cc.Node)], t.prototype, "backFood", void 0),
  128. (t = e([l], t)),
  129. (i.default = t);