790e4b03-8c5e-4858-935a-5df97f33c478.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. "use strict";
  2. cc._RF.push(module, '790e4sDjF5IWJNaXfl/M8R4', 'HandAction');
  3. // common-plugin/Scripts/HandAction.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 (b.hasOwnProperty(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. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  26. var HandAction = /** @class */ (function (_super) {
  27. __extends(HandAction, _super);
  28. function HandAction() {
  29. var _this = _super !== null && _super.apply(this, arguments) || this;
  30. _this.runTime = 0.3;
  31. return _this;
  32. // update (dt) {}
  33. }
  34. HandAction.prototype.onLoad = function () {
  35. if (cc.winSize.height < cc.winSize.width) {
  36. // 横屏游戏
  37. this.node.scale = cc.view.getDesignResolutionSize().width / 1920 * 0.5;
  38. }
  39. else {
  40. this.node.scale = cc.view.getDesignResolutionSize().width / 1080 * 0.5;
  41. }
  42. };
  43. HandAction.prototype.onEnable = function () {
  44. this.node.runAction(cc.sequence(cc.moveBy(this.runTime, cc.v2(-50, +50)), cc.moveBy(this.runTime, cc.v2(+50, -50))).repeatForever());
  45. };
  46. HandAction.prototype.onDisable = function () {
  47. this.node.stopAllActions();
  48. };
  49. __decorate([
  50. property({ type: cc.Float })
  51. ], HandAction.prototype, "runTime", void 0);
  52. HandAction = __decorate([
  53. ccclass
  54. ], HandAction);
  55. return HandAction;
  56. }(cc.Component));
  57. exports.default = HandAction;
  58. cc._RF.pop();