4f9ed18d6888522e624477ee9367504b1189be0c.js 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. System.register(["cc"], function (_export, _context) {
  2. "use strict";
  3. var _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, Component, input, Input, _dec, _class, _class2, _descriptor, _crd, ccclass, property, self_plane;
  4. function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
  5. function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
  6. function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
  7. return {
  8. setters: [function (_cc) {
  9. _cclegacy = _cc.cclegacy;
  10. __checkObsolete__ = _cc.__checkObsolete__;
  11. __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
  12. _decorator = _cc._decorator;
  13. Component = _cc.Component;
  14. input = _cc.input;
  15. Input = _cc.Input;
  16. }],
  17. execute: function () {
  18. _crd = true;
  19. _cclegacy._RF.push({}, "aab8fR03J1HCIVTbvXr9zTq", "self-plane", undefined);
  20. __checkObsolete__(['_decorator', 'Component', 'Node', 'input', 'Input', 'EventTouch']);
  21. ({
  22. ccclass,
  23. property
  24. } = _decorator);
  25. _export("self_plane", self_plane = (_dec = ccclass('self_plane'), _dec(_class = (_class2 = class self_plane extends Component {
  26. constructor(...args) {
  27. super(...args);
  28. _initializerDefineProperty(this, "speed", _descriptor, this);
  29. }
  30. start() {
  31. // input.on(Input.EventType.TOUCH_START, this._touchStart, this);
  32. input.on(Input.EventType.TOUCH_MOVE, this._touchMove, this);
  33. } // update(deltaTime: number) {
  34. // }
  35. _touchMove(event) {
  36. const delta = event.getDelta();
  37. let pos = this.node.position; // x 上下, z 左右
  38. // this.node.setPosition(pos.x - 0.01 * this.speed * delta.x, pos.y, pos.z - 0.01 * this.speed * delta.y)
  39. this.node.setPosition(pos.x + 0.01 * this.speed * delta.y, pos.y, pos.z + 0.01 * this.speed * delta.x);
  40. }
  41. }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "speed", [property], {
  42. configurable: true,
  43. enumerable: true,
  44. writable: true,
  45. initializer: function () {
  46. return 1;
  47. }
  48. })), _class2)) || _class));
  49. _cclegacy._RF.pop();
  50. _crd = false;
  51. }
  52. };
  53. });
  54. //# sourceMappingURL=4f9ed18d6888522e624477ee9367504b1189be0c.js.map