System.register(["cc"], function (_export, _context) {
  "use strict";

  var _cclegacy, _decorator, Component, systemEvent, SystemEventType, v2, _dec, _class, _temp, _crd, ccclass, property, Main;

  return {
    setters: [function (_cc) {
      _cclegacy = _cc.cclegacy;
      _decorator = _cc._decorator;
      Component = _cc.Component;
      systemEvent = _cc.systemEvent;
      SystemEventType = _cc.SystemEventType;
      v2 = _cc.v2;
    }],
    execute: function () {
      _crd = true;

      _cclegacy._RF.push({}, "d7039btV91L1ZMNfqT5gCHv", "main", undefined);

      ({
        ccclass,
        property
      } = _decorator);

      _export("Main", Main = (_dec = ccclass('Main'), _dec(_class = (_temp = class Main extends Component {
        constructor(...args) {
          super(...args);
          this._acc = v2(0, 0);
          this._direction = 0;
        }

        start() {
          systemEvent.setAccelerometerEnabled(true);
          systemEvent.setAccelerometerInterval(1 / 60);
          systemEvent.on(SystemEventType.DEVICEMOTION, this._onDeviceMotion, this);
        }

        onDestory() {
          systemEvent.off(SystemEventType.DEVICEMOTION, this._onDeviceMotion, this);
          systemEvent.setAccelerometerEnabled(false);
        }

        _onDeviceMotion(event) {
          this._acc.x = event.acc.x;
          this._acc.y = event.acc.y;
          this._direction = event.acc.x < 0 ? 1 : 2;
          console.log("重力感应事件", this._acc.x, this._direction);
        }

      }, _temp)) || _class));

      _cclegacy._RF.pop();

      _crd = false;
    }
  };
});
//# sourceMappingURL=main.js.map