3346e31b-f7c4-4e65-95a3-5a030b645ce9.js 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. "use strict";
  2. cc._RF.push(module, '3346eMb98ROZZWjWgMLZFzp', 'Beef');
  3. // Script/Beef.ts
  4. "use strict";
  5. var __extends = (this && this.__extends) || (function () {
  6. var extendStatics = function (d, b) {
  7. extendStatics = Object.setPrototypeOf ||
  8. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  9. function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
  10. return extendStatics(d, b);
  11. };
  12. return function (d, b) {
  13. extendStatics(d, b);
  14. function __() { this.constructor = d; }
  15. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16. };
  17. })();
  18. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  19. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  20. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  21. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  22. return c > 3 && r && Object.defineProperty(target, key, r), r;
  23. };
  24. Object.defineProperty(exports, "__esModule", { value: true });
  25. exports.FoodType = exports.BeefState = void 0;
  26. var guidePanel_1 = require("./guide/guidePanel");
  27. var App_1 = require("./Manager/App");
  28. var SoundManager_1 = require("./Manager/SoundManager");
  29. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  30. var BeefState;
  31. (function (BeefState) {
  32. BeefState[BeefState["Raw"] = 0] = "Raw";
  33. BeefState[BeefState["Cooked"] = 1] = "Cooked";
  34. BeefState[BeefState["Burnt"] = 2] = "Burnt";
  35. BeefState[BeefState["Plate"] = 3] = "Plate";
  36. BeefState[BeefState["YellowSouce"] = 4] = "YellowSouce";
  37. BeefState[BeefState["Cocumber"] = 5] = "Cocumber";
  38. BeefState[BeefState["Tomato"] = 6] = "Tomato";
  39. BeefState[BeefState["RedSouce"] = 7] = "RedSouce";
  40. })(BeefState = exports.BeefState || (exports.BeefState = {}));
  41. var FoodType;
  42. (function (FoodType) {
  43. FoodType[FoodType["None"] = 0] = "None";
  44. FoodType[FoodType["Drink"] = 1] = "Drink";
  45. FoodType[FoodType["PureSteak"] = 2] = "PureSteak";
  46. FoodType[FoodType["CocumberSteak"] = 3] = "CocumberSteak";
  47. FoodType[FoodType["TomatoSteak"] = 4] = "TomatoSteak";
  48. FoodType[FoodType["YellowSteak"] = 5] = "YellowSteak";
  49. FoodType[FoodType["RedSteak"] = 6] = "RedSteak";
  50. })(FoodType = exports.FoodType || (exports.FoodType = {}));
  51. ;
  52. var Beef = /** @class */ (function (_super) {
  53. __extends(Beef, _super);
  54. function Beef() {
  55. var _this = _super !== null && _super.apply(this, arguments) || this;
  56. // 牛肉
  57. _this.beefs = [];
  58. // // 黄瓜
  59. // @property([cc.SpriteFrame])
  60. // huangGua: cc.SpriteFrame[] = [];
  61. // // 番茄
  62. // @property([cc.SpriteFrame])
  63. // tomato: cc.SpriteFrame[] = [];
  64. // // 芝士
  65. // @property([cc.SpriteFrame])
  66. // Cheese: cc.SpriteFrame[] = [];
  67. // // 番茄酱
  68. // @property([cc.SpriteFrame])
  69. // fanQieJiang: cc.SpriteFrame[] = [];
  70. _this.spBeef = null;
  71. _this.nodeCocumber = null;
  72. _this.nodeTomato = null;
  73. _this.nodeYellowSouce = null;
  74. _this.nodeRedSouce = null;
  75. _this.pBarCooked = null;
  76. _this.pBarBurnt = null;
  77. _this.m_state = BeefState.Raw;
  78. _this.m_foodType = FoodType.None;
  79. _this.m_cookedTime = 3;
  80. _this.m_burntTime = 3;
  81. _this.m_pause = false;
  82. return _this;
  83. }
  84. Beef.prototype.onLoad = function () {
  85. };
  86. Beef.prototype.start = function () {
  87. this.setState(BeefState.Raw);
  88. };
  89. Beef.prototype.setState = function (state) {
  90. var _this = this;
  91. this.m_state = state;
  92. switch (this.m_state) {
  93. case BeefState.Raw:
  94. cc.tween(this.pBarCooked).to(this.m_cookedTime, { progress: 1 }).call(function () {
  95. _this.setState(BeefState.Cooked);
  96. }).start();
  97. break;
  98. case BeefState.Cooked:
  99. this.spBeef.spriteFrame = this.beefs[1];
  100. this.pBarCooked.node.active = false;
  101. this.pBarBurnt.node.active = true;
  102. if (App_1.App.DataManager.guideStep == 1) {
  103. guidePanel_1.default.getInstance().showCurGuide();
  104. }
  105. cc.tween(this.pBarBurnt).to(this.m_burntTime, { progress: 1 }).call(function () {
  106. _this.setState(BeefState.Burnt);
  107. }).start();
  108. App_1.App.SoundManager.playEffect(SoundManager_1.SoundManager.cookingOver);
  109. break;
  110. case BeefState.Burnt:
  111. this.pBarCooked.node.active = false;
  112. this.pBarBurnt.node.active = false;
  113. this.spBeef.spriteFrame = this.beefs[2];
  114. break;
  115. case BeefState.Plate:
  116. cc.Tween.stopAllByTarget(this.pBarCooked);
  117. cc.Tween.stopAllByTarget(this.pBarBurnt);
  118. this.pBarCooked.node.active = false;
  119. this.pBarBurnt.node.active = false;
  120. this.m_foodType = FoodType.PureSteak;
  121. break;
  122. case BeefState.YellowSouce:
  123. this.nodeYellowSouce.active = true;
  124. this.m_foodType = FoodType.YellowSteak;
  125. break;
  126. case BeefState.Cocumber:
  127. this.nodeCocumber.active = true;
  128. this.m_foodType = FoodType.CocumberSteak;
  129. break;
  130. case BeefState.Tomato:
  131. this.nodeTomato.active = true;
  132. this.m_foodType = FoodType.TomatoSteak;
  133. break;
  134. case BeefState.RedSouce:
  135. this.nodeRedSouce.active = true;
  136. this.m_foodType = FoodType.RedSteak;
  137. break;
  138. }
  139. };
  140. Beef.prototype.update = function (dt) {
  141. if (!this.m_pause) {
  142. if (this.m_state == BeefState.Raw) {
  143. this.m_cookedTime -= dt;
  144. }
  145. else if (this.m_state == BeefState.Cooked) {
  146. this.m_burntTime -= dt;
  147. }
  148. }
  149. };
  150. __decorate([
  151. property([cc.SpriteFrame])
  152. ], Beef.prototype, "beefs", void 0);
  153. __decorate([
  154. property(cc.Sprite)
  155. ], Beef.prototype, "spBeef", void 0);
  156. __decorate([
  157. property(cc.Node)
  158. ], Beef.prototype, "nodeCocumber", void 0);
  159. __decorate([
  160. property(cc.Node)
  161. ], Beef.prototype, "nodeTomato", void 0);
  162. __decorate([
  163. property(cc.Node)
  164. ], Beef.prototype, "nodeYellowSouce", void 0);
  165. __decorate([
  166. property(cc.Node)
  167. ], Beef.prototype, "nodeRedSouce", void 0);
  168. __decorate([
  169. property(cc.ProgressBar)
  170. ], Beef.prototype, "pBarCooked", void 0);
  171. __decorate([
  172. property(cc.ProgressBar)
  173. ], Beef.prototype, "pBarBurnt", void 0);
  174. Beef = __decorate([
  175. ccclass
  176. ], Beef);
  177. return Beef;
  178. }(cc.Component));
  179. exports.default = Beef;
  180. cc._RF.pop();